${e(localized(battle.title,lang))}
- ${e(t.kills)}
- ${battle.kills==null?'—':number(battle.kills)}
- ${e(t.deaths)}
- ${battle.deaths==null?'—':number(battle.deaths)}
From 8dd0c875355d24f8d1ea5d3e8e726885aae37cd2 Mon Sep 17 00:00:00 2001
From: Meghdad <61308304+MeghdadFadaee@users.noreply.github.com>
Date: Tue, 20 Oct 2026 16:07:38 +0330
Subject: [PATCH] feat: highlight six best battles and compact the archive
table
---
content/translations.json | 2 --
docs/battle-import.md | 8 +++++---
docs/content.md | 5 +++--
scripts/render-battles.mjs | 12 +++++++-----
src/styles.css | 3 ++-
test/battles.test.mjs | 16 ++++++++++------
test/content.test.mjs | 4 ++++
7 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/content/translations.json b/content/translations.json
index 5f2a47a..c7a7479 100644
--- a/content/translations.json
+++ b/content/translations.json
@@ -1,6 +1,5 @@
{
"en": {
- "moreBattleReports": "Explore {count} more reports",
"battleArchive": "From the war archive", "singleReport": "Battle report", "combinedReport": "Campaign report", "europe": "Europe", "engagement": "engagement", "engagements": "engagements", "reportIds": "Battle report IDs", "archivedReports": "Archived reports", "loggedEngagements": "Recorded engagements", "archiveMotto": "One banner. Every battlefield.", "detailedLog": "Detailed battle log",
"mainContent": "Our main content", "recruitmentRequirements": "Entry requirements", "applicationTitle": "Ready to join the ranks?", "applyDiscord": "Apply on Discord",
"title": "OneUP — One United Power. | Albion Online Guild",
@@ -20,7 +19,6 @@
"communityLabel": "05 / ANSWER THE CALL", "communityTitle": "Your next chapter", "communityAccent": "starts with us.", "communityText": "Find your people. Bring your ambition. Stand beneath the OneUP banner.", "socialSoon": "Link coming soon", "socialOpen": "Visit", "footer": "Many warriors. One United Power.", "fan": "An independent Albion Online guild community. Albion Online belongs to Sandbox Interactive.", "top": "Back to top", "menu": "Toggle navigation", "videoFallback": "Open original video", "videoError": "This video could not be loaded. You can open the original link below."
},
"fa": {
- "moreBattleReports": "مشاهدهٔ {count} گزارش دیگر",
"battleArchive": "از آرشیو نبردها", "singleReport": "گزارش نبرد", "combinedReport": "گزارش مجموعه نبردها", "europe": "اروپا", "engagement": "نبرد", "engagements": "نبرد", "reportIds": "شناسه گزارش نبردها", "archivedReports": "گزارش ثبتشده", "loggedEngagements": "نبرد ثبتشده", "archiveMotto": "یک پرچم، در هر میدان نبرد.", "detailedLog": "جزئیات گزارش نبردها",
"mainContent": "فعالیتهای اصلی ما", "recruitmentRequirements": "شرایط پیوستن", "applicationTitle": "آماده پیوستن به ما هستید؟", "applyDiscord": "درخواست عضویت در دیسکورد",
"title": "وانآپ — یک قدرت متحد | گیلد آلبیون آنلاین",
diff --git a/docs/battle-import.md b/docs/battle-import.md
index 8d04b0f..5623bfb 100644
--- a/docs/battle-import.md
+++ b/docs/battle-import.md
@@ -85,9 +85,11 @@ a partially overlapping report stops the import for review.
## Presentation and checks
-The first 12 cards are visible immediately. Remaining reports appear in a native,
-keyboard-accessible disclosure in both languages. The detailed table contains
-all reports. Each combined report uses its own combined scoreboard image.
+Only six highlights are shown as full cards, ranked by OneUP's kills minus
+deaths, then kills, with newer reports breaking ties. Reports with incomplete
+stats follow verified results. All reports remain in the expandable detailed
+table, which scrolls within a bounded height to keep the page compact. Each
+combined report uses its own combined scoreboard image.
`npm test` checks pagination, unrestricted history, grouping boundaries, unrelated
teams, roster continuity, duplicate IDs, source totals, preservation, and both
diff --git a/docs/content.md b/docs/content.md
index 66546b2..63530dc 100644
--- a/docs/content.md
+++ b/docs/content.md
@@ -60,8 +60,9 @@ PNG/JPEG/WebP images are downloaded to `public/assets/battles/` and included in
Every report renders a visual card with local decorative terrain artwork, guild branding, report IDs, and single/combined report labels. Report images display in full without cropping; missing or failed images retain the local artwork. Combined reports use the combined scoreboard image; a single engagement's image is not substituted for the combined results. The map is decorative, not a reconstruction of the battle. Archive counts use report entries and unique battle IDs from their URLs. Only supplied dates and results are shown. The full table is available in the expandable detailed log.
-For archives larger than 12 reports, the first 12 cards appear immediately and
-the remainder are available through “Explore more reports.” See the
+The six best guild performances appear as full cards, ranked by kills minus
+deaths, then kills and recency. All reports remain in the expandable detailed
+table, which scrolls within a bounded height. See the
[battle importer documentation](battle-import.md) for ongoing imports and grouping.
To download previews locally, run:
diff --git a/scripts/render-battles.mjs b/scripts/render-battles.mjs
index 841210e..8c5a381 100644
--- a/scripts/render-battles.mjs
+++ b/scripts/render-battles.mjs
@@ -11,10 +11,14 @@ export function battleDetails(url) {
export function renderBattleCards({battles,previews,lang,base,icon,t}) {
if (!battles.length) return '';
const number=n=>new Intl.NumberFormat(lang==='fa'?'fa-IR':'en-US').format(n);
- const sorted=[...battles].sort((a,b)=>(b.date||'').localeCompare(a.date||''));
+ // Highlight guild performance, rather than filling the page with the newest
+ // reports. Incomplete stats follow verified results; the full archive stays
+ // available in the detailed table.
+ const advantage=b=>b.kills!=null&&b.deaths!=null?b.kills-b.deaths:-Infinity;
+ const featured=[...battles].sort((a,b)=>advantage(b)-advantage(a)||(b.kills??-1)-(a.kills??-1)||(b.date||'').localeCompare(a.date||'')).slice(0,6);
// Combined reports may overlap with single reports; count unique, explicit battle IDs.
const engagements=new Set(battles.flatMap(b=>battleDetails(b.url).ids)).size;
- const cards=sorted.map((battle,index)=>{
+ const cards=featured.map((battle,index)=>{
const info=battleDetails(battle.url);
const preview=previews[battle.url]||battle.preview||directPreview(battle.url);
const image=preview?``:'';
@@ -22,7 +26,5 @@ export function renderBattleCards({battles,previews,lang,base,icon,t}) {
const date=battle.date?``:e(t.battleArchive);
return `
${e(localized(battle.title,lang))}
`:''}${icon('shield')}${e(t.moreBattleReports.replace('{count}',number(cards.length-visible)))}
${icon('shield')}${e(t.archiveMotto)}
${icon('shield')}${e(t.archiveMotto)}