From e39817cb57bfb63af47def926c4aabd9c393d3fa Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 10 Mar 2022 18:37:57 -0600 Subject: [PATCH 1/2] Very slightly adjust router.toFaction - Faction argument is now required - Added augPage argument --- src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx | 2 +- src/ui/GameRoot.tsx | 6 ++++-- src/ui/Router.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index f57392831..e0e96ff0d 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -590,7 +590,7 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void { if (this.isWorking) { if (this.workType == CONSTANTS.WorkTypeFaction) { if (this.workForFaction(numCycles)) { - router.toFaction(); + router.toFaction(Factions[this.currentWorkFactionName]); } } else if (this.workType == CONSTANTS.WorkTypeCreateProgram) { if (this.createProgramWork(numCycles)) { diff --git a/src/ui/GameRoot.tsx b/src/ui/GameRoot.tsx index 181bdfee1..85727c5b8 100644 --- a/src/ui/GameRoot.tsx +++ b/src/ui/GameRoot.tsx @@ -223,6 +223,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme const [{ files, vim }, setEditorOptions] = useState({ files: {}, vim: false }); const [page, setPage] = useState(determineStartPage(player)); const setRerender = useState(0)[1]; + const [augPage, setAugPage] = useState(false); const [faction, setFaction] = useState( player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction), ); @@ -275,7 +276,8 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme toCorporation: () => setPage(Page.Corporation), toCreateProgram: () => setPage(Page.CreateProgram), toDevMenu: () => setPage(Page.DevMenu), - toFaction: (faction?: Faction) => { + toFaction: (faction: Faction, augPage = false) => { + setAugPage(augPage); setPage(Page.Faction); if (faction) setFaction(faction); }, @@ -453,7 +455,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme break; } case Page.Faction: { - mainPage = ; + mainPage = ; break; } case Page.Milestones: { diff --git a/src/ui/Router.ts b/src/ui/Router.ts index 2e89f6f3d..cea2c6c60 100644 --- a/src/ui/Router.ts +++ b/src/ui/Router.ts @@ -65,7 +65,7 @@ export interface IRouter { toCorporation(): void; toCreateProgram(): void; toDevMenu(): void; - toFaction(faction?: Faction): void; // faction name + toFaction(faction: Faction, augPage?: boolean): void; // faction name toFactions(): void; toGameOptions(): void; toGang(): void; From e960fbfa280321258597f0966ad0389861be7c47 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 10 Mar 2022 18:39:54 -0600 Subject: [PATCH 2/2] Implement faction augs page shortcut --- src/Faction/ui/FactionRoot.tsx | 3 ++- src/Faction/ui/FactionsRoot.tsx | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Faction/ui/FactionRoot.tsx b/src/Faction/ui/FactionRoot.tsx index c1c16a00b..8180d795e 100644 --- a/src/Faction/ui/FactionRoot.tsx +++ b/src/Faction/ui/FactionRoot.tsx @@ -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 ? ( setPurchasingAugs(false)} /> diff --git a/src/Faction/ui/FactionsRoot.tsx b/src/Faction/ui/FactionsRoot.tsx index 4d052912a..cec5ce15a 100644 --- a/src/Faction/ui/FactionsRoot.tsx +++ b/src/Faction/ui/FactionsRoot.tsx @@ -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, faction: string): void { if (!event.isTrusted) return; joinFaction(Factions[faction]); @@ -61,7 +65,7 @@ export function FactionsRoot(props: IProps): React.ReactElement { {(props.player.factions.length > 0 && ( - +
{props.player.factions.map((faction: string) => ( @@ -76,13 +80,15 @@ export function FactionsRoot(props: IProps): React.ReactElement { - - Augmentations Left: {Factions[faction] - .augmentations - .filter((augmentation: string) => - !props.player.hasAugmentation(augmentation)) - .length} - + + + ))}