import { Button, Dialog, DialogActions, DialogContent, DialogTitle, TextField, } from "@mui/material"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; interface Props { onConfirm: (passwd: string) => Promise; } export const PasswordInput = (props: Props) => { const { onConfirm } = props; const { t } = useTranslation(); const [passwd, setPasswd] = useState(""); useEffect(() => { if (!open) return; }, [open]); return ( {t("Please enter your root password")} e.key === "Enter" && onConfirm(passwd)} onChange={(e) => setPasswd(e.target.value)} > ); };