mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
Internal refactoring of Router (#241)
This commit is contained in:
@@ -9,6 +9,7 @@ import { Options } from "./Options";
|
||||
import { isValidFilePath } from "../../Terminal/DirectoryHelpers";
|
||||
import { Player } from "@player";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Page } from "../../ui/Router";
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { isScriptFilename } from "../../Script/isScriptFilename";
|
||||
import { Script } from "../../Script/Script";
|
||||
@@ -154,7 +155,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
//Ctrl + b
|
||||
if (event.code == "KeyB" && (event.ctrlKey || event.metaKey)) {
|
||||
event.preventDefault();
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
}
|
||||
|
||||
// CTRL/CMD + S
|
||||
@@ -181,12 +182,12 @@ export function Root(props: IProps): React.ReactElement {
|
||||
save();
|
||||
});
|
||||
MonacoVim.VimMode.Vim.defineEx("quit", "q", function () {
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
});
|
||||
|
||||
const saveNQuit = (): void => {
|
||||
save();
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
};
|
||||
// "wqriteandquit" & "xriteandquit" are not typos, prefix must be found in full string
|
||||
MonacoVim.VimMode.Vim.defineEx("wqriteandquit", "wq", saveNQuit);
|
||||
@@ -465,7 +466,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
if (scriptToSave.fileName == server.scripts[i].filename) {
|
||||
server.scripts[i].saveScript(scriptToSave.fileName, scriptToSave.code, Player.currentServer, server.scripts);
|
||||
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -479,7 +480,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
if (server.textFiles[i].fn === scriptToSave.fileName) {
|
||||
server.textFiles[i].write(scriptToSave.code);
|
||||
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -491,7 +492,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
}
|
||||
|
||||
function save(): void {
|
||||
@@ -646,7 +647,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
openScripts.splice(index, 1);
|
||||
if (openScripts.length === 0) {
|
||||
currentScript = null;
|
||||
Router.toTerminal();
|
||||
Router.toPage(Page.Terminal);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -900,7 +901,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
{ram}
|
||||
</Button>
|
||||
<Button onClick={save}>Save (Ctrl/Cmd + s)</Button>
|
||||
<Button sx={{ mx: 1 }} onClick={Router.toTerminal}>
|
||||
<Button sx={{ mx: 1 }} onClick={() => Router.toPage(Page.Terminal)}>
|
||||
Terminal (Ctrl/Cmd + b)
|
||||
</Button>
|
||||
<Typography>
|
||||
|
||||
Reference in New Issue
Block a user