diff --git a/web/src/features/dialog/InputDialog.tsx b/web/src/features/dialog/InputDialog.tsx index add0bc8..2df0dc0 100644 --- a/web/src/features/dialog/InputDialog.tsx +++ b/web/src/features/dialog/InputDialog.tsx @@ -7,12 +7,15 @@ import { ModalBody, Box, Input, + InputGroup, + InputRightElement, Text, Button, Checkbox, Select, } from "@chakra-ui/react"; import React from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNuiEvent } from "../../hooks/useNuiEvent"; import { useLocales } from "../../providers/LocaleProvider"; import { debugData } from "../../utils/debugData"; @@ -26,6 +29,7 @@ interface Props { type: RowType; label: string; options?: { value: string; label: string }[]; + password?: boolean; }[]; } @@ -37,7 +41,7 @@ debugData([ rows: [ { type: "input", label: "Locker number" }, { type: "checkbox", label: "Some checkbox" }, - { type: "input", label: "Locker PIN" }, + { type: "input", label: "Locker PIN", password: true }, { type: "checkbox", label: "Some other checkbox" }, { type: "select", @@ -62,7 +66,11 @@ const InputDialog: React.FC = () => { const [visible, setVisible] = React.useState(false); const { locale } = useLocales(); + const [showPassword, setShowPassword] = React.useState(false); + const handleShowPassword = () => setShowPassword(!showPassword); + useNuiEvent("openDialog", (data) => { + setShowPassword(false); setFields(data); setInputData([]); setVisible(true); @@ -104,9 +112,26 @@ const InputDialog: React.FC = () => { {row.type === "input" && ( {row.label} - handleChange(e.target.value, index)} - /> + + handleChange(e.target.value, index)} + type={!row.password || showPassword ? 'text' : 'password'} + /> + {row.password && ( + + } + /> + )} + )} {row.type === "checkbox" && (