import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import ConfigBox from "../../Components/ConfigBox"; import TextInput from "../../Components/Inputs/TextInput"; import Button from "@mui/material/Button"; import Stack from "@mui/material/Stack"; // Utils import { useTheme } from "@emotion/react"; import { PropTypes } from "prop-types"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { PasswordEndAdornment } from "../../Components/Inputs/TextInput/Adornments"; import { useSendTestEmail } from "../../Hooks/useSendTestEmail"; const SettingsEmail = ({ isAdmin, HEADER_SX, handleChange, settingsData, setSettingsData, isPasswordSet, }) => { // Setup const { t } = useTranslation(); const theme = useTheme(); // Local state const [password, setPassword] = useState(""); const [hasBeenReset, setHasBeenReset] = useState(false); // Network const [isSending, error, sendTestEmail] = useSendTestEmail(); // Handlers const handlePasswordChange = (e) => { setPassword(e.target.value); setSettingsData({ ...settingsData, settings: { ...settingsData.settings, systemEmailPassword: e.target.value }, }); }; if (!isAdmin) { return null; } return ( {t("settingsEmail")} {t("settingsEmailDescription")} {t("settingsEmailHost")} {t("settingsEmailPort")} {t("settingsEmailUser")} {t("settingsEmailAddress")} {(isPasswordSet === false || hasBeenReset === true) && ( {t("settingsEmailPassword")} } /> )} {isPasswordSet === true && hasBeenReset === false && ( {t("settingsEmailFieldResetLabel")} )} {t("settingsEmailConnectionHost")} ); }; SettingsEmail.propTypes = { isAdmin: PropTypes.bool, settingsData: PropTypes.object, setSettingsData: PropTypes.func, handleChange: PropTypes.func, HEADER_SX: PropTypes.object, isPasswordSet: PropTypes.bool, }; export default SettingsEmail;