feat(illness): name the symptom curve in the recovery-gap card

When the logged symptom curve drives the recovery gap, the card names it
('you felt better N days before your logged symptoms eased') instead of
the vital-driven phrasing. Mirror the new gapDriverType and the return
track's adverse flag into the client DTO, and add the driver-aware copy
across all six locales.
This commit is contained in:
Marc-André Bombeck committed 2026-06-21 21:06:14 +02:00
1 parent fc76c39aea
commit 1352ba2aa6
8 files changed
+36 -4

No files matched your search

@@ -44,6 +44,10 @@ function DeviationRow({ d }: { d: IllnessVitalDeviation }) {
function CorrelationBody({ value }: { value: IllnessCorrelationValue }) {
const { t } = useTranslations();
const gap = value.recoveryGapDays;
// Driver-aware copy: when the user's logged symptom curve drove the gap, name
// the symptoms ("…before your symptoms eased"); otherwise the existing
// vital-driven phrasing. Clinically calm — observation, never prediction.
const symptomDriven = value.gapDriverType === "FUNCTIONAL_IMPACT";
return (
<div className="space-y-5">
@@ -71,11 +75,19 @@ function CorrelationBody({ value }: { value: IllnessCorrelationValue }) {
</p>
<p className="text-muted-foreground mt-1 text-sm">
{gap > 0
? t("illness.correlation.recoveryGapLag", { days: gap })
? t(
symptomDriven
? "illness.correlation.recoveryGapLagSymptom"
: "illness.correlation.recoveryGapLag",
{ days: gap },
)
: gap < 0
? t("illness.correlation.recoveryGapLead", {
days: Math.abs(gap),
})
? t(
symptomDriven
? "illness.correlation.recoveryGapLeadSymptom"
: "illness.correlation.recoveryGapLead",
{ days: Math.abs(gap) },
)
: t("illness.correlation.recoveryGapSame")}
</p>
</div>
+8
View File
@@ -97,9 +97,11 @@ export interface IllnessVitalDeviation {
}
export interface IllnessVitalReturn {
/** A `MeasurementType`, or `"FUNCTIONAL_IMPACT"` for the symptom-burden track. */
type: string;
returnedDay: string | null;
gapDays: number | null;
adverse: boolean;
}
export interface IllnessRedFlag {
@@ -117,6 +119,12 @@ export interface IllnessCorrelationValue {
recoveryGapDays: number | null;
adverseCoverageDays: number;
feltBetterDay: string | null;
/**
* The metric that drove the headline gap — a `MeasurementType`,
* `"FUNCTIONAL_IMPACT"` (the symptom-burden track), or null. Drives the
* driver-aware recovery-gap copy.
*/
gapDriverType: string | null;
redFlags: IllnessRedFlag[];
}