mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
refactor: remove dead exports and an unused prop
Drop the health-score card's inert onAskCoach prop and its now-dead pass-through from the hero strip, the buildDashboardBands re-export that no caller reached through the snapshot module, an unused tour-progress status type, and an orphan service-worker cache helper.
This commit is contained in:
1 parent
22f588b34d
commit
8ff3b51ba3
6 files changed
+8
-60
No files matched your search
@@ -194,10 +194,10 @@ describe("<HealthScoreCard>", () => {
|
||||
|
||||
it("v1.4.27 B1 — no longer mounts an inline Ask-the-Coach button (hero strip carries the CTA)", () => {
|
||||
// The hero strip's existing "Ask the coach" action covers this
|
||||
// surface; the card-internal duplicate button retired. The
|
||||
// onAskCoach prop stays on the type signature so callers don't
|
||||
// break, but the card no longer renders it.
|
||||
const omitted = ssr(
|
||||
// surface; the card-internal duplicate button retired. v1.18.6 (L13)
|
||||
// dropped the now-dead `onAskCoach` prop too — the card renders no
|
||||
// Coach affordance at all.
|
||||
const html = ssr(
|
||||
<HealthScoreCard
|
||||
score={86}
|
||||
band="green"
|
||||
@@ -205,17 +205,7 @@ describe("<HealthScoreCard>", () => {
|
||||
delta={null}
|
||||
/>,
|
||||
);
|
||||
const supplied = ssr(
|
||||
<HealthScoreCard
|
||||
score={86}
|
||||
band="green"
|
||||
components={baseComponents}
|
||||
delta={null}
|
||||
onAskCoach={() => {}}
|
||||
/>,
|
||||
);
|
||||
expect(omitted).not.toContain('data-slot="health-score-card-ask-coach"');
|
||||
expect(supplied).not.toContain('data-slot="health-score-card-ask-coach"');
|
||||
expect(html).not.toContain('data-slot="health-score-card-ask-coach"');
|
||||
});
|
||||
|
||||
|
||||
@@ -226,7 +216,6 @@ describe("<HealthScoreCard>", () => {
|
||||
band="green"
|
||||
components={baseComponents}
|
||||
delta={5}
|
||||
onAskCoach={() => {}}
|
||||
/>,
|
||||
"de",
|
||||
);
|
||||
|
||||
@@ -26,8 +26,8 @@ import { HealthScoreDeltaExplainer } from "./health-score-delta-explainer";
|
||||
* at least one component blends entries from more than one source.
|
||||
*
|
||||
* Pure presentational — the parent owns the analytics query + the
|
||||
* drawer state. The same `onAskCoach` handler is shared with the hero
|
||||
* strip's main "Ask the coach" button (different prefill string).
|
||||
* drawer state. The card mounts no inline Coach affordance; the hero
|
||||
* strip carries the single "Ask the coach" entry point.
|
||||
*/
|
||||
|
||||
export type HealthScoreBand = "green" | "yellow" | "red";
|
||||
@@ -70,7 +70,6 @@ export interface HealthScoreCardProps {
|
||||
compliance: HealthScoreCardComponent;
|
||||
};
|
||||
delta: number | null;
|
||||
onAskCoach?: (prefill: string) => void;
|
||||
/**
|
||||
* v1.4.25 W8e — opens the provenance accordion on first render.
|
||||
* The SSR tests use it to exercise the expanded markup without a
|
||||
@@ -175,12 +174,6 @@ export function HealthScoreCard({
|
||||
band,
|
||||
components,
|
||||
delta,
|
||||
// v1.4.27 B1 — onAskCoach stays on the prop signature so the hero
|
||||
// strip's existing wire-up doesn't break, but the card no longer
|
||||
// mounts an inline button (the hero strip already carries the same
|
||||
// action). Destructure-and-ignore is intentional.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onAskCoach: _onAskCoach,
|
||||
initiallyExpanded = false,
|
||||
moodEnabled = true,
|
||||
restModeActive = false,
|
||||
|
||||
@@ -353,16 +353,6 @@ export function HeroStrip({
|
||||
delta={healthScore.delta}
|
||||
moodEnabled={moodEnabled}
|
||||
restModeActive={healthScore.restMode?.active ?? false}
|
||||
onAskCoach={
|
||||
// v1.4.37 W5 — short-circuit the prop drilling even
|
||||
// though `HealthScoreCard` retired its inline button in
|
||||
// v1.4.27. A future re-addition can't accidentally
|
||||
// surface a Coach affordance from this card while the
|
||||
// operator has the flag off.
|
||||
coachEnabled && onAskCoach
|
||||
? (prefill: string) => onAskCoach(prefill)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -78,7 +78,6 @@ import {
|
||||
} from "@/lib/dashboard/meds-today";
|
||||
import { computeUserHealthScoreFastPath } from "@/lib/analytics/health-score-fast-path";
|
||||
import {
|
||||
buildDashboardBands,
|
||||
buildTargetBands,
|
||||
type DashboardTargetBands,
|
||||
} from "@/lib/dashboard/bands";
|
||||
@@ -217,7 +216,7 @@ export interface DashboardSnapshotUser {
|
||||
* personalisation, no height → weight band), matching the client's
|
||||
* previous null-guards exactly.
|
||||
*/
|
||||
export { buildDashboardBands, buildTargetBands };
|
||||
export { buildTargetBands };
|
||||
export type { DashboardTargetBands };
|
||||
|
||||
export interface DashboardSnapshotMoodEntry {
|
||||
|
||||
@@ -20,8 +20,6 @@ export const TOUR_PROGRESS_STATUSES = [
|
||||
"skipped",
|
||||
] as const;
|
||||
|
||||
export type TourProgressStatus = (typeof TOUR_PROGRESS_STATUSES)[number];
|
||||
|
||||
/**
|
||||
* The persisted progress shape. `lastStopId` seeds the resume index;
|
||||
* `completedStopIds` is informational (analytics + future per-module
|
||||
|
||||
@@ -301,27 +301,6 @@ export async function clearPersistedQueryCache(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop the service-worker offline read-data cache (`healthlog-data-*`). It
|
||||
* holds the last-synced dashboard JSON and must never survive a session end on
|
||||
* a shared device. Scoped to the data cache only — the static cache (hashed
|
||||
* chunks, icons) carries no PII and dropping it would force a needless
|
||||
* re-download. Best-effort; never throws.
|
||||
*/
|
||||
export async function clearServiceWorkerDataCache(): Promise<void> {
|
||||
if (typeof caches === "undefined") return;
|
||||
try {
|
||||
const keys = await caches.keys();
|
||||
await Promise.all(
|
||||
keys
|
||||
.filter((k) => k.startsWith("healthlog-data-"))
|
||||
.map((k) => caches.delete(k)),
|
||||
);
|
||||
} catch {
|
||||
/* best effort */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wipe every client-side cache that can hold one account's health data: the
|
||||
* IndexedDB query snapshot, the SW offline read-data cache, and the SW page
|
||||
|
||||
Reference in new issue
Block a user