mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-01 20:13:51 +01:00
Merge pull request #2469 from MartinFournier/fix/snackbar-zindex
Make toasts appear above tail popups
This commit is contained in:
commit
b373e5dddc
@ -113,6 +113,8 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const logBoxBaseZIndex = 1500;
|
||||||
|
|
||||||
function LogWindow(props: IProps): React.ReactElement {
|
function LogWindow(props: IProps): React.ReactElement {
|
||||||
const [script, setScript] = useState(props.script);
|
const [script, setScript] = useState(props.script);
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
@ -147,7 +149,7 @@ function LogWindow(props: IProps): React.ReactElement {
|
|||||||
function updateLayer(): void {
|
function updateLayer(): void {
|
||||||
const c = container.current;
|
const c = container.current;
|
||||||
if (c === null) return;
|
if (c === null) return;
|
||||||
c.style.zIndex = 1500 + layerCounter + "";
|
c.style.zIndex = logBoxBaseZIndex + layerCounter + "";
|
||||||
layerCounter++;
|
layerCounter++;
|
||||||
rerender();
|
rerender();
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,27 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useSnackbar, SnackbarProvider as SB } from "notistack";
|
import { useSnackbar, SnackbarProvider as SB } from "notistack";
|
||||||
|
import makeStyles from "@mui/styles/makeStyles";
|
||||||
import { EventEmitter } from "../../utils/EventEmitter";
|
import { EventEmitter } from "../../utils/EventEmitter";
|
||||||
import Alert from "@mui/material/Alert";
|
import Alert from "@mui/material/Alert";
|
||||||
import Paper from "@mui/material/Paper";
|
import Paper from "@mui/material/Paper";
|
||||||
|
import { logBoxBaseZIndex } from "./LogBoxManager";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
children: React.ReactNode | React.ReactNode[];
|
children: React.ReactNode | React.ReactNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const useStyles = makeStyles(() => ({
|
||||||
|
snackbar: {
|
||||||
|
// Log popup z-index increments, so let's add a padding to be well above them.
|
||||||
|
zIndex: `${logBoxBaseZIndex + 1000} !important` as any,
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
export function SnackbarProvider(props: IProps): React.ReactElement {
|
export function SnackbarProvider(props: IProps): React.ReactElement {
|
||||||
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<SB dense maxSnack={9} anchorOrigin={{ horizontal: "right", vertical: "bottom" }} autoHideDuration={2000}>
|
<SB dense maxSnack={9} anchorOrigin={{ horizontal: "right", vertical: "bottom" }} autoHideDuration={2000}
|
||||||
|
classes={{ containerRoot: classes.snackbar }}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</SB>
|
</SB>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user