From 8231b5ed4939369236d988fe70baab09df92ab73 Mon Sep 17 00:00:00 2001 From: Logan Davidson Date: Wed, 17 Jan 2024 09:17:00 +0000 Subject: [PATCH] Add secrets icon Add a secrets icon (replacing the votes icon used to temporarily represent secrets in the faction details component) and add secrets as an attribute to the faction list item component. The icon depicts a simple red masquerade mask. --- frontend/components/FactionListItem.tsx | 21 ++++++++----------- .../detailSections/DetailSection_Faction.tsx | 3 ++- frontend/images/icons/secrets.svg | 1 + 3 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 frontend/images/icons/secrets.svg diff --git a/frontend/components/FactionListItem.tsx b/frontend/components/FactionListItem.tsx index 0b49a298..a8c14ab9 100644 --- a/frontend/components/FactionListItem.tsx +++ b/frontend/components/FactionListItem.tsx @@ -10,13 +10,8 @@ import FactionLink from "@/components/FactionLink" import InfluenceIcon from "@/images/icons/influence.svg" import TalentsIcon from "@/images/icons/talents.svg" import VotesIcon from "@/images/icons/votes.svg" - -type Attribute = { - name: "senators" | "influence" | "votes" | "talents" - value: Number - image: string - sum?: boolean -} +import SecretsIcon from "@/images/icons/secrets.svg" +import { Attribute } from "@/components/AttributeGrid" interface FactionListItemProps { faction: Faction @@ -24,7 +19,7 @@ interface FactionListItemProps { // Item in the faction list const FactionListItem = (props: FactionListItemProps) => { - const { allPlayers, allSenators } = useGameContext() + const { allPlayers, allSenators, allSecrets } = useGameContext() // Get faction-specific data const player = allPlayers.byId[props.faction.player] ?? null @@ -47,16 +42,18 @@ const FactionListItem = (props: FactionListItemProps) => { (total, senator) => total + senator.votes, 0 ) + const secrets = allSecrets.asArray.filter((s) => s.faction === props.faction?.id) // Attribute data const attributeItems: Attribute[] = [ { name: "influence", value: totalInfluence, - image: InfluenceIcon, + icon: InfluenceIcon, }, - { name: "talents", value: totalTalents, image: TalentsIcon }, - { name: "votes", value: totalVotes, image: VotesIcon }, + { name: "talents", value: totalTalents, icon: TalentsIcon }, + { name: "votes", value: totalVotes, icon: VotesIcon }, + { name: "Secrets", value: secrets.length, icon: SecretsIcon }, ] // Get attribute items @@ -67,7 +64,7 @@ const FactionListItem = (props: FactionListItemProps) => {
{`${titleCaseName} { }, { name: "Talents", value: totalTalents, icon: TalentsIcon }, { name: "Votes", value: totalVotes, icon: VotesIcon }, - { name: "Secrets", value: secrets.length, icon: VotesIcon }, + { name: "Secrets", value: secrets.length, icon: SecretsIcon }, ] // If there is no faction selected, render nothing diff --git a/frontend/images/icons/secrets.svg b/frontend/images/icons/secrets.svg new file mode 100644 index 00000000..b8cae778 --- /dev/null +++ b/frontend/images/icons/secrets.svg @@ -0,0 +1 @@ + \ No newline at end of file