mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
feat(v1.4): onboarding redesign — dashboard-first checklist, 3 focused steps, inline trend hints (#131)
Redesigns the first-run experience around three patterns we see in
Linear, Vercel and Notion: a short focused wizard, a persistent
getting-started checklist on the dashboard, and contextual hints
inside still-empty charts.
- Onboarding shrinks from 4 steps (one was marketing-only) to 3:
About you (display name + locale + height + DOB + gender) → log
your first measurement (real action via the existing form) → pick
one notification channel (or skip).
- Every step except the first now has a Back button and exactly one
Skip link with the honest "you can finish setup later from
Settings" tail. The legacy duplicate Skip is removed.
- A new dashboard "Getting started" card lists the five quick wins
(profile, first measurement, medication, Withings, notifications).
Each row links to the right place. Items can be hidden one-by-one
or the whole card can be dismissed; both states persist in
localStorage. The card auto-hides once you finish onboarding and
log your fifth measurement.
- Charts that have ≥1 but <5 readings now show a subtle inline hint
("First trend after 5 readings — N more to go") so the user knows
the line will appear soon.
- Display name is captured during onboarding and saved to the
profile.
All new strings are translated to English and German via the
existing i18n pipeline.
Co-authored-by: Marc-André Bombeck <noreply@anthropic.com>
This commit is contained in:
1 parent
14cbc69a2d
commit
f4a2e13985
11 files changed
+1438
-252
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { TrendHint } from "../trend-hint";
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
|
||||
function render(node: React.ReactNode, locale: "en" | "de" = "en") {
|
||||
return renderToStaticMarkup(
|
||||
<I18nProvider initialLocale={locale}>{node}</I18nProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe("<TrendHint>", () => {
|
||||
it("renders nothing for 0 readings", () => {
|
||||
expect(render(<TrendHint count={0} />)).toBe("");
|
||||
});
|
||||
|
||||
it("renders nothing once 5+ readings exist", () => {
|
||||
expect(render(<TrendHint count={5} />)).toBe("");
|
||||
expect(render(<TrendHint count={42} />)).toBe("");
|
||||
});
|
||||
|
||||
it("shows a singular wording when only 1 reading missing", () => {
|
||||
const html = render(<TrendHint count={4} />);
|
||||
expect(html).toContain("First trend after 5 readings");
|
||||
expect(html).toContain("1 more reading to go.");
|
||||
});
|
||||
|
||||
it("shows a plural wording for >1 missing readings", () => {
|
||||
const html = render(<TrendHint count={1} />);
|
||||
expect(html).toContain("4 more readings to go.");
|
||||
});
|
||||
|
||||
it("translates to German when locale is de", () => {
|
||||
const html = render(<TrendHint count={3} />, "de");
|
||||
expect(html).toContain("Erster Trend nach 5 Messungen");
|
||||
expect(html).toContain("Noch 2 Messungen bis zum Trend.");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
|
||||
import { TrendingUp } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/components/ui/empty-state";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { trendHintFor } from "@/lib/onboarding/checklist";
|
||||
|
||||
interface TrendHintProps {
|
||||
/** Total readings logged for this metric (raw count, not days). */
|
||||
count: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tiny banner shown below or alongside a chart for users still in the
|
||||
* "first week" of HealthLog: ≥1 but <5 readings of this metric. We
|
||||
* mount the existing `<EmptyState variant="plain">` primitive so the
|
||||
* shape matches every other empty-state in the app and inherits its
|
||||
* polite-live-region semantics. Renders nothing once the user crosses
|
||||
* 5 readings — no flicker.
|
||||
*/
|
||||
export function TrendHint({ count }: TrendHintProps) {
|
||||
const { t } = useTranslations();
|
||||
const result = trendHintFor(count);
|
||||
if (result.kind === "hidden") return null;
|
||||
|
||||
const description =
|
||||
result.remaining === 1
|
||||
? t("trendHints.remainingOne")
|
||||
: t("trendHints.remainingMany", { count: result.remaining });
|
||||
|
||||
return (
|
||||
<EmptyState
|
||||
variant="plain"
|
||||
size="compact"
|
||||
icon={<TrendingUp className="size-4" />}
|
||||
title={t("trendHints.title")}
|
||||
description={description}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user