Add toPreviousPage in router

- Allows the WorkInProgress cancel & unfocus to go back to the previous
page instead of a default one.
- Change layout of overview buttons
- Add a back button in the overview, only visible in pages with a
sidebar
- Clear the history on augmentation install & on prestige
This commit is contained in:
Martin Fournier
2022-01-11 06:51:27 -05:00
parent f742782e4a
commit b0bc3236fd
6 changed files with 165 additions and 57 deletions
+10 -11
View File
@@ -36,12 +36,12 @@ export function WorkInProgressRoot(): React.ReactElement {
const faction = Factions[player.currentWorkFactionName];
if (player.workType == CONSTANTS.WorkTypeFaction) {
function cancel(): void {
router.toFaction(faction);
player.finishFactionWork(true);
router.toPreviousPage(() => router.toFaction(faction));
}
function unfocus(): void {
router.toFaction(faction);
player.stopFocusing();
router.toPreviousPage(() => router.toFaction(faction));
}
return (
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
@@ -120,13 +120,12 @@ export function WorkInProgressRoot(): React.ReactElement {
if (player.className !== "") {
function cancel(): void {
player.finishClass(true);
router.toCity();
router.toPreviousPage(() => router.toCity());
}
function unfocus(): void {
router.toFaction(faction);
router.toCity();
player.stopFocusing();
router.toPreviousPage(() => router.toCity());
}
let stopText = "";
@@ -212,11 +211,11 @@ export function WorkInProgressRoot(): React.ReactElement {
function cancel(): void {
player.finishWork(true);
router.toJob();
router.toPreviousPage(() => router.toJob());
}
function unfocus(): void {
player.stopFocusing();
router.toJob();
router.toPreviousPage(() => router.toJob());
}
const position = player.jobs[player.companyName];
@@ -304,11 +303,11 @@ export function WorkInProgressRoot(): React.ReactElement {
if (player.workType == CONSTANTS.WorkTypeCompanyPartTime) {
function cancel(): void {
player.finishWorkPartTime(true);
router.toJob();
router.toPreviousPage(() => router.toJob());
}
function unfocus(): void {
player.stopFocusing();
router.toJob();
router.toPreviousPage(() => router.toJob());
}
const comp = Companies[player.companyName];
let companyRep = 0;
@@ -440,11 +439,11 @@ export function WorkInProgressRoot(): React.ReactElement {
if (player.createProgramName !== "") {
function cancel(): void {
player.finishCreateProgramWork(true);
router.toTerminal();
router.toPreviousPage(() => router.toTerminal());
}
function unfocus(): void {
router.toTerminal();
player.stopFocusing();
router.toPreviousPage(() => router.toTerminal());
}
return (
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>