diff --git a/src/ui/GameRoot.tsx b/src/ui/GameRoot.tsx index d78b53029..2e06d4b68 100644 --- a/src/ui/GameRoot.tsx +++ b/src/ui/GameRoot.tsx @@ -300,6 +300,181 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme if (page !== Page.Terminal) window.scrollTo(0, 0); }); + let mainPage = Cannot load; + let withSidebar = true; + switch (page) { + case Page.Recovery: { + mainPage = ; + withSidebar = false; + break; + } + case Page.BitVerse: { + mainPage = ; + withSidebar = false; + break + } + case Page.Infiltration: { + mainPage = ; + withSidebar = false; + break; + } + case Page.BladeburnerCinematic: { + mainPage = ; + withSidebar = false; + break; + } + case Page.Work: { + mainPage = ; + withSidebar = false; + break; + } + case Page.Terminal: { + mainPage = ; + break; + } + case Page.Sleeves: { + mainPage = ; + break; + } + case Page.StaneksGift: { + mainPage = ; + break; + } + case Page.Stats: { + mainPage = ; + break; + } + case Page.ScriptEditor: { + mainPage = ; + break; + } + case Page.ActiveScripts: { + mainPage = ; + break; + } + case Page.Hacknet: { + mainPage = ; + break; + } + case Page.CreateProgram: { + mainPage = ; + break; + } + case Page.Factions: { + mainPage = ; + break; + } + case Page.Faction: { + mainPage = ; + break; + } + case Page.Milestones: { + mainPage = ; + break; + } + case Page.Tutorial: { + mainPage = { + prestigeAugmentation(); + Router.toTerminal(); + iTutorialStart(); + }} + />; + break; + } + case Page.DevMenu: { + mainPage = ; + break; + } + case Page.Gang: { + mainPage = ; + break; + } + case Page.Corporation: { + mainPage = ; + break; + } + case Page.Bladeburner: { + mainPage = ; + break; + } + case Page.Resleeves: { + mainPage = ; + break; + } + case Page.Travel: { + mainPage = ; + break; + } + case Page.StockMarket: { + mainPage = ; + break; + } + case Page.City: { + mainPage = ; + break; + } + case Page.Job: + case Page.Location: { + mainPage = ; + break; + } + case Page.Options: { + mainPage = saveObject.saveGame()} + export={() => { + // Apply the export bonus before saving the game + onExport(player); + saveObject.exportGame() + }} + forceKill={killAllScripts} + softReset={() => { + dialogBoxCreate("Soft Reset!"); + prestigeAugmentation(); + Router.toTerminal(); + }} + />; + break; + } + case Page.Augmentations: { + mainPage = { + // Apply the export bonus before saving the game + onExport(player); + saveObject.exportGame(); + }} + installAugmentationsFn={() => { + installAugmentations(); + Router.toTerminal(); + }} + />; + break; + } + case Page.Achievements: { + mainPage = ; + break; + } + } + + const renderPopups = [Page.Recovery, Page.BitVerse, Page.Infiltration, Page.BladeburnerCinematic].includes(page); return ( @@ -311,131 +486,24 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme )} - {page === Page.Recovery ? ( - - ) : page === Page.BitVerse ? ( - - ) : page === Page.Infiltration ? ( - - ) : page === Page.BladeburnerCinematic ? ( - - ) : page === Page.Work ? ( - - ) : ( + {withSidebar ? ( - {page === Page.Terminal ? ( - - ) : page === Page.Sleeves ? ( - - ) : page === Page.StaneksGift ? ( - - ) : page === Page.Stats ? ( - - ) : page === Page.ScriptEditor ? ( - - ) : page === Page.ActiveScripts ? ( - - ) : page === Page.Hacknet ? ( - - ) : page === Page.CreateProgram ? ( - - ) : page === Page.Factions ? ( - - ) : page === Page.Faction ? ( - - ) : page === Page.Milestones ? ( - - ) : page === Page.Tutorial ? ( - { - prestigeAugmentation(); - Router.toTerminal(); - iTutorialStart(); - }} - /> - ) : page === Page.DevMenu ? ( - - ) : page === Page.Gang ? ( - - ) : page === Page.Corporation ? ( - - ) : page === Page.Bladeburner ? ( - - ) : page === Page.Resleeves ? ( - - ) : page === Page.Travel ? ( - - ) : page === Page.StockMarket ? ( - - ) : page === Page.City ? ( - - ) : page === Page.Job ? ( - - ) : page === Page.Location ? ( - - ) : page === Page.Options ? ( - saveObject.saveGame()} - export={() => { - // Apply the export bonus before saving the game - onExport(player); - saveObject.exportGame() - }} - forceKill={killAllScripts} - softReset={() => { - dialogBoxCreate("Soft Reset!"); - prestigeAugmentation(); - Router.toTerminal(); - }} - /> - ) : page === Page.Augmentations ? ( - { - // Apply the export bonus before saving the game - onExport(player); - saveObject.exportGame(); - }} - installAugmentationsFn={() => { - installAugmentations(); - Router.toTerminal(); - }} - /> - ) : page === Page.Achievements ? ( - - ) : ( - <> - Cannot load - - )} + {mainPage} - )} + ) : mainPage } - - - - - + {renderPopups && ( + <> + + + + + + + )}