mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-21 08:40:32 +02:00
fix: Improve SettingsForm UI
This commit is contained in:
parent
6eac166304
commit
c1edcd290d
@ -2,20 +2,23 @@ import * as yup from "yup"
|
|||||||
import {useFormik} from "formik"
|
import {useFormik} from "formik"
|
||||||
import {TbCursorText} from "react-icons/tb"
|
import {TbCursorText} from "react-icons/tb"
|
||||||
import {useTranslation} from "react-i18next"
|
import {useTranslation} from "react-i18next"
|
||||||
|
import {MdCheck, MdOutlineChangeCircle, MdTextFormat} from "react-icons/md"
|
||||||
|
import {BsImage} from "react-icons/bs"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
FormControlLabel,
|
FormControlLabel,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
|
Grid,
|
||||||
InputAdornment,
|
InputAdornment,
|
||||||
TextField,
|
TextField,
|
||||||
|
Typography,
|
||||||
} from "@mui/material"
|
} from "@mui/material"
|
||||||
|
import {LoadingButton} from "@mui/lab"
|
||||||
|
|
||||||
import {AdminSettings} from "~/server-types"
|
import {AdminSettings} from "~/server-types"
|
||||||
import {SimpleForm, StringPoolField, createPool} from "~/components"
|
import {StringPoolField, createPool} from "~/components"
|
||||||
import {MdOutlineChangeCircle, MdTextFormat} from "react-icons/md"
|
|
||||||
import {BsImage} from "react-icons/bs"
|
|
||||||
|
|
||||||
export interface SettingsFormProps {
|
export interface SettingsFormProps {
|
||||||
settings: AdminSettings
|
settings: AdminSettings
|
||||||
@ -79,285 +82,356 @@ export default function SettingsForm({settings}: SettingsFormProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={formik.handleSubmit}>
|
<form onSubmit={formik.handleSubmit}>
|
||||||
<SimpleForm
|
<Grid
|
||||||
isSubmitting={formik.isSubmitting}
|
container
|
||||||
title={t("routes.AdminRoute.settings.title")}
|
spacing={4}
|
||||||
description={t("routes.AdminRoute.settings.description")}
|
paddingX={2}
|
||||||
continueActionLabel={t("general.saveLabel")}
|
paddingY={4}
|
||||||
|
direction="column"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
>
|
>
|
||||||
{[
|
<Grid item>
|
||||||
<TextField
|
<Grid container spacing={2} direction="column">
|
||||||
key="random_email_id_min_length"
|
<Grid item>
|
||||||
fullWidth
|
<Typography variant="h4" component="h1" align="center">
|
||||||
label={t("routes.AdminRoute.forms.settings.randomEmailIdMinLength.label")}
|
{t("routes.AdminRoute.settings.title")}
|
||||||
name="randomEmailIdMinLength"
|
</Typography>
|
||||||
value={formik.values.randomEmailIdMinLength}
|
</Grid>
|
||||||
onChange={formik.handleChange}
|
<Grid item>
|
||||||
error={
|
<Typography variant="subtitle1" component="p">
|
||||||
formik.touched.randomEmailIdMinLength &&
|
{t("routes.AdminRoute.settings.description")}
|
||||||
Boolean(formik.errors.randomEmailIdMinLength)
|
</Typography>
|
||||||
}
|
</Grid>
|
||||||
helperText={
|
</Grid>
|
||||||
(formik.touched.randomEmailIdMinLength &&
|
</Grid>
|
||||||
formik.errors.randomEmailIdMinLength) ||
|
<Grid item>
|
||||||
t("routes.AdminRoute.forms.settings.randomEmailIdMinLength.description")
|
<Grid container spacing={3} direction="row" alignItems="start">
|
||||||
}
|
<Grid item md={6}>
|
||||||
type="number"
|
<TextField
|
||||||
disabled={formik.isSubmitting}
|
key="random_email_id_min_length"
|
||||||
inputMode="numeric"
|
fullWidth
|
||||||
InputProps={{
|
label={t(
|
||||||
startAdornment: (
|
"routes.AdminRoute.forms.settings.randomEmailIdMinLength.label",
|
||||||
<InputAdornment position="start">
|
|
||||||
<TbCursorText />
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<StringPoolField
|
|
||||||
fullWidth
|
|
||||||
allowCustom
|
|
||||||
key="random_email_id_chars"
|
|
||||||
pools={DEFAULT_POOLS}
|
|
||||||
id="random_email_id_chars"
|
|
||||||
label={t("routes.AdminRoute.forms.settings.randomEmailIdChars.label")}
|
|
||||||
name="randomEmailIdChars"
|
|
||||||
value={formik.values.randomEmailIdChars}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
error={
|
|
||||||
formik.touched.randomEmailIdChars &&
|
|
||||||
Boolean(formik.errors.randomEmailIdChars)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
(formik.touched.randomEmailIdChars &&
|
|
||||||
formik.errors.randomEmailIdChars) ||
|
|
||||||
(t(
|
|
||||||
"routes.AdminRoute.forms.settings.randomEmailIdChars.description",
|
|
||||||
) as string)
|
|
||||||
}
|
|
||||||
disabled={formik.isSubmitting}
|
|
||||||
startAdornment={
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<MdTextFormat />
|
|
||||||
</InputAdornment>
|
|
||||||
}
|
|
||||||
/>,
|
|
||||||
<TextField
|
|
||||||
key="random_email_length_increase_on_percentage"
|
|
||||||
fullWidth
|
|
||||||
label={t(
|
|
||||||
"routes.AdminRoute.forms.settings.randomEmailLengthIncreaseOnPercentage.label",
|
|
||||||
)}
|
|
||||||
name="randomEmailIdLengthIncreaseOnPercentage"
|
|
||||||
value={formik.values.randomEmailLengthIncreaseOnPercentage}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
error={
|
|
||||||
formik.touched.randomEmailLengthIncreaseOnPercentage &&
|
|
||||||
Boolean(formik.errors.randomEmailLengthIncreaseOnPercentage)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
(formik.touched.randomEmailLengthIncreaseOnPercentage &&
|
|
||||||
formik.errors.randomEmailLengthIncreaseOnPercentage) ||
|
|
||||||
t(
|
|
||||||
"routes.AdminRoute.forms.settings.randomEmailLengthIncreaseOnPercentage.description",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
type="number"
|
|
||||||
disabled={formik.isSubmitting}
|
|
||||||
inputMode="numeric"
|
|
||||||
InputProps={{
|
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<MdOutlineChangeCircle />
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<TextField
|
|
||||||
key="custom_email_suffix_length"
|
|
||||||
fullWidth
|
|
||||||
label={t("routes.AdminRoute.forms.settings.customEmailSuffixLength.label")}
|
|
||||||
name="customEmailSuffixLength"
|
|
||||||
value={formik.values.customEmailSuffixLength}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
error={
|
|
||||||
formik.touched.customEmailSuffixLength &&
|
|
||||||
Boolean(formik.errors.customEmailSuffixLength)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
(formik.touched.customEmailSuffixLength &&
|
|
||||||
formik.errors.customEmailSuffixLength) ||
|
|
||||||
t(
|
|
||||||
"routes.AdminRoute.forms.settings.customEmailSuffixLength.description",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
type="number"
|
|
||||||
disabled={formik.isSubmitting}
|
|
||||||
inputMode="numeric"
|
|
||||||
InputProps={{
|
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<TbCursorText />
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<StringPoolField
|
|
||||||
key="custom_email_suffix_chars"
|
|
||||||
allowCustom
|
|
||||||
fullWidth
|
|
||||||
pools={DEFAULT_POOLS}
|
|
||||||
id="custom_email_suffix_chars"
|
|
||||||
label={t("routes.AdminRoute.forms.settings.customEmailSuffixChars.label")}
|
|
||||||
name="customEmailSuffixChars"
|
|
||||||
value={formik.values.customEmailSuffixChars}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
error={
|
|
||||||
formik.touched.customEmailSuffixChars &&
|
|
||||||
Boolean(formik.errors.customEmailSuffixChars)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
(formik.touched.customEmailSuffixChars &&
|
|
||||||
formik.errors.customEmailSuffixChars) ||
|
|
||||||
(t(
|
|
||||||
"routes.AdminRoute.forms.settings.customEmailSuffixChars.description",
|
|
||||||
) as string)
|
|
||||||
}
|
|
||||||
disabled={formik.isSubmitting}
|
|
||||||
InputProps={{
|
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<MdTextFormat />
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<TextField
|
|
||||||
key="image_proxy_storage_life_time_in_hours"
|
|
||||||
fullWidth
|
|
||||||
label={t(
|
|
||||||
"routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.label",
|
|
||||||
)}
|
|
||||||
name="imageProxyStorageLifeTimeInHours"
|
|
||||||
value={formik.values.imageProxyStorageLifeTimeInHours}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
error={
|
|
||||||
formik.touched.imageProxyStorageLifeTimeInHours &&
|
|
||||||
Boolean(formik.errors.imageProxyStorageLifeTimeInHours)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
(formik.touched.imageProxyStorageLifeTimeInHours &&
|
|
||||||
formik.errors.imageProxyStorageLifeTimeInHours) ||
|
|
||||||
t(
|
|
||||||
"routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.description",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
type="number"
|
|
||||||
disabled={formik.isSubmitting}
|
|
||||||
inputMode="numeric"
|
|
||||||
InputProps={{
|
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<BsImage />
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<FormGroup key="enable_image_proxy">
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={formik.values.enableImageProxy}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
name="enableImageProxy"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={t("routes.AdminRoute.forms.settings.enableImageProxy.label")}
|
|
||||||
/>
|
|
||||||
<FormHelperText
|
|
||||||
error={
|
|
||||||
formik.touched.enableImageProxy &&
|
|
||||||
Boolean(formik.errors.enableImageProxy)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{(formik.touched.enableImageProxy && formik.errors.enableImageProxy) ||
|
|
||||||
t("routes.AdminRoute.forms.settings.enableImageProxy.description")}
|
|
||||||
</FormHelperText>
|
|
||||||
</FormGroup>,
|
|
||||||
<FormGroup key="user_email_enable_disposable_emails">
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={formik.values.userEmailEnableDisposableEmails}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
name="userEmailEnableDisposableEmails"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={t(
|
|
||||||
"routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.label",
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<FormHelperText
|
|
||||||
error={
|
|
||||||
formik.touched.userEmailEnableDisposableEmails &&
|
|
||||||
Boolean(formik.errors.userEmailEnableDisposableEmails)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{(formik.touched.userEmailEnableDisposableEmails &&
|
|
||||||
formik.errors.userEmailEnableDisposableEmails) ||
|
|
||||||
t(
|
|
||||||
"routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.description",
|
|
||||||
)}
|
)}
|
||||||
</FormHelperText>
|
name="randomEmailIdMinLength"
|
||||||
</FormGroup>,
|
value={formik.values.randomEmailIdMinLength}
|
||||||
<FormGroup key="user_email_enable_other_relays">
|
onChange={formik.handleChange}
|
||||||
<FormControlLabel
|
error={
|
||||||
control={
|
formik.touched.randomEmailIdMinLength &&
|
||||||
<Checkbox
|
Boolean(formik.errors.randomEmailIdMinLength)
|
||||||
checked={formik.values.userEmailEnableOtherRelays}
|
}
|
||||||
onChange={formik.handleChange}
|
helperText={
|
||||||
name="userEmailEnableOtherRelays"
|
(formik.touched.randomEmailIdMinLength &&
|
||||||
/>
|
formik.errors.randomEmailIdMinLength) ||
|
||||||
}
|
t(
|
||||||
label={t(
|
"routes.AdminRoute.forms.settings.randomEmailIdMinLength.description",
|
||||||
"routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.label",
|
)
|
||||||
)}
|
}
|
||||||
/>
|
type="number"
|
||||||
<FormHelperText
|
disabled={formik.isSubmitting}
|
||||||
error={
|
inputMode="numeric"
|
||||||
formik.touched.userEmailEnableOtherRelays &&
|
InputProps={{
|
||||||
Boolean(formik.errors.userEmailEnableOtherRelays)
|
startAdornment: (
|
||||||
}
|
<InputAdornment position="start">
|
||||||
>
|
<TbCursorText />
|
||||||
{(formik.touched.userEmailEnableOtherRelays &&
|
</InputAdornment>
|
||||||
formik.errors.userEmailEnableOtherRelays) ||
|
),
|
||||||
t(
|
}}
|
||||||
"routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.description",
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item md={6}>
|
||||||
|
<StringPoolField
|
||||||
|
fullWidth
|
||||||
|
allowCustom
|
||||||
|
key="random_email_id_chars"
|
||||||
|
pools={DEFAULT_POOLS}
|
||||||
|
id="random_email_id_chars"
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.randomEmailIdChars.label",
|
||||||
)}
|
)}
|
||||||
</FormHelperText>
|
name="randomEmailIdChars"
|
||||||
</FormGroup>,
|
value={formik.values.randomEmailIdChars}
|
||||||
<FormGroup key="allow_statistics">
|
onChange={formik.handleChange}
|
||||||
<FormControlLabel
|
error={
|
||||||
control={
|
formik.touched.randomEmailIdChars &&
|
||||||
<Checkbox
|
Boolean(formik.errors.randomEmailIdChars)
|
||||||
checked={formik.values.allowStatistics}
|
}
|
||||||
onChange={formik.handleChange}
|
helperText={
|
||||||
name="allowStatistics"
|
(formik.touched.randomEmailIdChars &&
|
||||||
|
formik.errors.randomEmailIdChars) ||
|
||||||
|
(t(
|
||||||
|
"routes.AdminRoute.forms.settings.randomEmailIdChars.description",
|
||||||
|
) as string)
|
||||||
|
}
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
startAdornment={
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<MdTextFormat />
|
||||||
|
</InputAdornment>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<TextField
|
||||||
|
key="random_email_length_increase_on_percentage"
|
||||||
|
fullWidth
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.randomEmailLengthIncreaseOnPercentage.label",
|
||||||
|
)}
|
||||||
|
name="randomEmailIdLengthIncreaseOnPercentage"
|
||||||
|
value={formik.values.randomEmailLengthIncreaseOnPercentage}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error={
|
||||||
|
formik.touched.randomEmailLengthIncreaseOnPercentage &&
|
||||||
|
Boolean(formik.errors.randomEmailLengthIncreaseOnPercentage)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
(formik.touched.randomEmailLengthIncreaseOnPercentage &&
|
||||||
|
formik.errors.randomEmailLengthIncreaseOnPercentage) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.randomEmailLengthIncreaseOnPercentage.description",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="number"
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
inputMode="numeric"
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<MdOutlineChangeCircle />
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item md={6}>
|
||||||
|
<TextField
|
||||||
|
key="custom_email_suffix_length"
|
||||||
|
fullWidth
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.customEmailSuffixLength.label",
|
||||||
|
)}
|
||||||
|
name="customEmailSuffixLength"
|
||||||
|
value={formik.values.customEmailSuffixLength}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error={
|
||||||
|
formik.touched.customEmailSuffixLength &&
|
||||||
|
Boolean(formik.errors.customEmailSuffixLength)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
(formik.touched.customEmailSuffixLength &&
|
||||||
|
formik.errors.customEmailSuffixLength) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.customEmailSuffixLength.description",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="number"
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
inputMode="numeric"
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<TbCursorText />
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item md={6}>
|
||||||
|
<StringPoolField
|
||||||
|
key="custom_email_suffix_chars"
|
||||||
|
allowCustom
|
||||||
|
fullWidth
|
||||||
|
pools={DEFAULT_POOLS}
|
||||||
|
id="custom_email_suffix_chars"
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.customEmailSuffixChars.label",
|
||||||
|
)}
|
||||||
|
name="customEmailSuffixChars"
|
||||||
|
value={formik.values.customEmailSuffixChars}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error={
|
||||||
|
formik.touched.customEmailSuffixChars &&
|
||||||
|
Boolean(formik.errors.customEmailSuffixChars)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
(formik.touched.customEmailSuffixChars &&
|
||||||
|
formik.errors.customEmailSuffixChars) ||
|
||||||
|
(t(
|
||||||
|
"routes.AdminRoute.forms.settings.customEmailSuffixChars.description",
|
||||||
|
) as string)
|
||||||
|
}
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
startAdornment={
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<MdTextFormat />
|
||||||
|
</InputAdornment>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<TextField
|
||||||
|
key="image_proxy_storage_life_time_in_hours"
|
||||||
|
fullWidth
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.label",
|
||||||
|
)}
|
||||||
|
name="imageProxyStorageLifeTimeInHours"
|
||||||
|
value={formik.values.imageProxyStorageLifeTimeInHours}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error={
|
||||||
|
formik.touched.imageProxyStorageLifeTimeInHours &&
|
||||||
|
Boolean(formik.errors.imageProxyStorageLifeTimeInHours)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
(formik.touched.imageProxyStorageLifeTimeInHours &&
|
||||||
|
formik.errors.imageProxyStorageLifeTimeInHours) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.imageProxyStorageLifeTimeInHours.description",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="number"
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
inputMode="numeric"
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<BsImage />
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<FormGroup key="user_email_enable_disposable_emails">
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={formik.values.userEmailEnableDisposableEmails}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
name="userEmailEnableDisposableEmails"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.label",
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
}
|
<FormHelperText
|
||||||
label={t("routes.AdminRoute.forms.settings.allowStatistics.label")}
|
error={
|
||||||
/>
|
formik.touched.userEmailEnableDisposableEmails &&
|
||||||
<FormHelperText
|
Boolean(formik.errors.userEmailEnableDisposableEmails)
|
||||||
error={
|
}
|
||||||
formik.touched.allowStatistics &&
|
>
|
||||||
Boolean(formik.errors.allowStatistics)
|
{(formik.touched.userEmailEnableDisposableEmails &&
|
||||||
}
|
formik.errors.userEmailEnableDisposableEmails) ||
|
||||||
>
|
t(
|
||||||
{(formik.touched.allowStatistics && formik.errors.allowStatistics) ||
|
"routes.AdminRoute.forms.settings.userEmailEnableDisposableEmails.description",
|
||||||
t("routes.AdminRoute.forms.settings.allowStatistics.description")}
|
)}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormGroup>,
|
</FormGroup>
|
||||||
]}
|
</Grid>
|
||||||
</SimpleForm>
|
<Grid item>
|
||||||
|
<FormGroup key="user_email_enable_other_relays">
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={formik.values.userEmailEnableOtherRelays}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
name="userEmailEnableOtherRelays"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.label",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormHelperText
|
||||||
|
error={
|
||||||
|
formik.touched.userEmailEnableOtherRelays &&
|
||||||
|
Boolean(formik.errors.userEmailEnableOtherRelays)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{(formik.touched.userEmailEnableOtherRelays &&
|
||||||
|
formik.errors.userEmailEnableOtherRelays) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.userEmailEnableOtherRelays.description",
|
||||||
|
)}
|
||||||
|
</FormHelperText>
|
||||||
|
</FormGroup>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<FormGroup key="enable_image_proxy">
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={formik.values.enableImageProxy}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
name="enableImageProxy"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.enableImageProxy.label",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormHelperText
|
||||||
|
error={
|
||||||
|
formik.touched.enableImageProxy &&
|
||||||
|
Boolean(formik.errors.enableImageProxy)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{(formik.touched.enableImageProxy &&
|
||||||
|
formik.errors.enableImageProxy) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.enableImageProxy.description",
|
||||||
|
)}
|
||||||
|
</FormHelperText>
|
||||||
|
</FormGroup>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<FormGroup key="allow_statistics">
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={formik.values.allowStatistics}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
name="allowStatistics"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={t(
|
||||||
|
"routes.AdminRoute.forms.settings.allowStatistics.label",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormHelperText
|
||||||
|
error={
|
||||||
|
formik.touched.allowStatistics &&
|
||||||
|
Boolean(formik.errors.allowStatistics)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{(formik.touched.allowStatistics &&
|
||||||
|
formik.errors.allowStatistics) ||
|
||||||
|
t(
|
||||||
|
"routes.AdminRoute.forms.settings.allowStatistics.description",
|
||||||
|
)}
|
||||||
|
</FormHelperText>
|
||||||
|
</FormGroup>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<Grid container justifyContent="center">
|
||||||
|
<Grid item>
|
||||||
|
<LoadingButton
|
||||||
|
loading={formik.isSubmitting}
|
||||||
|
variant="contained"
|
||||||
|
type="submit"
|
||||||
|
startIcon={<MdCheck />}
|
||||||
|
>
|
||||||
|
{t("general.saveLabel")}
|
||||||
|
</LoadingButton>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user