"use client"; import { useMemo } from "react"; import { Settings } from "lucide-react"; import { useTranslations } from "@/lib/i18n/context"; import { NativeSelect } from "@/components/ui/native-select"; import { SettingsToggle, useAdminSettings, useUpdateSettings } from "./_shared"; import { listSupportedTimezones } from "@/lib/tz/format"; // v1.4.27 MB7 / CF-52 — the in-file `NATIVE_SELECT_CLASS` constant // retired; the shared `` primitive owns the visual // contract now. The admin copy previously diverged on the // `focus-visible:ring-[3px]` weight; the shared primitive pins // `focus-visible:ring-2` so admin selects match the rest of the form // surface. export function GeneralSettingsSection() { const { t } = useTranslations(); const { data: settings } = useAdminSettings(); const updateSettings = useUpdateSettings(); // Memoised — `listSupportedTimezones()` calls the engine's // `Intl.supportedValuesOf('timeZone')` which returns ~400 strings. const zones = useMemo(() => listSupportedTimezones(), []); const currentDefaultTz = settings?.defaultUserTimezone ?? ""; return (
{t("admin.appSettings")}
updateSettings.mutate({ registrationEnabled: checked }) } disabled={updateSettings.isPending} /> {/* v1.4.27 MB7 / CF-56 — match the SettingsToggle stacking contract: stack on `

{t("admin.defaultLanguage")}

{t("admin.defaultLanguageDescription")}

updateSettings.mutate({ defaultLocale: e.target.value }) } disabled={updateSettings.isPending} className="self-end sm:w-auto sm:self-auto" >
{/* v1.4.25 W7 — server-wide default timezone for new signups. Existing accounts are NOT touched; this drives only the registration handler's fallback when the client doesn't send a browser-detected zone. */}

{t("admin.defaultUserTimezone")}

{t("admin.defaultUserTimezoneDescription")}

updateSettings.mutate({ defaultUserTimezone: e.target.value }) } disabled={updateSettings.isPending} className="sm:w-auto" > {/* Preserve the stored value even if it's not in the current engine's IANA list (rare — but defensive). */} {currentDefaultTz && !zones.includes(currentDefaultTz) && ( )} {zones.map((zone) => ( ))}
); }