mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(charts): medication-compliance shows comparison N/A caption when toggle is on (H4)
The comparison overlay was added to BP / weight / pulse / mood charts in B8 but the medication-compliance heatmap doesn't render a prior-period overlay (the underlying intake-event window comparison is deferred to v1.4.17). Without an explicit indicator the user toggling Vormonat would see this card stay static and read it as a broken toggle. Added a short "Comparison N/A for compliance" caption under the header when the global compareBaseline is active so the asymmetry is visible. EN+DE i18n. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fb12f098e6
commit
56614392be
4 files changed
+38
-3
No files matched your search
+2
-1
@@ -676,7 +676,8 @@
|
||||
"insightsCallout": {
|
||||
"lastMonth": "Vergleich zum Vormonat aktiv",
|
||||
"lastYear": "Vergleich zum Vorjahr aktiv"
|
||||
}
|
||||
},
|
||||
"notAvailableForCompliance": "Vergleich für Compliance nicht verfügbar"
|
||||
},
|
||||
"insights": {
|
||||
"aiAnalysisTitle": "KI-Gesundheitsanalyse",
|
||||
|
||||
+2
-1
@@ -676,7 +676,8 @@
|
||||
"insightsCallout": {
|
||||
"lastMonth": "Tracking against last month",
|
||||
"lastYear": "Tracking against last year"
|
||||
}
|
||||
},
|
||||
"notAvailableForCompliance": "Comparison N/A for compliance"
|
||||
},
|
||||
"insights": {
|
||||
"aiAnalysisTitle": "AI Health Analysis",
|
||||
|
||||
+6
-1
@@ -994,7 +994,12 @@ export default function DashboardPage() {
|
||||
charts.push({
|
||||
id: "medications",
|
||||
order: widgetOrder("medications"),
|
||||
node: <MedicationComplianceChart key="medications" />,
|
||||
node: (
|
||||
<MedicationComplianceChart
|
||||
key="medications"
|
||||
compareBaseline={compareBaseline}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (showAchievementsCard) {
|
||||
|
||||
@@ -152,10 +152,22 @@ export function computeMedicationTrend7d(
|
||||
interface MedicationComplianceChartProps {
|
||||
/** Override the visible label, primarily for tests. */
|
||||
title?: string;
|
||||
/**
|
||||
* v1.4.16 phase D reconcile (H4 design) — when the user toggles the
|
||||
* dashboard comparison overlay, every other chart paints a dimmed
|
||||
* prior-period line. Compliance is a percentage-of-doses metric whose
|
||||
* "prior month" overlay would need a second window of intake events
|
||||
* (deferred to v1.4.17). We accept the prop so the parent doesn't
|
||||
* have to special-case this chart, and surface a small caption when
|
||||
* comparison is on so the user understands the asymmetry rather than
|
||||
* thinking the toggle is broken.
|
||||
*/
|
||||
compareBaseline?: "none" | "lastMonth" | "lastYear";
|
||||
}
|
||||
|
||||
export function MedicationComplianceChart({
|
||||
title,
|
||||
compareBaseline = "none",
|
||||
}: MedicationComplianceChartProps) {
|
||||
const { isAuthenticated } = useAuth();
|
||||
const { t } = useTranslations();
|
||||
@@ -266,6 +278,22 @@ export function MedicationComplianceChart({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* v1.4.16 phase D reconcile (H4 design) — explicit "comparison
|
||||
N/A" caption when the global toggle is on. The compliance
|
||||
heatmap doesn't render a prior-period overlay (deferred to
|
||||
v1.4.17 when the underlying intake-event window comparison
|
||||
ships). Without this caption the user toggles Vormonat and
|
||||
this card just stays static, which reads as a bug. */}
|
||||
{compareBaseline !== "none" && (
|
||||
<p
|
||||
className="text-muted-foreground -mt-2 mb-3 text-xs"
|
||||
data-slot="medication-comparison-na"
|
||||
data-compare-baseline={compareBaseline}
|
||||
>
|
||||
{t("comparison.notAvailableForCompliance")}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* v1.4.16 B1a — sibling SVG <defs> block for SSR-discoverable
|
||||
gradient. */}
|
||||
<svg
|
||||
|
||||
Reference in new issue
Block a user