-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(character card): Added bond tracks, experience, and legacy track…
…s to the character cards on the GM screen
- Loading branch information
1 parent
9d81545
commit f934eb4
Showing
9 changed files
with
182 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/pages/Campaign/CampaignGMScreenPage/components/CharacterCard/IronswornTracks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import SpentIcon from "@mui/icons-material/RadioButtonChecked"; | ||
import EarnedIcon from "@mui/icons-material/HighlightOff"; | ||
import EmptyIcon from "@mui/icons-material/RadioButtonUnchecked"; | ||
import { useStore } from "stores/store"; | ||
import { Box, Typography } from "@mui/material"; | ||
import { ProgressTrack } from "components/features/ProgressTrack"; | ||
|
||
const totalExp = 30; | ||
export interface IronswornTracksProps { | ||
characterId: string; | ||
} | ||
|
||
export function IronswornTracks(props: IronswornTracksProps) { | ||
const { characterId } = props; | ||
const xp = useStore( | ||
(store) => | ||
store.campaigns.currentCampaign.characters.characterMap[characterId] | ||
.experience | ||
); | ||
const spentExp = xp?.spent ?? 0; | ||
const earnedExp = xp?.earned ?? 0; | ||
|
||
const bondValue = useStore( | ||
(store) => | ||
store.campaigns.currentCampaign.characters.characterMap[characterId] | ||
.bonds ?? 0 | ||
); | ||
|
||
return ( | ||
<Box> | ||
<Typography fontFamily={(theme) => theme.fontFamilyTitle}> | ||
Experience | ||
</Typography> | ||
<Box display={"flex"} flexWrap={"wrap"}> | ||
<Box mr={2}> | ||
{new Array(spentExp).fill(undefined).map((key, index) => ( | ||
<SpentIcon key={index} color={"action"} fontSize={"small"} /> | ||
))} | ||
{new Array(earnedExp - spentExp).fill(undefined).map((key, index) => ( | ||
<EarnedIcon key={index} color={"action"} fontSize={"small"} /> | ||
))} | ||
{new Array(totalExp - earnedExp).fill(undefined).map((key, index) => ( | ||
<EmptyIcon key={index} color={"action"} fontSize={"small"} /> | ||
))} | ||
</Box> | ||
</Box> | ||
<Typography fontFamily={(theme) => theme.fontFamilyTitle} sx={{ mt: 2 }}> | ||
Bonds | ||
</Typography> | ||
<ProgressTrack value={bondValue} max={40} /> | ||
</Box> | ||
); | ||
} |
40 changes: 40 additions & 0 deletions
40
src/pages/Campaign/CampaignGMScreenPage/components/CharacterCard/LegacyTracks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Stack } from "@mui/material"; | ||
import { LegacyTrack } from "pages/Character/CharacterSheetPage/Tabs/TracksSection/LegacyTrack"; | ||
import { useStore } from "stores/store"; | ||
|
||
export interface LegacyTracksProps { | ||
characterId: string; | ||
} | ||
|
||
export function LegacyTracks(props: LegacyTracksProps) { | ||
const { characterId } = props; | ||
|
||
const legacyTracks = useStore( | ||
(store) => | ||
store.campaigns.currentCampaign.characters.characterMap[characterId] | ||
.legacyTracks ?? {} | ||
); | ||
|
||
return ( | ||
<Stack spacing={2} px={2} sx={{ overflowX: "auto" }}> | ||
<LegacyTrack | ||
label={"Quests"} | ||
value={legacyTracks.quests?.value ?? 0} | ||
checkedExperience={legacyTracks.quests?.spentExperience ?? {}} | ||
isLegacy={legacyTracks.quests?.isLegacy ?? false} | ||
/> | ||
<LegacyTrack | ||
label={"Bonds"} | ||
value={legacyTracks.bonds?.value ?? 0} | ||
checkedExperience={legacyTracks.bonds?.spentExperience ?? {}} | ||
isLegacy={legacyTracks.bonds?.isLegacy ?? false} | ||
/> | ||
<LegacyTrack | ||
label={"Discoveries"} | ||
value={legacyTracks.discoveries?.value ?? 0} | ||
checkedExperience={legacyTracks.discoveries?.spentExperience ?? {}} | ||
isLegacy={legacyTracks.discoveries?.isLegacy ?? false} | ||
/> | ||
</Stack> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
src/pages/Campaign/CampaignGMScreenPage/components/CharacterCard/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./CharacterCard"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters