From dca870edcebbc2e2b28f26958cefa81dff727c31 Mon Sep 17 00:00:00 2001 From: NilsUeter Date: Sun, 6 Apr 2025 11:01:31 +0200 Subject: [PATCH] Add possibility to print charts, sort units --- src/10th/Roster.jsx | 54 +++--- src/10th/ShortSummaryTable.jsx | 295 +++++++++++++++++++-------------- src/index.css | 2 + 3 files changed, 193 insertions(+), 158 deletions(-) diff --git a/src/10th/Roster.jsx b/src/10th/Roster.jsx index c011ae4..a9df9db 100644 --- a/src/10th/Roster.jsx +++ b/src/10th/Roster.jsx @@ -31,25 +31,14 @@ export const Roster = ({ position: "relative", }} > -
- {name} - {cost.points} pts -
- {forces.map((force, index) => ( - + { const { units, factionRules, rules, catalog } = force; var mergedRules = new Map([...factionRules, ...rules]); + // units with role "Character" are sorted to the top, then "Battleline", then "Other" + const sortedUnits = units.sort((a, b) => { + if (a.role === "Character" && b.role !== "Character") return -1; + if (a.role !== "Character" && b.role === "Character") return 1; + if (a.role === "Battleline" && b.role !== "Battleline") return -1; + if (a.role !== "Battleline" && b.role === "Battleline") return 1; + return a.name.localeCompare(b.name); + }); + return (
- {units.map((unit, index) => ( + {sortedUnits.map((unit, index) => ( -
+