feat(settings): relabel Export to Export & Import, mount import area, add gated cycle export, slim the health-record card

Relabel the Export section to Export & Import (heading + description,
all six locales; slug unchanged so existing links keep working) and
mount the import area in it. Add a cycle export tile that reuses the
health-record FHIR export with the reproductive section opted in, gated
on cycle tracking being enabled so a non-cycle account never sees it.
Compress the health-record export hero — format and date range share a
row, the practice-name field tightens, and the FHIR note rides the
footer with the generate action — so the card opens denser without
losing any controls. Add the import + cycle i18n keys across all
locales.
This commit is contained in:
Marc-André Bombeck committed 2026-06-07 00:07:53 +02:00
1 parent a4c3dd73bc
commit c7bf62e4d9
9 files changed
+495 -62

No files matched your search

@@ -27,6 +27,9 @@ vi.mock("next/navigation", () => ({
}));
vi.mock("@tanstack/react-query", () => ({
// The cycle-export card and the Apple-Health status poll both call
// `useQuery`; `data: null` keeps the gated cycle card hidden and the
// import poll idle, which is the correct default-render state.
useQuery: () => ({ data: null, isLoading: false, refetch: vi.fn() }),
useQueryClient: () => ({ invalidateQueries: vi.fn() }),
useMutation: () => ({ mutate: vi.fn(), isPending: false }),
@@ -53,11 +56,27 @@ function render(node: React.ReactElement, locale: "en" | "de" = "en") {
describe("<ExportSection> — SSR smoke", () => {
it("renders the section heading + description", () => {
const html = render(<ExportSection />);
expect(html).toContain("Export");
// v1.15.7 — the section was relabelled "Export & Import" (issue #281).
expect(html).toContain("Export &amp; Import");
// Raw key never leaks past i18n.
expect(html).not.toContain("settings.sections.export.");
});
it("mounts the import area below the export options", () => {
const html = render(<ExportSection />);
// R28 — the import surface (issue #281) lives in the same section.
expect(html).toContain('id="settings-section-import-title"');
expect(html).toContain('data-testid="import-card-apple-health"');
expect(html).toContain('data-testid="import-card-json"');
});
it("keeps the gated cycle export hidden when cycle is off", () => {
const html = render(<ExportSection />);
// The mocked `useQuery` returns no prefs, so the gated cycle card
// must not render (fail-closed gate).
expect(html).not.toContain('data-testid="export-card-cycle"');
});
it("mounts the health-record export panel as the page hero", () => {
const html = render(<ExportSection />);
// v1.12 — the health-record export owns the hero treatment.