diff --git a/web/src/features/dialog/InputDialog.tsx b/web/src/features/dialog/InputDialog.tsx index dbcffd7..d0059c4 100644 --- a/web/src/features/dialog/InputDialog.tsx +++ b/web/src/features/dialog/InputDialog.tsx @@ -1,24 +1,16 @@ -import { - Modal, - ModalOverlay, - ModalContent, - ModalFooter, - ModalHeader, - ModalBody, - Button, -} from "@chakra-ui/react"; -import React from "react"; -import { useNuiEvent } from "../../hooks/useNuiEvent"; -import { useKeyPress } from "../../hooks/useKeyPress"; -import { useLocales } from "../../providers/LocaleProvider"; -import { debugData } from "../../utils/debugData"; -import { fetchNui } from "../../utils/fetchNui"; -import { IInput, ICheckbox, ISelect, INumber, ISlider } from "../../interfaces/dialog"; -import InputField from "./components/input"; -import CheckboxField from "./components/checkbox"; -import SelectField from "./components/select"; -import NumberField from "./components/number"; -import SliderField from "./components/slider"; +import { Modal, ModalOverlay, ModalContent, ModalFooter, ModalHeader, ModalBody, Button } from '@chakra-ui/react'; +import React from 'react'; +import { useNuiEvent } from '../../hooks/useNuiEvent'; +import { useKeyPress } from '../../hooks/useKeyPress'; +import { useLocales } from '../../providers/LocaleProvider'; +import { debugData } from '../../utils/debugData'; +import { fetchNui } from '../../utils/fetchNui'; +import { IInput, ICheckbox, ISelect, INumber, ISlider } from '../../interfaces/dialog'; +import InputField from './components/input'; +import CheckboxField from './components/checkbox'; +import SelectField from './components/select'; +import NumberField from './components/number'; +import SliderField from './components/slider'; interface Props { heading: string; @@ -53,12 +45,10 @@ interface Props { const InputDialog: React.FC = () => { const [fields, setFields] = React.useState({ - heading: "", - rows: [{ type: "input", label: "" }], + heading: '', + rows: [{ type: 'input', label: '' }], }); - const [inputData, setInputData] = React.useState< - Array - >([]); + const [inputData, setInputData] = React.useState>([]); const [passwordStates, setPasswordStates] = React.useState([]); const [visible, setVisible] = React.useState(false); const { locale } = useLocales(); @@ -70,7 +60,7 @@ const InputDialog: React.FC = () => { }); }; - useNuiEvent("openDialog", (data) => { + useNuiEvent('openDialog', (data) => { setPasswordStates([]); setFields(data); setInputData([]); @@ -79,7 +69,7 @@ const InputDialog: React.FC = () => { const handleClose = () => { setVisible(false); - fetchNui("inputData"); + fetchNui('inputData'); }; const handleChange = (value: string | number | boolean, index: number) => { @@ -91,19 +81,12 @@ const InputDialog: React.FC = () => { const handleConfirm = () => { setVisible(false); - fetchNui("inputData", inputData); + fetchNui('inputData', inputData); }; return ( <> - + { @@ -114,7 +97,7 @@ const InputDialog: React.FC = () => { {fields.rows.map((row: IInput | ICheckbox | ISelect | INumber | ISlider, index) => ( - {row.type === "input" && ( + {row.type === 'input' && ( { handlePasswordStates={handlePasswordStates} /> )} - {row.type === "checkbox" && ( - - )} - {row.type === "select" && ( - - )} - {row.type === "number" && ( - - )} - {row.type === "slider" && ( - - )} + {row.type === 'checkbox' && } + {row.type === 'select' && } + {row.type === 'number' && } + {row.type === 'slider' && } ))}