From b966a31606480f944efa11f95e1e5e716aa6fb43 Mon Sep 17 00:00:00 2001 From: NilsUeter Date: Tue, 9 May 2023 20:22:45 +0200 Subject: [PATCH] add wound tracks --- src/App.jsx | 6 +++--- src/Roster.jsx | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/Weapons.jsx | 3 ++- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 32b8c6f..3d80786 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -234,11 +234,11 @@ function App() { const getPrimaryColor = (catalog) => { switch (catalog) { - case "Adeptus Astartes": + case "Imperium - Adeptus Astartes": return "#536766"; - case "Adeptus Custodes": + case "Imperium - Adeptus Custodes": return "#536766"; - case "Adeptus Mechanicus": + case "Imperium - Adeptus Mechanicus": return "#536766"; case "Imperium - Astra Militarum": return "#375441"; diff --git a/src/Roster.jsx b/src/Roster.jsx index aff4c43..9b19177 100644 --- a/src/Roster.jsx +++ b/src/Roster.jsx @@ -73,6 +73,7 @@ const Unit = ({ unit, index, catalog, onePerPage }) => { psykers, spells, cost, + woundTracker, } = unit; const meleeWeapons = weapons @@ -232,6 +233,7 @@ const Unit = ({ unit, index, catalog, onePerPage }) => { } /> ))} + @@ -676,6 +678,51 @@ const Psyker = ({ psyker, index }) => { ); }; +const WoundTracker = ({ woundTracker }) => { + if (!woundTracker || woundTracker.length === 0) return null; + + return ( +
+
+ + + + {[...woundTracker[0].table.keys()].map((key) => ( + + ))} + + + + {woundTracker.map((woundTrack, index) => ( + + {[...woundTrack.table.values()].map((entry) => ( + + ))} + + ))} + +
{key}
+ {entry} +
+
+
+ ); +}; + const Spells = ({ title, spells }) => { return ( { name = "Krak grenade"; } const differentProfiles = + selectionName && selectionName !== name && !name.includes("(Shooting)") && !name.includes("(Melee)"); @@ -78,7 +79,6 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { if (name.startsWith("Missile launcher, ")) { name = name.replace("Missile launcher, ", ""); } - if (differentProfiles && name.includes(" - ")) { name = name.split(" - ")[1]; } @@ -99,6 +99,7 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { } if (abilities?.toLowerCase().includes("turret weapon")) { abilities = abilities + .replaceAll("Turret Weapon.", "") .replaceAll("Turret weapon.", "") .replaceAll("Turret Weapon", "") .replaceAll("Turret weapon", "");