// AK-P3 Interim-UI (AD-28) — Notification-Settings preview screen composed from // ~/ui (A6 settings archetype). Pure presentational component: renders the // server-built NotificationSettingsVM passed as a prop; toggles run through // injected action callbacks (M014) implemented fetcher-side by the hosting // route. Final Subframe optics land as a tracked design-nachzug once David's // D-P3 ships. import { useTranslation } from "react-i18next"; import type { NotificationSettingChannel, NotificationSettingsVM } from "@hivegrid/view-models"; import { Alert } from "~/ui/components/Alert"; import { Switch } from "~/ui/components/Switch"; export type NotificationSettingsActions = { onTogglePreference: (input: { category: string; channel: NotificationSettingChannel; enabled: boolean }) => void; /** Master switch: true = turn ALL emails off (writes every category). */ onSetEmailMaster: (disableAllEmails: boolean) => void; }; export type NotificationSettingsPageProps = { vm: NotificationSettingsVM; /** Plain-text result of the last save action (null = nothing saved yet). */ saveState: { ok: boolean; errorText?: string } | null; actions: NotificationSettingsActions; }; export function NotificationSettingsPage({ vm, saveState, actions }: NotificationSettingsPageProps) { const { t } = useTranslation(); // Loading / not-ready: keep the marker so the shell + e2e see a stable surface. if (vm.status !== "ready" || !vm.data) { return
; } const { groups, allEmailsDisabled } = vm.data; return (