From ef9cccd05e90bf0f1bec52ff677e142d78560a73 Mon Sep 17 00:00:00 2001 From: Logan Davidson Date: Sun, 21 Apr 2024 12:29:19 +0100 Subject: [PATCH] Make faction list unaligned senators conditional (#468) Make the appearance of the unaligned senators on the faction list conditional upon the existence of at least one unaligned senator. --- frontend/components/FactionList.tsx | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/frontend/components/FactionList.tsx b/frontend/components/FactionList.tsx index 6927e311..f5df4ef4 100644 --- a/frontend/components/FactionList.tsx +++ b/frontend/components/FactionList.tsx @@ -16,13 +16,11 @@ const FactionList = () => { const [sortedFactions, setSortedFactions] = useState>( new Collection() ) - const unalignedSenators = new Collection( - allSenators.asArray + const unalignedSenators = allSenators.asArray .filter((s) => s.alive) // Filter by alive .filter((s) => s.faction === null) // Filter by unaligned .sort((a, b) => a.generation - b.generation) // Sort by generation .sort((a, b) => a.name.localeCompare(b.name)) ?? [] // Sort by name - ) // Sort the factions useEffect(() => { @@ -56,23 +54,25 @@ const FactionList = () => {
{sortedFactions.asArray.map((faction) => getRow(faction))} -
-

- -

-
- {unalignedSenators.asArray.map((senator) => ( - - ))} + { unalignedSenators.length > 0 && +
+

+ +

+
+ {unalignedSenators.map((senator) => ( + + ))} +
-
+ }
)