import { Trans } from "@lingui/react/macro" import { Button } from "@/components/ui/button" import { Label } from "@/components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { chartTimeData } from "@/lib/utils" import { Separator } from "@/components/ui/separator" import { LanguagesIcon, LoaderCircleIcon, SaveIcon } from "lucide-react" import { UserSettings } from "@/types" import { saveSettings } from "./layout" 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) } return (

General

Change general application options.

Language

Want to help improve our translations? Check{" "} Crowdin {" "} for details.

Chart options

Adjust display options for charts.

Sets the default time range for charts when a system is viewed.

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 */}

Unit preferences

Change display units for metrics.

) }