From a357332a324847b288b0608086a0155ba53e2372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Mon, 1 Jun 2026 23:42:33 +0200 Subject: [PATCH] refactor(medications): import the shared ComplianceDisplay type on the cards The generic and GLP-1 medication cards each re-spelled the `ComplianceDisplay` interface already exported from the compliance lib. Drop both hand-copies and import the canonical type so a future field change lands in one place. --- src/components/medications/glp1-medication-card.tsx | 11 +---------- src/components/medications/medication-card.tsx | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/components/medications/glp1-medication-card.tsx b/src/components/medications/glp1-medication-card.tsx index 98b5117fc..8a07ef2c9 100644 --- a/src/components/medications/glp1-medication-card.tsx +++ b/src/components/medications/glp1-medication-card.tsx @@ -29,6 +29,7 @@ import { reduceCurrentWindowStatus, toBerlinDate, } from "@/lib/medications/window-status"; +import type { ComplianceDisplay } from "@/lib/analytics/compliance"; /** * v1.4.25 W4d — GLP-1 medication card variant. @@ -99,16 +100,6 @@ export interface Glp1Medication { schedules: ScheduleLite[]; } -interface ComplianceDisplay { - shortDays: number; - longDays: number; - expectedShort: number; - expectedLong: number; - minStableDoses: number; - short: { rate: number; streak: number }; - long: { rate: number }; -} - interface ComplianceData { compliance7: { rate: number; streak: number }; compliance30: { rate: number }; diff --git a/src/components/medications/medication-card.tsx b/src/components/medications/medication-card.tsx index d75735ca1..c4500a1ff 100644 --- a/src/components/medications/medication-card.tsx +++ b/src/components/medications/medication-card.tsx @@ -26,6 +26,7 @@ import { import { LogInjectionSiteDialog } from "@/components/medications/log-injection-site-dialog"; import { useGlobalExcludedInjectionSites } from "@/lib/medications/use-injection-site-prefs"; import type { InjectionSiteKey } from "@/lib/medications/injection-sites"; +import type { ComplianceDisplay } from "@/lib/analytics/compliance"; interface Schedule { id: string; @@ -71,16 +72,6 @@ interface Medication { schedules: Schedule[]; } -interface ComplianceDisplay { - shortDays: number; - longDays: number; - expectedShort: number; - expectedLong: number; - minStableDoses: number; - short: { rate: number; streak: number }; - long: { rate: number }; -} - interface ComplianceData { compliance7: { totalExpected: number;