Files
HealthLog/src/components/settings/layout-section.tsx
T
Marc-André Bombeck 33d7d103da feat(settings): standardize settings and admin section framing
Introduce a shared SettingsSectionFrame (the settings twin of the admin
renderer's SectionFrame) that emits the canonical visible heading +
subheading, and route all 19 settings sections through it. Every settings
page now shows a real h1 + subtitle in the reference Übersicht style
instead of an invisible sr-only title; the section bodies drop their own
headings and off-style intro paragraphs (the explanatory copy folds into
the frame subtitle).

- Route the admin About page through SectionFrame so it carries the same
  visible heading as every other admin section.
- Rename the AI settings section from KI-Auswertung to KI-Anbieter across
  six locales: the page configures the provider and key, not an analysis.
- Add a heading-block spacer to the settings and admin sidebars so the
  first menu item lines up with the top of the first card.
- Remove the always-on core-domains card from Module: a tracking area that
  can't be turned off doesn't need listing.
- Move the proactive-coach control out of Benachrichtigungen into Coach.
- Move admin module availability out of the Coach section into its own
  page: it gates every module, not just the coach.
- Give the Layout Insights editor a proper Insights heading.

Adds settings.sections.<slug>.subtitle and the new admin keys across all
six locales; removes the now-unused module core-domain strings.
2026-06-18 21:28:33 +02:00

91 lines
2.9 KiB
TypeScript

"use client";
import Link from "next/link";
import {
ChevronRight,
LayoutDashboard,
TrendingUp,
type LucideIcon,
} from "lucide-react";
import { cn } from "@/lib/utils";
import { useTranslations } from "@/lib/i18n/context";
/**
* v1.17.1 (F-2) — the one "Layout & Personalization" home.
*
* Before this section, "how my app is laid out" was scattered across
* several unrelated settings sections with no shared framing. This
* section is the single front door for the arrangement editors: it
* presents them as one consistent set of cards and links to each editor,
* which keep their own routes and mutation flows intact.
*
* v1.18.0 (S5) — Medications (Medikamente) and Mood (Stimmung) graduated
* to their own top-level nav entries, so the hub now hosts only the
* dashboard + insights arrangement editors.
*/
interface LayoutLink {
href: string;
icon: LucideIcon;
titleKey: string;
descriptionKey: string;
}
const LAYOUT_LINKS: ReadonlyArray<LayoutLink> = [
{
href: "/settings/dashboard",
icon: LayoutDashboard,
titleKey: "settings.sections.layout.dashboard.title",
descriptionKey: "settings.sections.layout.dashboard.description",
},
{
href: "/settings/insights",
icon: TrendingUp,
titleKey: "settings.sections.layout.insights.title",
descriptionKey: "settings.sections.layout.insights.description",
},
// v1.18.0 (S5) — Medications (Medikamente) and Mood (Stimmung) graduated
// to their own top-level nav entries, so they are no longer linked from
// the Layout hub. Only the dashboard + insights arrangement editors
// remain here.
];
export function LayoutSection() {
const { t } = useTranslations();
// v1.18.6 (W9) — the visible heading + subtitle now come from the shared
// `<SettingsSectionFrame>` in the route; this body is the hub link list.
return (
<ul className="space-y-3">
{LAYOUT_LINKS.map((link) => {
const Icon = link.icon;
return (
<li key={link.href}>
<Link
href={link.href}
className={cn(
"bg-card border-border hover:bg-accent/40 group flex items-center gap-4 rounded-xl border p-4 transition-colors sm:p-5",
)}
>
<Icon
className="text-muted-foreground h-5 w-5 shrink-0"
aria-hidden="true"
/>
<div className="min-w-0 flex-1 space-y-0.5">
<p className="text-sm font-semibold">{t(link.titleKey)}</p>
<p className="text-muted-foreground text-xs">
{t(link.descriptionKey)}
</p>
</div>
<ChevronRight
className="text-muted-foreground/60 group-hover:text-foreground h-4 w-4 shrink-0 transition-colors"
aria-hidden="true"
/>
</Link>
</li>
);
})}
</ul>
);
}