chore(settings): retire the unused IntegrationStatusPill

Three status pills paint a connection state: HealthBadge on the shared
integration card, the notification channel badge, and
IntegrationStatusPill. The first two describe different state models
and stay. The third had no production caller since the integration
cards moved to HealthBadge; it goes with its test and the nine strings
only it used. formatRelative, which two cards still import, moves to its
own module.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 13:53:51 +02:00
1 parent cc190c4710
commit 3bae93256d
15 files changed
+32 -616

No files matched your search

@@ -14,7 +14,7 @@ import Link from "next/link";
import { useQuery } from "@tanstack/react-query";
import { HeartPulse, Upload } from "lucide-react";
import { formatRelative } from "@/components/settings/integration-status-pill";
import { formatRelative } from "./format-relative";
import { Button } from "@/components/ui/button";
import { QueryErrorRow } from "@/components/ui/query-error-row";
import { apiGet } from "@/lib/api/api-fetch";
@@ -0,0 +1,21 @@
/**
* "just now" / "12 min ago" / "3 h ago" / "2 days ago" for a sync or arrival
* age in milliseconds. Used by the Apple Health card and the per-metric
* freshness list; it outlived the status pill it was written for.
*/
export function formatRelative(
deltaMs: number,
t: (key: string, params?: Record<string, string | number>) => string,
): string {
if (deltaMs < 60_000) return t("settings.integrationPill.justNow");
const minutes = Math.floor(deltaMs / 60_000);
if (minutes < 60) {
return t("settings.integrationPill.minutesAgo", { count: minutes });
}
const hours = Math.floor(minutes / 60);
if (hours < 24) {
return t("settings.integrationPill.hoursAgo", { count: hours });
}
const days = Math.floor(hours / 24);
return t("settings.integrationPill.daysAgo", { count: days });
}
@@ -22,7 +22,7 @@
import type { ReactNode } from "react";
import { AlertTriangle } from "lucide-react";
import { formatRelative } from "@/components/settings/integration-status-pill";
import { formatRelative } from "./format-relative";
import { MEASUREMENT_TYPE_LABEL_KEYS } from "@/components/measurements/measurement-list-meta";
import { useTranslations } from "@/lib/i18n/context";
import type { MetricFreshnessEntry } from "@/lib/integrations/sync-verdict";