From dede6899900d36dc3896766d77aef75de5e7f0f1 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 26 Feb 2026 19:31:12 +0000 Subject: [PATCH] global threshold slider fix --- .gitignore | 3 +- client/src/Pages/Settings/index.tsx | 47 ++++++++++++++++++++++++++--- client/src/Validation/settings.ts | 2 +- client/src/locales/en.json | 3 ++ 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f411b5c8b..81e5668b6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ mongo node_modules/ docs/architecture -docs/reviews \ No newline at end of file +docs/reviews +docs/todo \ No newline at end of file diff --git a/client/src/Pages/Settings/index.tsx b/client/src/Pages/Settings/index.tsx index 2f54a1235..dbeba6096 100644 --- a/client/src/Pages/Settings/index.tsx +++ b/client/src/Pages/Settings/index.tsx @@ -1,6 +1,13 @@ import { BasePage, ConfigBox, TextLink } from "@/Components/design-elements"; import { Autocomplete, Select, Dialog, SwitchComponent } from "@/Components/inputs"; -import { Stack, useTheme, MenuItem, Link, type SelectChangeEvent } from "@mui/material"; +import { + Stack, + useTheme, + MenuItem, + Link, + Alert, + type SelectChangeEvent, +} from "@mui/material"; import { useEffect } from "react"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -257,8 +264,7 @@ export const SettingsPage = () => { (acc as any)[typedKey] = Object.entries(value).reduce( (nested, [nestedKey, nestedValue]) => ({ ...nested, - [nestedKey]: - nestedValue === undefined || nestedValue === 0 ? "" : nestedValue, + [nestedKey]: nestedValue === undefined ? "" : nestedValue, }), {} ); @@ -523,7 +529,7 @@ export const SettingsPage = () => { "pages.settings.form.thresholds.option.temperature.label" )} min={1} - max={100} + max={150} sliderMaxWidth={{ xs: "100%", md: "50%" }} value={field.value || 1} onChange={(_, value) => field.onChange(value)} @@ -965,6 +971,39 @@ export const SettingsPage = () => { zIndex: 1000, }} > + {/* Validation Error Display */} + {Object.keys(form.formState.errors).length > 0 && ( + + + {t("pages.settings.form.validation.errorMessage")} + + + {Object.entries(form.formState.errors).map(([field, error]) => { + const message = + typeof error === "object" && error?.message + ? error.message + : "Invalid value"; + return ( +
  • + + {field}: {message} + +
  • + ); + })} +
    +
    + )} +