import { Form, Link } from "react-router"; import { useTranslation } from "react-i18next"; import { FeatherCalendarClock, FeatherPlus } from "@subframe/core"; import type { CalendarConnectionListVM } from "@hivegrid/view-models"; import { Alert } from "~/ui/components/Alert"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { EmptyState } from "~/ui/components/EmptyState"; import { Table } from "~/ui/components/Table"; import { useLocaleFormatters } from "~/locale/format"; import { PageBackLink, PageIntro } from "../shared/PageShell"; import { PageHeader, statusBadgeTone } from "../automation/automationUi"; /** * AK-P16a · interim calendar-connections settings screen (AD-28, archetype A6). * Renders the server-built CalendarConnectionListVM; the Google connect action * stays a plain POST (`intent=connect`) owned by the route. Final Subframe * optics follow David's D-P16 delta (design-nachzug). */ export interface CalendarConnectionsPageProps { vm: CalendarConnectionListVM; csrf: string | null; /** Path back to the integrations catalog (settings/integrations). */ backHref: string; /** Inside the Erweiterungen hub (AK-SET-01) the hub owns the header. */ embedded?: boolean; } export function CalendarConnectionsPage({ vm, csrf, backHref, embedded = false }: CalendarConnectionsPageProps): React.JSX.Element { const { t } = useTranslation(); const formatters = useLocaleFormatters(); if (vm.status !== "ready" || !vm.data) { return
; } const { rows, canConnect, isConfigured, emptyHeadlineKey, emptyBodyKey, notConfiguredKey } = vm.data; const errored = rows.filter((row) => row.status === "error"); // AK-SET-01: hoisted so the connect button survives in both the standalone // header and the hub's intro row. const connectAction = canConnect && isConfigured ? ( ) : undefined; return (