mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-10 03:36:08 +00:00
re-fixes ComplexModal.js to use UIDs (I lasted 10 minutes having to watch this break you know who you are medbay player) (#4344)
* Update ComplexModal.js * Update ComplexModal.js * Update ComplexModal.js
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useBackend } from "../../backend";
|
||||
import { useBackend, useLocalState } from "../../backend";
|
||||
import { Box, Button, Dropdown, Flex, Input, Modal } from '../../components';
|
||||
|
||||
let bodyOverrides = {};
|
||||
@@ -77,6 +77,7 @@ export const ComplexModal = (props, context) => {
|
||||
id,
|
||||
text,
|
||||
type,
|
||||
uid,
|
||||
} = data.modal;
|
||||
|
||||
let modalOnEnter;
|
||||
@@ -94,7 +95,7 @@ export const ComplexModal = (props, context) => {
|
||||
if (bodyOverrides[id]) {
|
||||
modalBody = bodyOverrides[id](data.modal, context);
|
||||
} else if (type === "input") {
|
||||
let curValue = data.modal.value;
|
||||
const [curValue, setCurValue] = useLocalState(context, 'curValue' + data.modal.uid.toString(), data.modal.value.toString());
|
||||
modalOnEnter = e => modalAnswer(context, id, curValue);
|
||||
modalBody = (
|
||||
<Input
|
||||
@@ -105,7 +106,7 @@ export const ComplexModal = (props, context) => {
|
||||
autoFocus
|
||||
autoSelect
|
||||
onChange={(_e, val) => {
|
||||
curValue = val;
|
||||
setCurValue(val);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user