mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
refactor(dashboard): retire the legacy opt-in hero
The digest-driven Today hero is the single promoted hero at the top of the dashboard, so the old opt-in hero band is redundant — a user who had opted in and has Insights on saw two heroes. Remove the legacy hero and its heroVisible layout flag. - Drop the DashboardHero / DashboardHeroSkeleton mount from the dashboard page; the header now renders the greeting unconditionally (its showGreeting gate is gone with the hero that owned it). - Retire the heroVisible field from the dashboard layout (type, defaults, resolver, serializer) and the widgets PUT schema. The resolver is a whitelist constructor, so a stored heroVisible is dropped on read and never re-persisted — no stored layout breaks. - Delete the now-orphaned hero components (band, skeleton, ring carousel, briefing spotlight) and their tests; drop the retired dashboard.hero copy across all locales. - Remove the hero-visibility toggle from Settings → Dashboard. The score-ring picker no longer hangs off that flag and stays available, since the rings it configures still ride the server-computed dashboard snapshot. - Repoint the phone-width density guard at the Today hero and mock the daily digest so it renders. - Repoint the preserve-when-absent doc analogy off the removed field.
This commit is contained in:
1 parent
d6ad76b1e1
commit
1d592bef78
29 files changed
+183
-2719
No files matched your search
@@ -1,18 +1,15 @@
|
||||
/**
|
||||
* `<DashboardHeader>` greeting contract.
|
||||
*
|
||||
* The greeting line lives in the hero band when that renders; the hero
|
||||
* is optional (snapshot flag off, or hidden via the dashboard-layout
|
||||
* toggle), so the page feeds `showGreeting` from its hero gate and the
|
||||
* header restores the pre-hero greeting paragraph for exactly those
|
||||
* mounts. Pinned here:
|
||||
* The greeting line sits under the title on every dashboard mount — the
|
||||
* promoted Today hero renders separately above the tile strip, so the
|
||||
* header greeting is unconditional (the legacy opt-in hero that once
|
||||
* owned it was retired). Pinned here:
|
||||
*
|
||||
* 1. `showGreeting` renders the greeting line (with the `min-h-5`
|
||||
* line-box reservation that keeps the header height stable through
|
||||
* the post-hydration name personalisation);
|
||||
* 2. without the prop (the hero owns the greeting) the line is absent
|
||||
* — no duplicate greeting above the hero band;
|
||||
* 3. the SSR pass renders the name-less fallback (hydration-safe).
|
||||
* 1. the greeting line renders (with the `min-h-5` line-box
|
||||
* reservation that keeps the header height stable through the
|
||||
* post-hydration name personalisation);
|
||||
* 2. the SSR pass renders the name-less fallback (hydration-safe).
|
||||
*/
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
@@ -34,10 +31,8 @@ function renderSSR(node: React.ReactElement, locale: "en" | "de" = "de") {
|
||||
}
|
||||
|
||||
describe("<DashboardHeader> — greeting", () => {
|
||||
it("renders the greeting line when the hero is hidden (showGreeting)", () => {
|
||||
const html = renderSSR(
|
||||
<DashboardHeader onQuickEntry={() => undefined} showGreeting />,
|
||||
);
|
||||
it("renders the greeting line under the title", () => {
|
||||
const html = renderSSR(<DashboardHeader onQuickEntry={() => undefined} />);
|
||||
expect(html).toContain('data-slot="dashboard-header-greeting"');
|
||||
// SSR pass: name-less fallback (personalises post-hydration only).
|
||||
expect(html).toContain("willkommen zurück.");
|
||||
@@ -45,12 +40,6 @@ describe("<DashboardHeader> — greeting", () => {
|
||||
// post-hydration personalisation swap.
|
||||
expect(html).toMatch(/data-slot="dashboard-header-greeting"[^>]*>/);
|
||||
expect(html).toContain("min-h-5");
|
||||
});
|
||||
|
||||
it("renders NO greeting line when the hero band owns it (default)", () => {
|
||||
const html = renderSSR(<DashboardHeader onQuickEntry={() => undefined} />);
|
||||
expect(html).not.toContain('data-slot="dashboard-header-greeting"');
|
||||
expect(html).not.toContain("willkommen zurück.");
|
||||
// The title itself stays.
|
||||
expect(html).toContain("Dashboard");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user