mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
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.
68 lines
3.0 KiB
TypeScript
68 lines
3.0 KiB
TypeScript
"use client";
|
|
|
|
/**
|
|
* v1.18.0 (S5) — Settings → Coach.
|
|
*
|
|
* The Coach preference cards moved out of the AI / Assistant section into
|
|
* their own dedicated entry so the AI section owns only provider / model /
|
|
* BYOK configuration. This section gathers the Coach-specific surface:
|
|
*
|
|
* 1. Disable Coach — the per-user opt-out (kept first so a user who
|
|
* wants the surface gone finds it immediately).
|
|
* 2. Coach preferences — tone, verbosity, data scope (`useCoachPrefs`).
|
|
* 3. Proactive nudge — the daily-nudge opt-out + per-group frequency
|
|
* (moved here from Settings → Benachrichtigungen in
|
|
* v1.18.6: it is a Coach setting, not a generic
|
|
* notification).
|
|
* 4. Coach memory — durable-fact review + forget controls.
|
|
*
|
|
* The nav entry is module-gated on `coach`. The preference + nudge + memory
|
|
* cards keep their own content gate on `!user.disableCoach` (mirrored from the
|
|
* old AI section): hiding the Coach hides its tuning + memory controls too.
|
|
*
|
|
* The "about me" context lives in the AI section, not here — the daily
|
|
* briefing reads it too, so it is not a Coach-only setting.
|
|
*
|
|
* v1.18.6 (W9) — the visible heading + subtitle now come from the shared
|
|
* `<SettingsSectionFrame>` in the route; this body is the Coach cards only.
|
|
*/
|
|
|
|
import { DisableCoachCard } from "@/components/settings/ai/disable-coach-card";
|
|
import { CoachMemorySection } from "@/components/settings/coach-memory-section";
|
|
import { CoachNudgeCard } from "@/components/settings/coach-nudge-card";
|
|
import { CoachPrefsSection } from "@/components/settings/coach-prefs-section";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import { useMounted } from "@/hooks/use-mounted";
|
|
|
|
export function CoachSection() {
|
|
const { isAuthenticated, user } = useAuth();
|
|
// Mirror the AI section's hydration-safe gating: the auth query can
|
|
// resolve before this boundary hydrates, so gate the child props on
|
|
// `useMounted()` to keep the hydration render matching the SSR HTML.
|
|
const mounted = useMounted();
|
|
const authed = mounted && isAuthenticated;
|
|
// The preference + memory cards ride the same content gate as the rest
|
|
// of the Coach surface: when the user has hidden the Coach there is no
|
|
// assistant to tune or remember anything. (`mounted`-gated so the SSR +
|
|
// hydration renders agree.)
|
|
const coachEnabled = !mounted || !user?.disableCoach;
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<DisableCoachCard isAuthenticated={authed} />
|
|
|
|
{coachEnabled && <CoachPrefsSection isAuthenticated={authed} />}
|
|
|
|
{/* Proactive Coach nudge — moved here from Benachrichtigungen (v1.18.6).
|
|
Keeps the `#coach-nudge` anchor so existing deep links resolve. */}
|
|
{coachEnabled && (
|
|
<div id="coach-nudge" className="scroll-mt-28">
|
|
<CoachNudgeCard isAuthenticated={isAuthenticated} />
|
|
</div>
|
|
)}
|
|
|
|
{coachEnabled && <CoachMemorySection isAuthenticated={authed} />}
|
|
</div>
|
|
);
|
|
}
|