mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
The two former settings sections (`/settings/thresholds` and
`/settings/sources`) covered the same conceptual shelf — per-metric
configuration. Reading them together matches how users actually
think about each metric ("for this metric, which sources do I trust
AND what range counts as healthy?") and collapses two adjacent
sidebar slots into one.
`<ThresholdsSection>` now hosts both editors stacked under one page
header: the per-metric threshold ranges on top, the per-metric source
priority + two-axis device-type ladder below. The two mutation flows
(`/api/user/thresholds` and `/api/auth/me/source-priority`) stay
distinct so a save on one half never disturbs the other.
`<SourcesSection>` gained a `mode` prop. The default `"standalone"`
behaviour is preserved for any caller that still mounts it directly;
the new `"embedded"` mode drops the inner header so the assistive-tech
reading order stays one combined surface, not two.
The `sources` slug was dropped from `SETTINGS_SECTION_SLUGS` (down to
ten sections), and the Sources entry was removed from the in-shell
sidebar + mobile chip-strip. `/settings/sources` stays alive as a
`permanentRedirect` to `/settings/thresholds`, so external bookmarks
(iOS Settings deep-links, docs, anything that linked the URL) follow
through unchanged.
Tests updated: `SETTINGS_SECTION_SLUGS` size assertion drops from
eleven to ten; `<ThresholdsSection>` mount test now expects both
editor mount-points; the section title moves from "Personal
thresholds" / "Persönliche Zielwerte" to "Targets & Sources" /
"Zielwerte & Quellen".
Per `.planning/research/v1434-r-2-carryover-scope.md` §7 and
`.planning/round-v1433-audit-menu.md` §7.1 (item 3).
78 lines
3.3 KiB
TypeScript
78 lines
3.3 KiB
TypeScript
"use client";
|
|
|
|
import { SourcesSection } from "@/components/settings/sources-section";
|
|
import { ThresholdsEditorSection } from "@/components/settings/thresholds-editor-section";
|
|
import { useTranslations } from "@/lib/i18n/context";
|
|
|
|
/**
|
|
* `<ThresholdsSection>` — route-level wrapper for `/settings/thresholds`.
|
|
*
|
|
* v1.4.34 IW-D — section was renamed "Zielwerte & Quellen" / "Targets &
|
|
* Sources" and absorbs the former `/settings/sources` content. The two
|
|
* editors stay distinct mutation flows (`/api/user/thresholds` for
|
|
* ranges + `/api/auth/me/source-priority` for source ladders) so a save
|
|
* on one half never disturbs the other; presenting them on a single
|
|
* page collapses two adjacent sidebar slots into one and matches the
|
|
* Settings nav audit (§7.1 item 3 in
|
|
* `.planning/round-v1433-audit-menu.md` — both screens were per-metric
|
|
* configuration shelves and reading them together matches how a user
|
|
* actually thinks about a metric: "for this metric, which sources do
|
|
* I trust AND what range counts as healthy?").
|
|
*
|
|
* `/settings/sources` stays alive as a `permanentRedirect` (see
|
|
* `src/app/settings/sources/page.tsx`) so external bookmarks (iOS
|
|
* Settings deep-links, docs) keep resolving.
|
|
*
|
|
* Visual structure on this page:
|
|
* 1. Section header (combined title + description).
|
|
* 2. `<ThresholdsEditorSection>` — per-metric range inputs (top).
|
|
* The editor card kept its own affordance row (icon, reset-all
|
|
* button) so the action surface stays compact.
|
|
* 3. `<SourcesSection>` body — per-metric source priority + the
|
|
* two-axis device-type expander (bottom). The inner section's
|
|
* header was suppressed in `mode="embedded"` because the page
|
|
* header above already names the surface.
|
|
*
|
|
* v1.4.16 phase B6: file renamed from the historic
|
|
* `thresholds-settings-section.tsx` (`<ThresholdsSettingsSection>`)
|
|
* so the filename + default export match the slug — every other
|
|
* section in `src/components/settings/` follows the
|
|
* `<slug>-section.tsx` `<SlugSection>` convention. The inner editor
|
|
* card was simultaneously moved out of `thresholds-section.tsx`
|
|
* (where it used to live as `<ThresholdsSection>`) into
|
|
* `thresholds-editor-section.tsx` (`<ThresholdsEditorSection>`) so
|
|
* the names stop clashing.
|
|
*/
|
|
export function ThresholdsSection() {
|
|
const { t } = useTranslations();
|
|
|
|
return (
|
|
<section
|
|
aria-labelledby="settings-section-thresholds-title"
|
|
className="space-y-6"
|
|
>
|
|
<header className="space-y-1">
|
|
<h1
|
|
id="settings-section-thresholds-title"
|
|
className="text-2xl font-semibold tracking-tight"
|
|
>
|
|
{t("settings.sections.thresholds.title")}
|
|
</h1>
|
|
<p className="text-muted-foreground text-sm">
|
|
{t("settings.sections.thresholds.description")}
|
|
</p>
|
|
</header>
|
|
|
|
{/* Per-metric threshold ranges — top card. */}
|
|
<ThresholdsEditorSection id="thresholds" />
|
|
|
|
{/* Per-metric source priority + two-axis device-type ladder —
|
|
bottom card. `mode="embedded"` suppresses the inner h1 +
|
|
subtitle (the page header above owns the surface name) and
|
|
drops the inner `<section>` aria-label so the assistive-tech
|
|
reading order stays one combined surface, not two. */}
|
|
<SourcesSection mode="embedded" />
|
|
</section>
|
|
);
|
|
}
|