refactor(types): drop duplicate DataSummary import alias and lift W-ORG imports to file head

Two clarity regressions surfaced by the v1.4.41 QA round.

1. `src/types/analytics.ts:37-38` imported `DataSummary` twice from the
   same module — once bare, once aliased as `DataSummaryType` — with
   the alias used on a single line. The duplicate shape was carried
   verbatim from `src/app/page.tsx` where both names existed
   historically; in a fresh module there's no reason for two import
   lines. Collapses to a single import; `glucoseByContext` now uses
   the canonical `DataSummary`. Same fix replayed in `src/app/page.tsx`.

2. `src/app/insights/page.tsx:100` and
   `src/components/onboarding/getting-started-checklist.tsx:75` carried
   their W-ORG alias-back-import in the middle of the file, after
   non-import statements. Lifts both into the top-of-file import block
   alongside their peers; the aliased name (`as AnalyticsData`) stays
   for call-site stability, the W-ORG header comment moves with the
   import.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 18:15:40 +02:00
1 parent fdd73c711b
commit 92753a7096
4 files changed
+9 -13

No files matched your search

+4 -5
View File
@@ -16,6 +16,10 @@ import { HeroStrip } from "@/components/insights/hero-strip";
import { useInsightsAdvisorQuery } from "@/components/insights/use-insights-advisor";
import { useCoachLaunch } from "@/lib/insights/coach-launch-context";
import { useAnalyticsQuery } from "@/lib/queries/use-analytics-query";
// v1.4.41 W-ORG — shared shape lives in `src/types/analytics.ts` as
// `InsightsAnalyticsData`; aliased back to the local name to keep the
// rest of this file readable.
import type { InsightsAnalyticsData as AnalyticsData } from "@/types/analytics";
/**
* v1.4.33 IW2 — defer the three below-the-fold mother-page blocks
@@ -94,11 +98,6 @@ interface ComprehensiveData {
totalMeasurements: number;
}
// v1.4.41 W-ORG — shared shape lives in `src/types/analytics.ts` as
// `InsightsAnalyticsData`; aliased back to the local name to keep the
// rest of this file readable.
import type { InsightsAnalyticsData as AnalyticsData } from "@/types/analytics";
export default function InsightsPage() {
const { isAuthenticated, user } = useAuth();
const { t } = useTranslations();
+1 -2
View File
@@ -24,7 +24,6 @@ import {
resolveDashboardLayout,
type DashboardLayout,
} from "@/lib/dashboard-layout";
import type { DataSummary as DataSummaryType } from "@/lib/analytics/trends";
import type { DashboardAnalyticsData as AnalyticsData } from "@/types/analytics";
import dynamic from "next/dynamic";
import { Button } from "@/components/ui/button";
@@ -240,7 +239,7 @@ export default function DashboardPage() {
bpInTargetPctPriorMonth: merged.bpInTargetPctPriorMonth,
bpInTargetPctPriorYear: merged.bpInTargetPctPriorYear,
glucoseByContext: merged.glucoseByContext as
| Record<string, DataSummaryType>
| Record<string, DataSummary>
| undefined,
};
}, [analyticsSlimQuery.data, analyticsThickQuery.data]);
@@ -14,6 +14,9 @@ import {
X,
} from "lucide-react";
import type { LucideIcon } from "lucide-react";
// v1.4.41 W-ORG — shared shape lives in `src/types/analytics.ts` as
// `ChecklistAnalyticsData`; aliased back to the local name.
import type { ChecklistAnalyticsData as AnalyticsData } from "@/types/analytics";
import { Button } from "@/components/ui/button";
import { useAuth } from "@/hooks/use-auth";
@@ -70,10 +73,6 @@ const ITEM_LABEL_KEYS: Record<
},
};
// v1.4.41 W-ORG — shared shape lives in `src/types/analytics.ts` as
// `ChecklistAnalyticsData`; aliased back to the local name.
import type { ChecklistAnalyticsData as AnalyticsData } from "@/types/analytics";
interface WithingsStatus {
connected?: boolean;
}
+1 -2
View File
@@ -35,7 +35,6 @@
* shape loses it.
*/
import type { DataSummary } from "@/lib/analytics/trends";
import type { DataSummary as DataSummaryType } from "@/lib/analytics/trends";
import type { CorrelationResult } from "@/lib/insights/correlations";
/** Shape consumed by every `/insights/<metric>/page.tsx`. */
@@ -77,7 +76,7 @@ export interface DashboardAnalyticsData {
*/
bpInTargetPctPriorMonth?: number | null;
bpInTargetPctPriorYear?: number | null;
glucoseByContext?: Record<string, DataSummaryType>;
glucoseByContext?: Record<string, DataSummary>;
/**
* v1.4.34 IW-B — per-type freshness map from `/api/analytics`. The
* tile-strip helper reads `lastSeenByType[type]?.daysAgo` and forwards