fix melee and ranged weapons with same name not both appearing

This commit is contained in:
NilsUeter
2023-10-05 11:44:50 +02:00
parent 6556b7d56b
commit af9a990a3f
4 changed files with 60 additions and 45 deletions
+3 -19
View File
@@ -67,32 +67,18 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
const [image, setImage] = useState(null);
let {
name,
weapons,
meleeWeapons,
rangedWeapons,
abilities,
keywords,
factions,
rules,
modelStats,
modelList,
spells,
cost,
woundTracker,
} = unit;
const meleeWeapons = weapons
.filter(
(weapon) =>
(weapon.range === "Melee" || weapon.type === "Melee") &&
weapon.range !== ""
)
.sort((a, b) => a.selectionName.localeCompare(b.selectionName));
const rangedWeapons = weapons
.filter(
(weapon) =>
weapon.range !== "Melee" && weapon.range !== "-" && weapon.range !== ""
)
.sort((a, b) => a.selectionName.localeCompare(b.selectionName));
const weapons = [...meleeWeapons, ...rangedWeapons];
const weaponDescriptions = weapons
.filter(
@@ -288,8 +274,6 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
className="button print-display-none"
style={{
position: "absolute",
top: "0",
right: 0,
border: "1px solid #999",
top: 1,
right: 1,