mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-04 14:47:53 +02:00
Hotfix: Popups no longer show up during infiltration (#847)
This commit is contained in:
@@ -14,7 +14,7 @@ interface Alert {
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
export function AlertManager(): React.ReactElement {
|
||||
export function AlertManager({ hidden }: { hidden: boolean }): React.ReactElement {
|
||||
const [alerts, setAlerts] = useState<Alert[]>([]);
|
||||
useEffect(
|
||||
() =>
|
||||
@@ -49,6 +49,8 @@ export function AlertManager(): React.ReactElement {
|
||||
return () => document.removeEventListener("keydown", handle);
|
||||
}, []);
|
||||
|
||||
const alertMessage = alerts[0]?.text || "No alert to show";
|
||||
|
||||
function getMessageHash(text: string | JSX.Element): string {
|
||||
if (typeof text === "string") return sha256(text);
|
||||
return sha256(JSON.stringify(text.props));
|
||||
@@ -61,14 +63,10 @@ export function AlertManager(): React.ReactElement {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{alerts.length > 0 && (
|
||||
<Modal open={true} onClose={close}>
|
||||
<Box overflow="scroll" sx={{ overflowWrap: "break-word", whiteSpace: "pre-line" }}>
|
||||
<Typography component={"span"}>{alerts[0].text}</Typography>
|
||||
</Box>
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
<Modal open={!hidden && alerts.length > 0} onClose={close}>
|
||||
<Box overflow="scroll" sx={{ overflowWrap: "break-word", whiteSpace: "pre-line" }}>
|
||||
<Typography component={"span"}>{alertMessage}</Typography>
|
||||
</Box>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user