mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-10 17:47:50 +02:00
UI: Add indicator of RFA connection status to overview panel (#2497)
This commit is contained in:
+1
-1
@@ -27,7 +27,6 @@ export enum SimplePage {
|
||||
Hacknet = "Hacknet",
|
||||
Infiltration = "Infiltration",
|
||||
Milestones = "Milestones",
|
||||
Options = "Options",
|
||||
Grafting = "Grafting",
|
||||
Sleeves = "Sleeves",
|
||||
Stats = "Stats",
|
||||
@@ -52,6 +51,7 @@ export enum ComplexPage {
|
||||
Location = "Location",
|
||||
ImportSave = "Import Save",
|
||||
Documentation = "Documentation",
|
||||
Options = "Options",
|
||||
// LoadingScreen is a special state that should never be returned to after the initial game load. To enforce this, it
|
||||
// is constructed as a ComplexPage with no PageContext, and thus toPage() cannot be used (since no overload will fit
|
||||
// it).
|
||||
|
||||
+10
-1
@@ -29,7 +29,7 @@ import { CorporationRoot } from "../Corporation/ui/CorporationRoot";
|
||||
import { InfiltrationRoot } from "../Infiltration/ui/InfiltrationRoot";
|
||||
import { GraftingRoot } from "../PersonObjects/Grafting/ui/GraftingRoot";
|
||||
import { WorkInProgressRoot } from "./WorkInProgressRoot";
|
||||
import { GameOptionsRoot } from "../GameOptions/ui/GameOptionsRoot";
|
||||
import { GameOptionsPageEvents, GameOptionsRoot } from "../GameOptions/ui/GameOptionsRoot";
|
||||
import { SleeveRoot } from "../PersonObjects/Sleeve/ui/SleeveRoot";
|
||||
import { HacknetRoot } from "../Hacknet/ui/HacknetRoot";
|
||||
import { GenericLocation } from "../Locations/ui/GenericLocation";
|
||||
@@ -257,6 +257,14 @@ export function GameRoot(): React.ReactElement {
|
||||
prestigeWorkerScripts();
|
||||
calculateAchievements();
|
||||
break;
|
||||
case Page.Options:
|
||||
// If the current page is "Options" and something calls Router.toPage("Options", { tab: "Foo" }) to switch the
|
||||
// tab, we need to emit an event to tell GameOptionsRoot to set its currentTab state. Changing the tab in the
|
||||
// properties of GameOptionsRoot does not set the state.
|
||||
if (Router.page() === Page.Options && context && "tab" in context && context.tab != null) {
|
||||
GameOptionsPageEvents.emit(context.tab);
|
||||
}
|
||||
break;
|
||||
}
|
||||
setNextPage({ page, ...context } as PageWithContext);
|
||||
},
|
||||
@@ -425,6 +433,7 @@ export function GameRoot(): React.ReactElement {
|
||||
case Page.Options: {
|
||||
mainPage = (
|
||||
<GameOptionsRoot
|
||||
tab={pageWithContext.tab}
|
||||
save={() => {
|
||||
saveObject.saveGame().catch((error) => exceptionAlert(error));
|
||||
}}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { isCompanyWork } from "../../Work/CompanyWork";
|
||||
import { isCrimeWork } from "../../Work/CrimeWork";
|
||||
import { EventEmitter } from "../../utils/EventEmitter";
|
||||
import { useRerender } from "./hooks";
|
||||
import { RemoteFileApiConnectionStatus } from "../../GameOptions/ui/RemoteFileApiConnectionStatus";
|
||||
|
||||
export const OverviewEventEmitter = new EventEmitter();
|
||||
|
||||
@@ -183,6 +184,7 @@ export function CharacterOverview({ parentOpen, save, killScripts }: OverviewPro
|
||||
</Tooltip>
|
||||
</IconButton>
|
||||
</Box>
|
||||
<RemoteFileApiConnectionStatus showIcon={true} />
|
||||
<Box sx={{ display: "flex", flex: 1, justifyContent: "flex-end", alignItems: "center" }}>
|
||||
<IconButton aria-label="kill all scripts" onClick={() => setKillOpen(true)}>
|
||||
<Tooltip title="Kill all running scripts">
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { TextFilePath } from "../Paths/TextFilePath";
|
||||
import type { Faction } from "../Faction/Faction";
|
||||
import type { Location } from "../Locations/Location";
|
||||
import type { SaveData } from "../types";
|
||||
import type { OptionsTabName } from "../GameOptions/ui/GameOptionsRoot";
|
||||
import { ComplexPage, SimplePage } from "./Enums";
|
||||
|
||||
// Using the same name as both type and object to mimic enum-like behavior.
|
||||
@@ -24,6 +25,8 @@ export type PageContext<T extends Page> = T extends ComplexPage.BitVerse
|
||||
? { saveData: SaveData; automatic?: boolean }
|
||||
: T extends ComplexPage.Documentation
|
||||
? { docPage?: string }
|
||||
: T extends ComplexPage.Options
|
||||
? { tab?: OptionsTabName }
|
||||
: never;
|
||||
|
||||
export type PageWithContext =
|
||||
@@ -34,6 +37,7 @@ export type PageWithContext =
|
||||
| ({ page: ComplexPage.Location } & PageContext<ComplexPage.Location>)
|
||||
| ({ page: ComplexPage.ImportSave } & PageContext<ComplexPage.ImportSave>)
|
||||
| ({ page: ComplexPage.Documentation } & PageContext<ComplexPage.Documentation>)
|
||||
| ({ page: ComplexPage.Options } & PageContext<ComplexPage.Options>)
|
||||
| { page: ComplexPage.LoadingScreen }
|
||||
| { page: SimplePage };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user