Carry the setup answers into the checklist, Settings and the module pages

The getting-started checklist reads the answers: a visit named within a
month adds a "prepare the visit" row that is done once one is on the
calendar, and the data-source row names the wearable that was chosen.
Its per-browser state moves to one module so the done screen, the skip
and Settings write the same keys.

Settings → Account gains the two ways back in: "Set up again" through
the restart route, which resets the ledger, keeps the answers as
prefill and touches no module; and "Show the checklist again", which
forgets what this browser hid.

A page whose module is off now answers with the shared notice and the
one action that helps, in one place for every module page: the shell
maps the route to the module through the navigation model's own gate,
so a page and its nav entry cannot disagree about which switch they
follow. And the tour's two dead stops get their anchors on the
integrations and health-record group headings.
This commit is contained in:
Marc-André Bombeck committed 2026-09-10 15:41:06 +02:00
1 parent a062610895
commit ec82ad3a93
13 files changed
+325 -16

No files matched your search

+1 -1
View File
@@ -37,7 +37,7 @@ export function ChoiceChip({
return (
<label
className={cn(
"border-border bg-card flex min-h-11 cursor-pointer items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors duration-150 ease-out motion-reduce:transition-none",
"border-border bg-card flex min-h-11 cursor-pointer items-center gap-3 rounded-lg border p-3 text-left transition-colors duration-150 ease-out motion-reduce:transition-none",
"hover:border-primary/50",
"has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-offset-2",
checked && "border-primary bg-primary/5",
@@ -10,6 +10,7 @@ import {
ChevronDown,
Pill,
Sparkles,
Stethoscope,
User2,
Wifi,
X,
@@ -28,11 +29,14 @@ import {
visibleChecklist,
type ChecklistItemId,
} from "@/lib/onboarding/checklist";
import { apiGet } from "@/lib/api/api-fetch";
const DISMISSED_ITEMS_KEY = "healthlog-getting-started-dismissed";
const DISMISSED_ALL_KEY = "healthlog-getting-started-hidden";
const EXPANDED_KEY = "healthlog-getting-started-expanded";
import { apiFetchEnvelope, apiGet } from "@/lib/api/api-fetch";
import {
CHECKLIST_DISMISSED_ALL_KEY as DISMISSED_ALL_KEY,
CHECKLIST_DISMISSED_ITEMS_KEY as DISMISSED_ITEMS_KEY,
CHECKLIST_EXPANDED_KEY as EXPANDED_KEY,
} from "@/lib/onboarding/checklist-storage";
import { questionOptionLabelKey } from "@/lib/onboarding/question-config";
import { isBrowserConnectableSource } from "@/lib/onboarding/wizard-steps";
const ITEM_ICONS: Record<ChecklistItemId, LucideIcon> = {
profile: User2,
@@ -41,6 +45,7 @@ const ITEM_ICONS: Record<ChecklistItemId, LucideIcon> = {
dataSource: Wifi,
notifications: Bell,
insights: Sparkles,
visit: Stethoscope,
};
const ITEM_LABEL_KEYS: Record<
@@ -77,8 +82,17 @@ const ITEM_LABEL_KEYS: Record<
description: "gettingStarted.items.insightsDescription",
cta: "gettingStarted.items.insightsCta",
},
visit: {
title: "gettingStarted.items.visitTitle",
description: "gettingStarted.items.visitDescription",
cta: "gettingStarted.items.visitCta",
},
};
interface EncounterListMeta {
upcoming?: number;
}
interface IntegrationsStatus {
integrations?: Array<{ connected?: boolean; enabled?: boolean }>;
}
@@ -288,6 +302,26 @@ export function GettingStartedChecklist() {
enabled: checklistRelevant,
});
// v1.39 (C2) — the "prepare the visit" row, only for the answer that asked
// for it: a visit within a month. Reads the visits list's own meta count so
// the row flips done the moment one is on the calendar.
const visitAsked = user?.onboarding?.needs.visit === "within-a-month";
const { data: encountersMeta } = useQuery<EncounterListMeta>({
queryKey: queryKeys.onboardingUpcomingVisits(),
queryFn: async () => {
const { meta } = await apiFetchEnvelope<unknown, EncounterListMeta>(
"/api/encounters",
);
return meta ?? {};
},
enabled: checklistRelevant && visitAsked,
});
// The named source: "Connect Oura" rather than "Connect a data source"
// for somebody who said their readings come from one.
const namedSource =
user?.onboarding?.needs.sources.find(isBrowserConnectableSource) ?? null;
const medicationCount = medsData?.length ?? 0;
const dataSourceConnected = (integrationsData?.integrations ?? []).some(
(integration) =>
@@ -312,6 +346,7 @@ export function GettingStartedChecklist() {
notificationsConfigured,
insightsConfigured,
dismissedIds,
upcomingVisitCount: encountersMeta?.upcoming ?? 0,
// v1.39 (C1) — the setup answers order these rows: medication first
// for somebody who said they take one daily, the data-source row first
// for somebody who named a wearable. The payload resolves them for the
@@ -331,6 +366,7 @@ export function GettingStartedChecklist() {
notificationsConfigured,
insightsConfigured,
dismissedIds,
encountersMeta?.upcoming,
],
);
@@ -497,7 +533,13 @@ export function GettingStartedChecklist() {
: "truncate text-sm font-medium"
}
>
{t(labels.title)}
{item.id === "dataSource" && namedSource
? t("gettingStarted.items.dataSourceNamedTitle", {
source: t(
questionOptionLabelKey("sources", namedSource),
),
})
: t(labels.title)}
</p>
<p className="text-muted-foreground truncate text-xs">
{t(labels.description)}