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 = {
faction: Faction;
augPage: boolean;
};
// Info text for all options on the UI
@ -185,7 +186,7 @@ export function FactionRoot(props: IProps): React.ReactElement {
const faction = props.faction;
const [purchasingAugs, setPurchasingAugs] = useState(false);
const [purchasingAugs, setPurchasingAugs] = useState(props.augPage);
return purchasingAugs ? (
<AugmentationsPage faction={faction} routeToMainPage={() => setPurchasingAugs(false)} />

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