Files
HealthLog/src/components/insights/derived/provenance-explainer.tsx
T
Marc-André Bombeck b217535b62 chore(v1.22): clear the QA punch-list across Coach, insights, settings
Code-review and design follow-ups before the v1.22 cut. No behaviour change
beyond the items below.

Coach / insights:
- Coach SSE route: a non-provider error raised inside the open producer (e.g. a
  DB failure persisting the reply) now records on the wide event and forwards to
  GlitchTip instead of masquerading as a provider outage; it still surfaces an
  error frame since the stream is open.
- Lab ↔ outcome correlations: hedge faint-tier pairs ("a faint hint, if
  anything … too small to lean on") so the narrated confidence never outruns the
  effect, matching the daily engine.
- Reminder sweep: mint the plan-review reminder and clear the plan's reviewDate
  in one transaction so a half-applied write can't duplicate the reminder.
- Fold the two raw provider-fallback runners onto one shared chain walker.

Design / accessibility:
- Lift sub-44px tap targets to the 44px mobile floor (suggested-action card,
  Coach bubble affordances), brighten the resting timestamp clock for non-text
  contrast, and route the lab chart height through the shared constant.
- Replace ad-hoc arbitrary type sizes with the scale token and static size-11
  icon buttons with the named icon-lg variant.
- Settings: add the missing About card-header descriptions, normalise the
  low-stock numeric widths, and relax the notification-status rows from nested
  cards to a divided list.

Housekeeping:
- Drop three unused exported types (and the now-orphaned source const), re-stamp
  v1.21.5 comments to v1.22, and register the live-judge eval harness as a knip
  entry so the script-only module resolves.
2026-06-27 16:29:58 +02:00

59 lines
1.9 KiB
TypeScript

"use client";
import { cn } from "@/lib/utils";
import type { DerivedProvenance } from "@/lib/insights/derived/types";
/**
* v1.10.0 — the "how this is computed" surface.
*
* v1.22 — the collapsible `ⓘ` glyph that gated the method/inputs/window read
* behind a popover / bottom-sheet is removed; the maintainer wants the
* trailing info affordance gone across the insights surface. The
* plain-language method now renders inline as a muted caption (React text
* children only — the XSS rule still forbids a markdown library), so the
* "how computed" line is always visible rather than disclosure-only. The
* `provenance`, `standard` and `title` props are retained for callers; the
* inputs-chip / window / cited-standard detail folded out with the popover.
*/
export interface ProvenanceStandard {
/** Display name of the cited standard (e.g. "WHO BMI classification"). */
name: string;
/** Absolute URL to the standard. Rendered as a plain `<a>`, never HTML. */
url: string;
}
export interface ProvenanceExplainerProps {
/** The provenance facet off `Derived<T>` — inputs, source, window, asOf. */
provenance: DerivedProvenance;
/**
* Plain-language method description. Text children only — the caller
* passes a localised string; the component never parses markup.
*/
method: React.ReactNode;
/** Optional cited standard. Retained for callers. */
standard?: ProvenanceStandard;
/** Accessible title of the surface. Retained for callers. */
title?: string;
/** Optional className for the caption. */
className?: string;
/** Optional id the parent threads as aria-describedby on its own element. */
bodyId?: string;
}
export function ProvenanceExplainer({
method,
className,
bodyId,
}: ProvenanceExplainerProps) {
return (
<span
id={bodyId}
data-slot="provenance-explainer-method"
className={cn("text-muted-foreground text-xs leading-snug", className)}
>
{method}
</span>
);
}