Merge branch 'fix/qol-a11y-sweep' into release/v1.27.32

# Conflicts:
#	src/components/dashboard/recent-workouts-tile.tsx
This commit is contained in:
Marc-André Bombeck committed 2026-07-09 02:09:57 +02:00
commit e4eb3b04ab
63 files changed
+1389 -889

No files matched your search

+19 -7
View File
@@ -13,7 +13,6 @@ import {
Heart,
KeyRound,
Languages,
Loader2,
Lock,
LogIn,
Moon,
@@ -33,6 +32,8 @@ import { Progress } from "@/components/ui/progress";
import { Badge } from "@/components/ui/badge";
import { EmptyState } from "@/components/ui/empty-state";
import { PageHeader } from "@/components/ui/page-header";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import { useAuth } from "@/hooks/use-auth";
import { useTranslations } from "@/lib/i18n/context";
import { formatDate } from "@/lib/format";
@@ -271,16 +272,12 @@ export default function AchievementsPage() {
// alongside `<RecentAchievementsCard>` and
// `<AchievementUnlockNotifier>` so the three consumers never trigger
// more than one network call on a cold dashboard mount.
const { data, isLoading } = useAchievementsQuery({
const { data, isLoading, isError, refetch } = useAchievementsQuery({
enabled: isAuthenticated && achievementsEnabled,
});
if (authLoading || (achievementsEnabled && isLoading)) {
return (
<div className="flex items-center justify-center py-20">
<Loader2 className="text-primary h-6 w-6 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
// v1.18.0 — module off ⇒ the surface disappears entirely. The nav entry
@@ -302,6 +299,21 @@ export default function AchievementsPage() {
);
}
// A failed load must never fall through to the zeroed summary tiles + the
// "none unlocked yet" empty grid (UI-STANDARDS §6). Surface an honest
// retry instead.
if (isError) {
return (
<div className="space-y-6">
<PageHeader
title={t("achievements.title")}
description={t("achievements.subtitle")}
/>
<QueryErrorCard onRetry={() => refetch()} />
</div>
);
}
const summary = data?.summary;
const achievements = data?.achievements ?? [];
const grouped = groupByCategory(achievements);
+2 -6
View File
@@ -1,13 +1,13 @@
"use client";
import { useCallback } from "react";
import { Loader2 } from "lucide-react";
import { useQueryClient } from "@tanstack/react-query";
import { useAuth } from "@/hooks/use-auth";
import { useMounted } from "@/hooks/use-mounted";
import { usePullToRefresh } from "@/hooks/use-pull-to-refresh";
import { PullToRefreshIndicator } from "@/components/ui/pull-to-refresh-indicator";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { VorsorgeSection } from "@/components/measurement-reminders/vorsorge-section";
import { queryKeys } from "@/lib/query-keys";
@@ -35,11 +35,7 @@ export default function CheckupsPage() {
const pull = usePullToRefresh({ onRefresh: refresh });
if (!mounted || isLoading) {
return (
<div className="flex min-h-[40vh] items-center justify-center">
<Loader2 className="text-muted-foreground h-6 w-6 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate />;
}
return (
+23 -2
View File
@@ -1,12 +1,14 @@
"use client";
import { useEffect, useMemo, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { MessagesSquare, Search, Trash2 } from "lucide-react";
import { MessagesSquare, Search, Target, Trash2 } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { PageHeader } from "@/components/ui/page-header";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import { COACH_SCROLLBAR } from "@/components/insights/coach-panel/message-thread";
import {
useCoachConversations,
@@ -92,7 +94,8 @@ function groupByRecency(conversations: CoachConversationDTO[]): RecencyGroup[] {
function CoachConversationsBody() {
const { t } = useTranslations();
const router = useRouter();
const { conversations, isLoading } = useCoachConversations();
const { conversations, isLoading, isError, refetch } =
useCoachConversations();
const deleteMutation = useDeleteCoachConversation();
const [filter, setFilter] = useState<string>("");
const [confirmId, setConfirmId] = useState<string | null>(null);
@@ -129,6 +132,19 @@ function CoachConversationsBody() {
{t("insights.coach.historyTitle")}
</span>
}
actions={
// Surface the sibling Plans ledger — otherwise it is reachable
// only from the composer's `+` menu.
<Button asChild variant="outline" size="sm">
<Link
href="/coach/plans"
data-slot="coach-conversations-plans-link"
>
<Target className="size-4" aria-hidden="true" />
{t("coach.plans.title")}
</Link>
</Button>
}
/>
<div className="relative">
<Search
@@ -160,6 +176,11 @@ function CoachConversationsBody() {
>
{t("common.loading")}
</p>
) : isError && conversations.length === 0 ? (
// A load failure must not masquerade as "no conversations yet" —
// that reads as a data-loss scare and offers no way back. Mirror
// /coach/plans and surface a retry.
<QueryErrorCard onRetry={() => refetch()} />
) : groups.length === 0 ? (
<div
data-slot="coach-conversations-empty"
+36 -16
View File
@@ -1,12 +1,22 @@
"use client";
import { useEffect, useMemo } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { Check, Loader2, Target, Trash2, X } from "lucide-react";
import {
Check,
Loader2,
MessagesSquare,
Target,
Trash2,
X,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { PageHeader } from "@/components/ui/page-header";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import { EmptyState } from "@/components/ui/empty-state";
import { Skeleton } from "@/components/ui/skeleton";
import { COACH_SCROLLBAR } from "@/components/insights/coach-panel/message-thread";
import {
useCoachPlans,
@@ -204,6 +214,17 @@ function CoachPlansBody() {
<span data-slot="coach-plans-heading">{t("coach.plans.title")}</span>
}
description={t("coach.plans.pageDescription")}
actions={
<Button asChild variant="outline" size="sm">
<Link
href="/coach/conversations"
data-slot="coach-plans-conversations-link"
>
<MessagesSquare className="size-4" aria-hidden="true" />
{t("insights.coach.historyTitle")}
</Link>
</Button>
}
/>
<div
@@ -216,23 +237,22 @@ function CoachPlansBody() {
{query.isError ? (
<QueryErrorCard onRetry={() => query.refetch()} />
) : query.isLoading ? (
<p
data-slot="coach-plans-loading"
className="text-muted-foreground px-1 py-3 text-sm"
>
{t("common.loading")}
</p>
) : groups.length === 0 ? (
<div
data-slot="coach-plans-empty"
className="flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center"
data-slot="coach-plans-loading"
className="flex flex-col gap-2"
aria-hidden="true"
>
<span className="bg-muted/40 text-muted-foreground flex size-12 items-center justify-center rounded-full">
<Target className="size-6" aria-hidden="true" />
</span>
<p className="text-muted-foreground max-w-xs text-sm leading-relaxed">
{t("coach.plans.empty")}
</p>
{[0, 1, 2].map((i) => (
<Skeleton key={i} className="h-16 w-full rounded-xl" />
))}
</div>
) : groups.length === 0 ? (
<div data-slot="coach-plans-empty">
<EmptyState
variant="plain"
icon={<Target className="size-6" />}
title={t("coach.plans.empty")}
/>
</div>
) : (
groups.map((group) => (
+2 -6
View File
@@ -9,7 +9,7 @@
*/
import { use, useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { CustomMetricDetail } from "@/components/custom-metrics/custom-metric-detail";
import { BackLink } from "@/components/ui/back-link";
@@ -35,11 +35,7 @@ export default function CustomMetricDetailPage({
}, [isLoading, isAuthenticated, router]);
if (!mounted || isLoading) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
return (
+3 -13
View File
@@ -2,9 +2,9 @@
import { Suspense, useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { useAuth } from "@/hooks/use-auth";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { CycleView } from "@/components/cycle/cycle-view";
/**
@@ -36,24 +36,14 @@ export default function CyclePage() {
}, [isLoading, isAuthenticated, enabled, router]);
if (isLoading || !isAuthenticated || !enabled) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate />;
}
// `<CycleView>` reads `useSearchParams` for the `?tab=` deep-link; wrap it in
// a Suspense boundary so the client-search-params bailout never de-opts the
// build (Next's `missing-suspense-with-csr-bailout`).
return (
<Suspense
fallback={
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
}
>
<Suspense fallback={<PageAuthGate />}>
<CycleView />
</Suspense>
);
+2 -6
View File
@@ -9,7 +9,7 @@
*/
import { use, useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { IllnessEpisodeDetail } from "@/components/illness/illness-episode-detail";
import { BackLink } from "@/components/ui/back-link";
@@ -40,11 +40,7 @@ export default function IllnessEpisodePage({
}, [isLoading, isAuthenticated, enabled, router]);
if (!mounted || isLoading || !isAuthenticated || !enabled) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
return (
+2 -6
View File
@@ -2,9 +2,9 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { useAuth } from "@/hooks/use-auth";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { IllnessView } from "@/components/illness/illness-view";
/**
@@ -35,11 +35,7 @@ export default function IllnessPage() {
}, [isLoading, isAuthenticated, enabled, router]);
if (isLoading || !isAuthenticated || !enabled) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate />;
}
return <IllnessView />;
+7 -18
View File
@@ -4,7 +4,7 @@ import { Fragment, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
import dynamic from "next/dynamic";
import Link from "next/link";
import { RefreshCw, SlidersHorizontal, TrendingUp } from "lucide-react";
import { SlidersHorizontal, TrendingUp } from "lucide-react";
import { useAuth } from "@/hooks/use-auth";
import { queryKeys } from "@/lib/query-keys";
@@ -20,6 +20,7 @@ import { useScrollResetOnRoute } from "@/hooks/use-scroll-reset-on-route";
import { useTranslations } from "@/lib/i18n/context";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import { Skeleton } from "@/components/ui/skeleton";
import { cn } from "@/lib/utils";
import { HeroStrip } from "@/components/insights/hero-strip";
@@ -340,23 +341,11 @@ export default function InsightsPage() {
// mirroring the <VitalsDashboard> error pattern.
if (isError) {
return (
<div
data-slot="insights-overview-error"
role="alert"
className="bg-card border-border text-muted-foreground flex flex-col items-start gap-3 rounded-xl border p-4 text-sm sm:flex-row sm:items-center sm:justify-between"
>
<span>{t("insights.loadError")}</span>
<Button
type="button"
size="sm"
variant="outline"
onClick={() => refetch()}
data-slot="insights-overview-retry"
className="gap-1.5"
>
<RefreshCw className="h-3.5 w-3.5" aria-hidden="true" />
<span>{t("common.retry")}</span>
</Button>
<div data-slot="insights-overview-error">
<QueryErrorCard
description={t("insights.loadError")}
onRetry={() => refetch()}
/>
</div>
);
}
+2 -6
View File
@@ -9,7 +9,7 @@
*/
import { use, useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { LabBiomarkerDetail } from "@/components/labs/lab-biomarker-detail";
import { BackLink } from "@/components/ui/back-link";
@@ -35,11 +35,7 @@ export default function LabBiomarkerDetailPage({
}, [isLoading, isAuthenticated, router]);
if (!mounted || isLoading) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
return (
+3 -6
View File
@@ -14,9 +14,10 @@ import { CustomMetricList } from "@/components/custom-metrics/custom-metric-list
import { MEASUREMENT_TYPE_LABEL_KEYS } from "@/components/measurements/measurement-list-meta";
import { Button } from "@/components/ui/button";
import { PageHeader } from "@/components/ui/page-header";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { PullToRefreshIndicator } from "@/components/ui/pull-to-refresh-indicator";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { Plus, Loader2 } from "lucide-react";
import { Plus } from "lucide-react";
import { useRouter, useSearchParams } from "next/navigation";
import { useTranslations } from "@/lib/i18n/context";
@@ -116,11 +117,7 @@ export default function MeasurementsPage() {
// SSR HTML when this boundary hydrates after `/api/auth/me` settled
// (React #418 family); see `useMounted`.
if (!mounted || isLoading) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
return (
+2 -14
View File
@@ -15,7 +15,7 @@
import { use, useEffect } from "react";
import { useQuery } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { useAuth } from "@/hooks/use-auth";
import { useTranslations } from "@/lib/i18n/context";
@@ -68,19 +68,7 @@ export default function MedicationDetailPage({
});
if (authLoading || isLoading || !isAuthenticated) {
return (
<div
className="flex h-64 items-center justify-center"
role="status"
aria-busy="true"
aria-live="polite"
>
<Loader2
aria-hidden="true"
className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none"
/>
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
if (isError || !medication) {
+6 -14
View File
@@ -26,6 +26,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { EmptyState } from "@/components/ui/empty-state";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import { Skeleton } from "@/components/ui/skeleton";
import {
CheckCheck,
@@ -426,20 +427,11 @@ export default function MedicationsPage() {
)}
</div>
) : isError ? (
<div className="bg-card border-border flex h-64 items-center justify-center rounded-xl border">
<div className="flex flex-col items-center gap-3">
<p className="text-muted-foreground text-sm">
{t("medications.loadFailed")}
</p>
<Button
variant="outline"
size="sm"
onClick={() => void refetchMedications()}
>
{t("medications.retryLoad")}
</Button>
</div>
</div>
<QueryErrorCard
description={t("medications.loadFailed")}
retryLabel={t("medications.retryLoad")}
onRetry={() => void refetchMedications()}
/>
) : !medications?.length ? (
// v1.4.15 phase-C5: refactor the inline icon+text+button block
// to the shared EmptyState primitive so the empty path matches
+2 -6
View File
@@ -2,9 +2,9 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { Loader2 } from "lucide-react";
import { useAuth } from "@/hooks/use-auth";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { MentalWellbeing } from "@/components/mental-health/mental-wellbeing";
/**
@@ -40,11 +40,7 @@ export default function MentalWellbeingPage() {
}, [isLoading, isAuthenticated, enabled, router]);
if (isLoading || !isAuthenticated || !enabled) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate />;
}
return (
+3 -6
View File
@@ -10,9 +10,10 @@ import { MoodForm } from "@/components/mood/mood-form";
import { MoodList } from "@/components/mood/mood-list";
import { Button } from "@/components/ui/button";
import { PageHeader } from "@/components/ui/page-header";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { PullToRefreshIndicator } from "@/components/ui/pull-to-refresh-indicator";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { Plus, Loader2, Wrench } from "lucide-react";
import { Plus, Wrench } from "lucide-react";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useTranslations } from "@/lib/i18n/context";
@@ -54,11 +55,7 @@ export default function MoodPage() {
// and React logged hydration error #418 — same fix as the measurements
// page; see `useMounted`.
if (!mounted || isLoading) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="text-primary h-8 w-8 animate-spin motion-reduce:animate-none" />
</div>
);
return <PageAuthGate label={t("common.loading")} />;
}
return (
@@ -0,0 +1,129 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { I18nProvider } from "@/lib/i18n/context";
/**
* Notification-matrix page contract (QoL/UX audit 2026-07-08):
* - H2: the "no channels" CTA points at Settings → Integrations#channels,
* the surface that can actually add a channel (not the reminder-types
* screen, which no longer configures channels since v1.25.7).
* - M3: a failed load renders the shared `QueryErrorCard` with a Retry,
* never a bare alert box; the loading frame reserves a skeleton.
* - L1: the globally-disabled hint reads as a full sentence, not the bare
* "(Disabled)" inline tag.
* - M7: the page cross-links the other two notification surfaces.
*/
type AuthState = { isAuthenticated: boolean; isLoading: boolean };
type QueryState = {
data: unknown;
isLoading: boolean;
isError: boolean;
};
let authState: AuthState = { isAuthenticated: true, isLoading: false };
let queryState: QueryState = {
data: undefined,
isLoading: false,
isError: false,
};
vi.mock("@/hooks/use-auth", () => ({
useAuth: () => authState,
}));
vi.mock("@tanstack/react-query", () => ({
useQuery: () => ({ ...queryState, refetch: vi.fn() }),
useMutation: () => ({ mutate: vi.fn(), isPending: false }),
useQueryClient: () => ({
cancelQueries: vi.fn(),
getQueryData: vi.fn(),
setQueryData: vi.fn(),
invalidateQueries: vi.fn(),
}),
}));
import NotificationsPage from "../page";
function render() {
return renderToStaticMarkup(
<I18nProvider initialLocale="en">
<NotificationsPage />
</I18nProvider>,
);
}
beforeEach(() => {
authState = { isAuthenticated: true, isLoading: false };
queryState = { data: undefined, isLoading: false, isError: false };
});
describe("NotificationsPage", () => {
it("M3: renders a skeleton while loading, not a lone spinner", () => {
queryState.isLoading = true;
const html = render();
expect(html).toContain('data-slot="notifications-loading"');
expect(html).not.toContain("animate-spin");
});
it("M3: renders the shared QueryErrorCard with a retry on load failure", () => {
queryState.isError = true;
const html = render();
expect(html).toContain('data-slot="query-error-card"');
expect(html).toContain("Notification preferences could not be loaded.");
});
it("H2 + L4: the no-channels CTA targets Settings → Integrations#channels", () => {
queryState.data = { channels: [], preferences: [], eventTypes: [] };
const html = render();
expect(html).toContain('href="/settings/integrations#channels"');
// The reminder-types screen no longer configures channels — never point there.
expect(html).not.toContain('href="/settings/notifications"><');
expect(html).toContain("Settings → Integrations");
});
it("M7: the matrix cross-links the reminder-types + channels surfaces", () => {
queryState.data = {
channels: [
{
id: "c1",
type: "telegram",
label: "Telegram",
enabled: true,
globallyEnabled: true,
},
],
preferences: [],
eventTypes: ["MEDICATION_REMINDER"],
};
const html = render();
expect(html).toContain('href="/settings/notifications"');
expect(html).toContain('href="/settings/integrations#channels"');
});
it("L1: the globally-disabled hint is a full sentence, not the bare tag", () => {
queryState.data = {
channels: [
{
id: "c1",
type: "telegram",
label: "Telegram",
enabled: true,
globallyEnabled: true,
},
{
id: "c2",
type: "ntfy",
label: "ntfy",
enabled: true,
globallyEnabled: false,
},
],
preferences: [],
eventTypes: ["MEDICATION_REMINDER"],
};
const html = render();
expect(html).toContain("won’t receive notifications");
});
});
+58 -13
View File
@@ -7,8 +7,10 @@ import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
import { PageHeader } from "@/components/ui/page-header";
import { Skeleton } from "@/components/ui/skeleton";
import { QueryErrorCard } from "@/components/ui/query-error-card";
import Link from "next/link";
import { Bell, Loader2, Settings, AlertCircle } from "lucide-react";
import { Bell, Settings, AlertCircle } from "lucide-react";
import {
EVENT_DEFAULT_ENABLED,
type EventType,
@@ -52,7 +54,7 @@ export default function NotificationsPage() {
const { t } = useTranslations();
const queryClient = useQueryClient();
const { data, isLoading, isError } = useQuery({
const { data, isLoading, isError, refetch } = useQuery({
queryKey: queryKeys.notificationsPreferences(),
queryFn: async () => {
return apiGet<PreferencesData>("/api/notifications/preferences");
@@ -119,10 +121,50 @@ export default function NotificationsPage() {
return EVENT_DEFAULT_ENABLED[eventType as EventType] ?? true;
}
// Cross-links to the other two notification surfaces (reminder types +
// delivery channels) so the matrix never reads as the only place to manage
// notifications. Mirrored by back-links on those two settings screens.
const headerActions = (
<>
<Button asChild variant="outline" size="sm">
<Link href="/settings/notifications">
{t("notifications.reminderSettingsLink")}
</Link>
</Button>
<Button asChild variant="outline" size="sm">
<Link href="/settings/integrations#channels">
{t("notifications.channelsLink")}
</Link>
</Button>
</>
);
if (authLoading || isLoading) {
return (
<div className="flex items-center justify-center py-20">
<Loader2 className="text-primary h-6 w-6 animate-spin motion-reduce:animate-none" />
<div className="space-y-6">
<PageHeader
title={t("notifications.title")}
description={t("notifications.subtitle")}
/>
{/* Skeleton mirrors the event-row matrix so the auth-resolving frame
reserves layout instead of flashing a lone spinner. */}
<div
data-slot="notifications-loading"
className="bg-card border-border overflow-hidden rounded-xl border"
>
{[0, 1, 2, 3, 4].map((i) => (
<div
key={i}
className="border-border flex items-center justify-between gap-4 border-b p-4 last:border-b-0"
>
<div className="min-w-0 flex-1 space-y-2">
<Skeleton className="h-4 w-40 rounded" />
<Skeleton className="h-3 w-56 rounded" />
</div>
<Skeleton className="h-5 w-9 shrink-0 rounded-full" />
</div>
))}
</div>
</div>
);
}
@@ -149,12 +191,10 @@ export default function NotificationsPage() {
title={t("notifications.title")}
description={t("notifications.subtitle")}
/>
<div
role="alert"
className="border-destructive/40 bg-destructive/10 text-destructive rounded-lg border p-4 text-sm"
>
{t("notifications.loadError")}
</div>
<QueryErrorCard
description={t("notifications.loadError")}
onRetry={() => refetch()}
/>
</div>
);
}
@@ -166,6 +206,7 @@ export default function NotificationsPage() {
<PageHeader
title={t("notifications.title")}
description={t("notifications.subtitle")}
actions={headerActions}
/>
<div className="bg-card border-border max-w-2xl rounded-xl border p-6">
<div className="flex flex-col items-center gap-4 py-8 text-center">
@@ -173,8 +214,10 @@ export default function NotificationsPage() {
<p className="text-muted-foreground text-sm">
{t("notifications.noChannels")}
</p>
{/* Channel setup lives in Settings → Integrations since v1.25.7;
point the CTA at that anchor, not the reminder-types screen. */}
<Button asChild variant="outline">
<Link href="/settings/notifications">
<Link href="/settings/integrations#channels">
<Settings className="h-4 w-4" />
{t("notifications.goToSettings")}
</Link>
@@ -190,6 +233,7 @@ export default function NotificationsPage() {
<PageHeader
title={t("notifications.title")}
description={t("notifications.subtitle")}
actions={headerActions}
/>
{/* Desktop: table layout */}
@@ -321,12 +365,13 @@ export default function NotificationsPage() {
})}
</div>
{/* Info hint about disabled channels */}
{/* Info hint about globally-disabled channels — a full sentence that
explains the state, not the bare "(Disabled)" inline tag. */}
{channels.some((ch) => !ch.globallyEnabled) && (
<div className="flex items-start gap-2 rounded-lg p-3 text-sm">
<AlertCircle className="text-muted-foreground mt-0.5 h-4 w-4 shrink-0" />
<p className="text-muted-foreground">
{t("notifications.channelDisabled")}
{t("notifications.someChannelsGloballyDisabled")}
</p>
</div>
)}
+61 -18
View File
@@ -25,6 +25,7 @@ import {
} from "@/lib/dashboard-layout";
import type { DashboardAnalyticsData as AnalyticsData } from "@/types/analytics";
import dynamic from "next/dynamic";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
import { ChartErrorBoundary } from "@/components/charts/chart-error-state";
@@ -131,6 +132,30 @@ import {
resolveChartRowPlaceholderCount,
} from "@/components/dashboard/dashboard-gates";
/**
* Dashboard metric tiles are no longer dead-ends: each tile links to its
* Insights detail page (bands, correlations, history). Keyed by the stable
* tile `id` used in the `trendCards` builder; glucose contexts share one
* blood-glucose destination via the `glucose-` prefix. Tiles with no
* dedicated sub-page (body fat %) stay un-linked rather than misroute.
*/
const TILE_INSIGHT_HREF: Record<string, string> = {
weight: "/insights/weight",
"bp-sys": "/insights/blood-pressure",
"bp-dia": "/insights/blood-pressure",
bpInTarget: "/insights/blood-pressure",
pulse: "/insights/pulse",
mood: "/insights/mood",
sleep: "/insights/sleep",
steps: "/insights/steps",
vo2Max: "/insights/cardio-fitness",
};
function tileInsightHref(id: string): string | null {
if (id.startsWith("glucose-")) return "/insights/blood-glucose";
return TILE_INSIGHT_HREF[id] ?? null;
}
export default function DashboardPageClient() {
const { isAuthenticated, user } = useAuth();
const mounted = useMounted();
@@ -1611,27 +1636,45 @@ export default function DashboardPageClient() {
data-tour-id="dashboard-tile-strip"
data-tile-count={trendCards.length}
>
{trendCards.map((entry) => (
<div key={entry.id} className="flex min-w-0">
{/*
* Per-tile `<Suspense>` boundary with a layout-stable
* placeholder that mirrors the trend-card chrome. Tile
* bodies are synchronous today so the fallback rarely
* paints, but a future RSC hoist of any tile slot
* would otherwise leave the grid track empty and
* trigger CLS as the cell paints in.
*
* v1.4.40 W-RSC — boundary added; v1.4.41 W-FRONTEND-FACTORY — fallback hoisted to layout-stable placeholder.
*/}
{/* v1.16.0 — the fallback is the same structured
silhouette the tile-strip skeleton paints, so a
suspending tile slot previews the final shape
instead of an empty card. */}
{trendCards.map((entry) => {
/*
* Per-tile `<Suspense>` boundary with a layout-stable
* placeholder that mirrors the trend-card chrome. Tile
* bodies are synchronous today so the fallback rarely
* paints, but a future RSC hoist of any tile slot
* would otherwise leave the grid track empty and
* trigger CLS as the cell paints in.
*
* v1.16.0 — the fallback is the same structured
* silhouette the tile-strip skeleton paints, so a
* suspending tile slot previews the final shape
* instead of an empty card.
*/
const cell = (
<Suspense fallback={<TrendCardSkeleton />}>
{entry.node}
</Suspense>
</div>
))}
);
// A tile is no longer a dead-end: it links to its Insights
// detail page. The link fills the grid cell and paints a
// ring on hover / focus so the whole tile reads as tappable.
const href = tileInsightHref(entry.id);
return href ? (
<Link
key={entry.id}
href={href}
data-slot="dashboard-tile-link"
data-tile-id={entry.id}
className="group focus-visible:ring-ring/50 hover:ring-ring/30 flex min-w-0 rounded-xl transition-[box-shadow] hover:ring-2 focus-visible:ring-2 focus-visible:outline-none"
>
{cell}
</Link>
) : (
<div key={entry.id} className="flex min-w-0">
{cell}
</div>
);
})}
</div>
)}
{charts.map((entry) => (