Implement faction augs page shortcut

This commit is contained in:
nickofolas 2022-03-10 18:39:54 -06:00
parent e39817cb57
commit e960fbfa28
2 changed files with 16 additions and 9 deletions

@ -24,6 +24,7 @@ import { CovenantPurchasesRoot } from "../../PersonObjects/Sleeve/ui/CovenantPur
type IProps = { type IProps = {
faction: Faction; faction: Faction;
augPage: boolean;
}; };
// Info text for all options on the UI // Info text for all options on the UI
@ -185,7 +186,7 @@ export function FactionRoot(props: IProps): React.ReactElement {
const faction = props.faction; const faction = props.faction;
const [purchasingAugs, setPurchasingAugs] = useState(false); const [purchasingAugs, setPurchasingAugs] = useState(props.augPage);
return purchasingAugs ? ( return purchasingAugs ? (
<AugmentationsPage faction={faction} routeToMainPage={() => setPurchasingAugs(false)} /> <AugmentationsPage faction={faction} routeToMainPage={() => setPurchasingAugs(false)} />

@ -41,6 +41,10 @@ export function FactionsRoot(props: IProps): React.ReactElement {
props.router.toFaction(faction); props.router.toFaction(faction);
} }
function openFactionAugPage(faction: Faction): void {
props.router.toFaction(faction, true);
}
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, faction: string): void { function acceptInvitation(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, faction: string): void {
if (!event.isTrusted) return; if (!event.isTrusted) return;
joinFaction(Factions[faction]); joinFaction(Factions[faction]);
@ -61,7 +65,7 @@ export function FactionsRoot(props: IProps): React.ReactElement {
</Typography> </Typography>
{(props.player.factions.length > 0 && ( {(props.player.factions.length > 0 && (
<Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}> <Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}>
<Table padding="none"> <Table padding="none" style={{ width: "fit-content" }}>
<TableBody> <TableBody>
{props.player.factions.map((faction: string) => ( {props.player.factions.map((faction: string) => (
<TableRow key={faction}> <TableRow key={faction}>
@ -76,13 +80,15 @@ export function FactionsRoot(props: IProps): React.ReactElement {
</Box> </Box>
</TableCell> </TableCell>
<TableCell align="right"> <TableCell align="right">
<Typography noWrap ml={10} mb={1}> <Box ml={1} mb={1}>
Augmentations Left: {Factions[faction] <Button sx={{ width: '100%' }} onClick={() => openFactionAugPage(Factions[faction])}>
.augmentations Augmentations Left: {Factions[faction]
.filter((augmentation: string) => .augmentations
!props.player.hasAugmentation(augmentation)) .filter((augmentation: string) =>
.length} !props.player.hasAugmentation(augmentation))
</Typography> .length}
</Button>
</Box>
</TableCell> </TableCell>
</TableRow> </TableRow>
))} ))}