diff --git a/beszel/site/src/components/routes/settings/general.tsx b/beszel/site/src/components/routes/settings/general.tsx index 0ff3373b..753bb6f1 100644 --- a/beszel/site/src/components/routes/settings/general.tsx +++ b/beszel/site/src/components/routes/settings/general.tsx @@ -11,17 +11,30 @@ import { useState } from "react" import languages from "@/lib/languages" import { dynamicActivate } from "@/lib/i18n" import { useLingui } from "@lingui/react/macro" +import { Input } from "@/components/ui/input" +// import { setLang } from "@/lib/i18n" import { Unit } from "@/lib/enums" export default function SettingsProfilePage({ userSettings }: { userSettings: UserSettings }) { const [isLoading, setIsLoading] = useState(false) const { i18n } = useLingui() + // Remove all per-metric threshold state and UI + // Only keep general yellow/red threshold state and UI + const [yellow, setYellow] = useState(userSettings.meterThresholds?.yellow ?? 65) + const [red, setRed] = useState(userSettings.meterThresholds?.red ?? 90) + + function handleResetThresholds() { + setYellow(65) + setRed(90) + } + async function handleSubmit(e: React.FormEvent) { e.preventDefault() setIsLoading(true) const formData = new FormData(e.target as HTMLFormElement) const data = Object.fromEntries(formData) as Partial + data.meterThresholds = { yellow, red } await saveSettings(data) setIsLoading(false) } @@ -101,6 +114,45 @@ export default function SettingsProfilePage({ userSettings }: { userSettings: Us

+
+
+

+ Dashboard meter thresholds +

+

+ Choose when the dashboard meters changes colors, based on percentage values. +

+
+
+
+ + setYellow(Number(e.target.value))} + /> +
+
+ + setRed(Number(e.target.value))} + /> +
+ +
+
+ + {/* Unit preferences section fixed and wrapped in a div */}

@@ -133,7 +185,6 @@ export default function SettingsProfilePage({ userSettings }: { userSettings: Us

-
-