feat(integrations): add a Setup-guide doc-link to every integration card

Each integration card now carries the same discreet "Setup guide" link to
its runbook under docs.healthlog.dev/integrations/<provider>, so a user who
is mid-setup always knows where to go. The docs host lives in one shared
constant and the affordance renders identically across all six providers
(WHOOP, Withings, Fitbit, Polar, Oura, Nightscout).
This commit is contained in:
Marc-André Bombeck committed 2026-06-15 00:59:33 +02:00
1 parent 45ccdcb305
commit 001c158203
13 files changed
+303 -6

No files matched your search

@@ -303,4 +303,43 @@ describe("IntegrationsSection — single-status-display contract (A5)", () => {
// Fitbit / Google Health). The moodLog integration was removed.
expect(count(html, 'data-testid="integration-card-divider"')).toBe(3);
});
// v1.17.1 — every integration card carries the same discreet "Setup guide"
// doc-link pointing at its runbook under the single shared docs base. The
// affordance is one family across all six providers.
it("every integration card carries the shared Setup-guide doc-link", () => {
setIntegrationStatus({
threshold: 3,
integrations: [
{
integration: "withings",
state: "connected",
lastSuccessAt: "2026-05-09T18:00:00.000Z",
lastAttemptAt: "2026-05-09T18:00:00.000Z",
lastError: null,
connected: true,
configured: true,
legacyLastSyncedAt: "2026-05-09T18:00:00.000Z",
hasActivityScope: true,
},
],
});
const html = render();
// One setup-guide link per card → six providers.
expect(count(html, 'data-slot="integration-setup-guide"')).toBe(6);
for (const provider of [
"withings",
"whoop",
"fitbit",
"polar",
"oura",
"nightscout",
]) {
expect(html).toContain(`data-testid="${provider}-setup-guide"`);
expect(html).toContain(
`href="https://docs.healthlog.dev/integrations/${provider}"`,
);
}
});
});
@@ -51,6 +51,7 @@ import {
pillStateFor,
type IntegrationStatusViewModel,
} from "./shared";
import { IntegrationSetupGuideLink } from "./setup-guide-link";
export function FitbitCard({
viewModel,
@@ -484,6 +485,8 @@ export function FitbitCard({
{t("settings.fitbitNoCredentials")}
</div>
)}
<IntegrationSetupGuideLink provider="fitbit" />
</div>
</div>
);
@@ -39,6 +39,7 @@ import { useTranslations } from "@/lib/i18n/context";
import { invalidateKeys, measurementDependentKeys, queryKeys } from "@/lib/query-keys";
import { IntegrationErrorMessage } from "./shared";
import { IntegrationSetupGuideLink } from "./setup-guide-link";
interface NightscoutStatus {
connected: boolean;
@@ -366,6 +367,8 @@ export function NightscoutCard({ enabled = true }: { enabled?: boolean }) {
</Link>
</>
)}
<IntegrationSetupGuideLink provider="nightscout" />
</div>
</div>
);
@@ -37,6 +37,7 @@ import { TestConnectionButton } from "@/components/settings/test-connection-butt
import { apiFetchRaw, apiGet, apiPost } from "@/lib/api/api-fetch";
import { useTranslations } from "@/lib/i18n/context";
import { invalidateKeys, measurementDependentKeys } from "@/lib/query-keys";
import { IntegrationSetupGuideLink } from "./setup-guide-link";
export interface OAuthProviderStatus {
connected: boolean;
@@ -398,6 +399,8 @@ export function OAuthProviderCard({
{msg}
</p>
)}
<IntegrationSetupGuideLink provider={provider} />
</div>
</div>
);
@@ -0,0 +1,57 @@
"use client";
/**
* v1.17.1 — shared "Setup guide" doc-link for every Settings → Integrations
* card. Each card paints the same affordance: one discreet, external link to
* the provider's setup runbook ("was eingeben, wo klicken"). Single-sourced
* here so all six cards (WHOOP / Withings / Fitbit / Polar / Oura / Nightscout)
* read as one family and the docs host lives in exactly one place.
*
* The runbooks themselves are authored separately; this link wires the
* destination now so a user who is mid-setup always knows where to go.
*/
import { ExternalLink } from "lucide-react";
import { useTranslations } from "@/lib/i18n/context";
/**
* Base for every provider setup runbook. The provider key is appended as a
* path segment, e.g. `https://docs.healthlog.dev/integrations/whoop`. Kept as
* a single constant so the host never drifts across cards.
*/
export const INTEGRATION_DOCS_BASE =
"https://docs.healthlog.dev/integrations";
export type IntegrationDocsProvider =
| "whoop"
| "withings"
| "fitbit"
| "polar"
| "oura"
| "nightscout";
export function integrationDocsHref(provider: IntegrationDocsProvider): string {
return `${INTEGRATION_DOCS_BASE}/${provider}`;
}
export function IntegrationSetupGuideLink({
provider,
}: {
provider: IntegrationDocsProvider;
}) {
const { t } = useTranslations();
return (
<a
href={integrationDocsHref(provider)}
target="_blank"
rel="noopener noreferrer"
data-testid={`${provider}-setup-guide`}
data-slot="integration-setup-guide"
className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs underline-offset-2 hover:underline"
>
{t("settings.integrationSetupGuide")}
<ExternalLink className="h-3 w-3" aria-hidden="true" />
</a>
);
}
@@ -43,6 +43,7 @@ import {
pillStateFor,
type IntegrationStatusViewModel,
} from "./shared";
import { IntegrationSetupGuideLink } from "./setup-guide-link";
export function WhoopCard({
viewModel,
@@ -456,6 +457,8 @@ export function WhoopCard({
{t("settings.whoopNoCredentials")}
</div>
)}
<IntegrationSetupGuideLink provider="whoop" />
</div>
</div>
);
@@ -36,6 +36,7 @@ import {
pillStateFor,
type IntegrationStatusViewModel,
} from "./shared";
import { IntegrationSetupGuideLink } from "./setup-guide-link";
export function WithingsCard({
viewModel,
@@ -491,6 +492,8 @@ export function WithingsCard({
{t("settings.withingsNoCredentials")}
</div>
)}
<IntegrationSetupGuideLink provider="withings" />
</div>
</div>
);