mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-05 07:07:50 +02:00
convert game saved to snackbar, index.html is nearly empty now
This commit is contained in:
@@ -66,6 +66,7 @@ import { CharacterOverview } from "./React/CharacterOverview";
|
||||
import { BladeburnerCinematic } from "../Bladeburner/ui/BladeburnerCinematic";
|
||||
import { workerScripts } from "../Netscript/WorkerScripts";
|
||||
import { Unclickable } from "../Exploits/Unclickable";
|
||||
import { Snackbar } from "./React/Snackbar";
|
||||
|
||||
import { enterBitNode } from "../RedPill";
|
||||
import { Context } from "./Context";
|
||||
@@ -392,6 +393,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
</Box>
|
||||
)}
|
||||
<Unclickable />
|
||||
<Snackbar />
|
||||
</Context.Router.Provider>
|
||||
</Context.Player.Provider>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { Snackbar as S } from "@mui/material";
|
||||
import { EventEmitter } from "../../utils/EventEmitter";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Paper from "@mui/material/Paper";
|
||||
|
||||
export const GameSavedEvents = new EventEmitter<[]>();
|
||||
|
||||
export function Snackbar(): React.ReactElement {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
useEffect(() => GameSavedEvents.subscribe(() => setOpen(true)));
|
||||
return (
|
||||
<S
|
||||
open={open}
|
||||
anchorOrigin={{
|
||||
vertical: "top",
|
||||
horizontal: "center",
|
||||
}}
|
||||
autoHideDuration={2000}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
<Paper sx={{ p: 2 }}>
|
||||
<Typography>Game Saved!</Typography>
|
||||
</Paper>
|
||||
</S>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user