From 47eee0db4a692dc9367637815ad420b0a1d41987 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sun, 26 Feb 2023 11:56:58 +0100 Subject: [PATCH] fix: Improve UI --- src/routes/SettingsAliasPreferencesRoute.tsx | 487 +++++++++---------- 1 file changed, 235 insertions(+), 252 deletions(-) diff --git a/src/routes/SettingsAliasPreferencesRoute.tsx b/src/routes/SettingsAliasPreferencesRoute.tsx index b32d20f..e8dd998 100644 --- a/src/routes/SettingsAliasPreferencesRoute.tsx +++ b/src/routes/SettingsAliasPreferencesRoute.tsx @@ -17,7 +17,6 @@ import { InputAdornment, MenuItem, TextField, - Typography, useMediaQuery, useTheme, } from "@mui/material" @@ -31,7 +30,7 @@ import { IMAGE_PROXY_FORMAT_TYPE_NAME_MAP, PROXY_USER_AGENT_TYPE_NAME_MAP, } from "~/constants/enum-mappings" -import {AuthContext} from "~/components" +import {AuthContext, SimplePageBuilder} from "~/components" interface Form { removeTrackers: boolean @@ -121,262 +120,246 @@ export default function SettingsAliasPreferencesRoute(): ReactElement { const isLarge = useMediaQuery(theme.breakpoints.up("md")) return ( -
- - - - {t("routes.SettingsRoute.forms.aliasPreferences.title")} - - - - - {t("routes.SettingsRoute.forms.aliasPreferences.description")} - - - - - - - + + + + + + } + labelPlacement="start" + label={t("relations.alias.settings.removeTrackers.label")} + /> + + {(formik.touched.createMailReport && + formik.errors.createMailReport) || + t("relations.alias.settings.removeTrackers.helperText")} + + + + + + + } + labelPlacement="start" + label={t("relations.alias.settings.createMailReports.label")} + /> + + {(formik.touched.createMailReport && + formik.errors.createMailReport) || + t("relations.alias.settings.createMailReports.helperText")} + + + + + + + } + labelPlacement="start" + label={t("relations.alias.settings.proxyImages.label")} + /> + + {(formik.touched.proxyImages && formik.errors.proxyImages) || + t("relations.alias.settings.proxyImages.helperText")} + + + {t("general.experimentalFeature")} + + + + + + + + + + ), + }} + name="imageProxyFormat" + id="imageProxyFormat" + label={t( + "relations.alias.settings.imageProxyFormat.label", + )} + value={formik.values.imageProxyFormat} onChange={formik.handleChange} - onBlur={formik.handleBlur} - /> - } - labelPlacement="start" - label={t("relations.alias.settings.removeTrackers.label")} - /> - - {(formik.touched.createMailReport && - formik.errors.createMailReport) || - t("relations.alias.settings.removeTrackers.helperText")} - - - - - - - } - labelPlacement="start" - label={t("relations.alias.settings.createMailReports.label")} - /> - - {(formik.touched.createMailReport && - formik.errors.createMailReport) || - t("relations.alias.settings.createMailReports.helperText")} - - - - - - - } - labelPlacement="start" - label={t("relations.alias.settings.proxyImages.label")} - /> - - {(formik.touched.proxyImages && formik.errors.proxyImages) || - t("relations.alias.settings.proxyImages.helperText")} - - - {t("general.experimentalFeature")} - - - - - - - - - - ), - }} - name="imageProxyFormat" - id="imageProxyFormat" - label={t( - "relations.alias.settings.imageProxyFormat.label", - )} - value={formik.values.imageProxyFormat} - onChange={formik.handleChange} - disabled={formik.isSubmitting} - error={ - formik.touched.imageProxyFormat && - Boolean(formik.errors.imageProxyFormat) - } - helperText={ - formik.touched.imageProxyFormat && - formik.errors.imageProxyFormat - } - > - {Object.entries( - IMAGE_PROXY_FORMAT_TYPE_NAME_MAP, - ).map(([value, translationString]) => ( + disabled={formik.isSubmitting} + error={ + formik.touched.imageProxyFormat && + Boolean(formik.errors.imageProxyFormat) + } + helperText={ + formik.touched.imageProxyFormat && + formik.errors.imageProxyFormat + } + > + {Object.entries(IMAGE_PROXY_FORMAT_TYPE_NAME_MAP).map( + ([value, translationString]) => ( {t(translationString)} - ))} - - - {formik.touched.imageProxyFormat && - formik.errors.imageProxyFormat} - - - + ), + )} + + + {formik.touched.imageProxyFormat && + formik.errors.imageProxyFormat} + + - - - - - - {Object.entries(PROXY_USER_AGENT_TYPE_NAME_MAP).map( - ([value, translationString]) => ( - - {t(translationString)} - - ), - )} - - - {(formik.touched.proxyUserAgent && - formik.errors.proxyUserAgent) || - t("relations.alias.settings.proxyUserAgent.helperText")} - - - - - - - } - labelPlacement="start" - label={t("relations.alias.settings.expandUrlShorteners.label")} - /> - - {(formik.touched.expandUrlShorteners && - formik.errors.expandUrlShorteners) || - t( - "relations.alias.settings.expandUrlShorteners.helperText", - )} - - - {t("general.experimentalFeature")} - - - + + + + + + + {Object.entries(PROXY_USER_AGENT_TYPE_NAME_MAP).map( + ([value, translationString]) => ( + + {t(translationString)} + + ), + )} + + + {(formik.touched.proxyUserAgent && formik.errors.proxyUserAgent) || + t("relations.alias.settings.proxyUserAgent.helperText")} + + + + + + + } + labelPlacement="start" + label={t("relations.alias.settings.expandUrlShorteners.label")} + /> + + {(formik.touched.expandUrlShorteners && + formik.errors.expandUrlShorteners) || + t("relations.alias.settings.expandUrlShorteners.helperText")} + + + {t("general.experimentalFeature")} + + - - } - > - {t("routes.SettingsRoute.forms.aliasPreferences.saveAction")} - - - -
+ } + > + {t("routes.SettingsRoute.forms.aliasPreferences.saveAction")} + + + ) }