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) => ( -
+