mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-12 02:26:01 +02:00
Hotfix: Popups no longer show up during infiltration (#847)
This commit is contained in:
@@ -16,7 +16,7 @@ interface Prompt {
|
||||
resolve: (result: boolean | string) => void;
|
||||
}
|
||||
|
||||
export function PromptManager(): React.ReactElement {
|
||||
export function PromptManager({ hidden }: { hidden: boolean }): React.ReactElement {
|
||||
const [prompt, setPrompt] = useState<Prompt | null>(null);
|
||||
useEffect(() => {
|
||||
return PromptEvent.subscribe((p: Prompt) => {
|
||||
@@ -24,10 +24,6 @@ export function PromptManager(): React.ReactElement {
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (prompt === null) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
if (prompt === null) return;
|
||||
if (["text", "select"].includes(prompt.options?.type ?? "")) {
|
||||
@@ -44,19 +40,23 @@ export function PromptManager(): React.ReactElement {
|
||||
};
|
||||
|
||||
let PromptContent = PromptMenuBoolean;
|
||||
if (prompt.options?.type && ["text", "select"].includes(prompt.options.type))
|
||||
if (prompt?.options?.type && ["text", "select"].includes(prompt.options.type))
|
||||
PromptContent = types[prompt.options.type];
|
||||
const resolve = (value: boolean | string): void => {
|
||||
prompt.resolve(value);
|
||||
prompt?.resolve(value);
|
||||
setPrompt(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal open={true} onClose={close}>
|
||||
<pre>
|
||||
<Typography>{prompt.txt}</Typography>
|
||||
</pre>
|
||||
<PromptContent prompt={prompt} resolve={resolve} />
|
||||
<Modal open={!hidden && prompt !== null} onClose={close}>
|
||||
{prompt && (
|
||||
<>
|
||||
<pre>
|
||||
<Typography>{prompt.txt}</Typography>
|
||||
</pre>
|
||||
<PromptContent prompt={prompt} resolve={resolve} />
|
||||
</>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user