fix(insights): honest discovery footer, commensurable better-days ranking, settings tap-target + prop cleanup

- Mood discovery footer no longer pairs a mood-only numerator with the
  full behaviour-by-outcome denominator. Reword it to surface the mood
  relationships out of all day-to-day pairs the engine tested across
  every metric, so the count it reports is honest about its scope.
  Update all six locales.
- Rank the better-days board on a comparable scale: standardize the tag
  mood-point delta into a Cohen's-d effect (delta over the pooled
  with/without mood SD, clamped to [0,1]) so it sits alongside a metric
  |r| instead of the old |delta|/2 heuristic. Fall back to |delta|/2 only
  when the pooled SD is undefined. The pooled SD is ranking-only and is
  stripped before the row enters the snapshot payload; the raw delta and
  r the cards show are unchanged.
- Normalize the Withings and Whoop resume buttons to the min-h-11 scale
  token, dropping the arbitrary min-h-[44px] spelling.
- Give the API token copy button a 44px tap target on small viewports,
  scaling back to the tighter icon size from sm up.
- Drop the dead cached prop from InsightStatusCard and every caller; the
  card has carried no cached affordance since the badge was removed.
This commit is contained in:
Marc-André Bombeck committed 2026-06-04 19:39:37 +02:00
1 parent 766b395900
commit 874e286379
23 files changed
+162 -41

No files matched your search

@@ -24,7 +24,6 @@ const baseProps = {
icon: null,
text: "Your pulse is stable.",
hasProvider: true,
cached: false,
updatedAt: null,
};
@@ -24,7 +24,6 @@ const baseProps = {
title: "Pulse",
icon: null,
hasProvider: true,
cached: false,
updatedAt: null,
};
@@ -90,14 +89,14 @@ describe("<InsightStatusCard>", () => {
expect(html).toContain("No analysis yet.");
});
it("never surfaces a cached badge, even when the text came from the warm cache", () => {
// v1.11.5 — the top-right "cached" label was removed. The caching
// behaviour is unchanged (the prop is still threaded), but the card
// no longer announces it, so the assessment reads as authoritative.
it("never surfaces a cached badge — the card has no cached affordance", () => {
// v1.11.5 — the top-right "cached" label was removed and the dead
// `cached` prop was dropped from the contract. The caching behaviour
// upstream is unchanged; the card simply never announced it, so the
// assessment reads as authoritative.
const html = render(
<InsightStatusCard
{...baseProps}
cached
text="Pulse stayed inside the band."
/>,
);
@@ -15,14 +15,6 @@ interface InsightStatusCardProps {
icon: React.ReactNode;
text: string | null;
hasProvider: boolean;
/**
* Whether the rendered text came from the warm cache rather than a
* fresh generation. Retained on the contract so every caller can keep
* threading it, but the card no longer surfaces a "cached" badge — the
* label devalued the assessment and the caching is an implementation
* detail the user does not need to see.
*/
cached: boolean;
updatedAt: string | null;
loading?: boolean;
/**
@@ -43,7 +43,6 @@ export function MetricStatusCard({
icon={icon}
text={status?.text ?? null}
hasProvider={status?.hasProvider ?? false}
cached={status?.cached ?? false}
updatedAt={status?.updatedAt ?? null}
loading={isLoading}
preparing={status?.preparing ?? false}
@@ -111,7 +111,7 @@ describe("<MoodDiscoveredRelations>", () => {
expect(html).toContain("lower next-day");
});
it("filters to mood pairs and shows the honest tested footer", () => {
it("filters to mood pairs and shows the honest full-family footer", () => {
const html = renderWith(
[
pair({ behaviour: "TIME_IN_DAYLIGHT", outcome: "MOOD" }),
@@ -122,7 +122,8 @@ describe("<MoodDiscoveredRelations>", () => {
expect((html.match(/data-slot="mood-discovered-pair"/g) ?? []).length).toBe(
1,
);
// footer reports 1 mood pair of 12 tested
expect(html).toContain("1 of 12");
// Footer's denominator is the full behaviour×outcome family the engine
// tested, not the mood-only subset — so it must report 12, not 1 of 1.
expect(html).toContain("from 12 day-to-day pairs");
});
});
@@ -124,7 +124,6 @@ export function MoodDiscoveredRelations() {
</ul>
<p className="text-muted-foreground text-[11px]">
{t("insights.mood.discovery.footer", {
discovered: moodPairs.length,
tested: data.pairsTested,
})}
</p>
+1 -1
View File
@@ -303,7 +303,7 @@ function ApiTokensCard() {
type="button"
variant="outline"
size="icon"
className="h-9 w-9 shrink-0"
className="min-h-11 min-w-11 shrink-0 sm:h-9 sm:w-9"
onClick={() => void handleCopyToken()}
aria-label={t("settings.tokenCopy")}
data-slot="settings-api-token-copy"
@@ -464,7 +464,7 @@ function WithingsCard({
onClick={() => resume.mutate()}
disabled={resume.isPending}
data-testid="withings-resume-button"
className="min-h-[44px] sm:min-h-0"
className="min-h-11"
>
{resume.isPending ? (
<Loader2 className="mr-1 h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />
@@ -897,7 +897,7 @@ function WhoopCard({
onClick={() => resume.mutate()}
disabled={resume.isPending}
data-testid="whoop-resume-button"
className="min-h-[44px] sm:min-h-0"
className="min-h-11"
>
{resume.isPending ? (
<Loader2 className="mr-1 h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />