Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+151
@@ -0,0 +1,151 @@
|
||||
import { useState } from "react";
|
||||
import { Form } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherCalendarClock } from "@subframe/core";
|
||||
import type { CalendarConnectionDetailVM } from "@hivegrid/view-models";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Dialog } from "~/ui/components/Dialog";
|
||||
import { Table } from "~/ui/components/Table";
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { PAGE_HEADER_ICON_CLASS, PageBackLink, PageBody, PageHeader, PageShell } from "../shared/PageShell";
|
||||
import { statusBadgeTone } from "../automation/automationUi";
|
||||
|
||||
/**
|
||||
* AK-P16a · interim calendar-connection detail screen (AD-28, archetype A6+A2):
|
||||
* selected calendars, sync status and the last-50 conflict log in Klartext
|
||||
* (DoD 4). Disconnect confirms via a real Dialog (XS 420) and POSTs the
|
||||
* existing `intent=disconnect` action. Final Subframe optics follow David's
|
||||
* D-P16 delta (design-nachzug).
|
||||
*/
|
||||
|
||||
export interface CalendarConnectionDetailPageProps {
|
||||
vm: CalendarConnectionDetailVM;
|
||||
csrf: string | null;
|
||||
backHref: string;
|
||||
}
|
||||
|
||||
export function CalendarConnectionDetailPage({ vm, csrf, backHref }: CalendarConnectionDetailPageProps): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const formatters = useLocaleFormatters();
|
||||
const [confirmingDisconnect, setConfirmingDisconnect] = useState(false);
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <PageShell uiId="ui.calendar.detail" />;
|
||||
}
|
||||
const { externalAccountEmail, status, statusKey, syncDirection, lastSyncAt, lastErrorText, selectedCalendars, conflicts, conflictsEmptyKey, canManage } = vm.data;
|
||||
|
||||
return (
|
||||
<PageShell uiId="ui.calendar.detail">
|
||||
<PageHeader
|
||||
icon={<FeatherCalendarClock className={PAGE_HEADER_ICON_CLASS} />}
|
||||
title={externalAccountEmail}
|
||||
subtitle={`${t(`calendar.connection.direction.${syncDirection}`)} · ${
|
||||
lastSyncAt ? t("calendar.detail.lastSyncAt", { value: formatters.dateTime(lastSyncAt) }) : t("calendar.detail.neverSynced")
|
||||
}`}
|
||||
actions={
|
||||
<>
|
||||
<span data-status={status}>
|
||||
<BadgeFeedback farbe={statusBadgeTone(status)}>{t(statusKey)}</BadgeFeedback>
|
||||
</span>
|
||||
{canManage ? (
|
||||
<Button variant="destructive" onClick={() => setConfirmingDisconnect(true)} data-ui-id="ui.calendar.detail.disconnect">
|
||||
{t("calendar.detail.disconnect")}
|
||||
</Button>
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<PageBody>
|
||||
<PageBackLink to={backHref} label={t("calendar.detail.back")} uiId="ui.calendar.detail.back" />
|
||||
|
||||
{/* Re-connect banner on a broken connection (hierarchy §8). */}
|
||||
{status === "error" && lastErrorText ? <Alert variant="error" title={t("calendar.detail.errorBanner")} description={lastErrorText} /> : null}
|
||||
|
||||
<div className="flex w-full flex-col gap-2 rounded-lg border border-solid border-border-default bg-surface-neutral-primary p-4" data-ui-id="ui.calendar.detail.calendars">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{t("calendar.detail.calendarsHeading")}</span>
|
||||
{selectedCalendars.length === 0 ? (
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t("calendar.detail.noCalendars")}</span>
|
||||
) : (
|
||||
<ul className="flex w-full flex-col gap-1">
|
||||
{selectedCalendars.map((cal) => (
|
||||
<li key={cal.externalCalendarId} className="flex items-center gap-2" data-row-id={cal.externalCalendarId}>
|
||||
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">{cal.name}</span>
|
||||
{cal.isPrimary ? (
|
||||
<BadgeFeedback farbe="subtle-information" size="small">
|
||||
{t("calendar.detail.primaryBadge")}
|
||||
</BadgeFeedback>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex w-full flex-col gap-2" data-ui-id="ui.calendar.detail.conflicts">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{t("calendar.detail.conflictsHeading")}</span>
|
||||
{conflicts.length === 0 ? (
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t(conflictsEmptyKey)}</span>
|
||||
) : (
|
||||
<div className="w-full overflow-x-auto rounded-lg border border-solid border-border-default bg-surface-neutral-primary shadow-sm">
|
||||
<Table
|
||||
header={
|
||||
<Table.HeaderRow>
|
||||
<Table.HeaderCell>{t("calendar.detail.conflictTable.occurredAt")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("calendar.detail.conflictTable.description")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("calendar.detail.conflictTable.resolution")}</Table.HeaderCell>
|
||||
</Table.HeaderRow>
|
||||
}
|
||||
>
|
||||
{conflicts.map((conflict) => (
|
||||
<Table.Row key={conflict.id} data-row-id={conflict.id}>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{formatters.dateTime(conflict.occurredAt)}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-primary">{conflict.descriptionText}</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<BadgeFeedback farbe="subtle-neutral" size="small">
|
||||
{t(conflict.resolutionKey)}
|
||||
</BadgeFeedback>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Disconnect confirm (XS 420) — POSTs the route's disconnect intent. */}
|
||||
<Dialog open={confirmingDisconnect} onOpenChange={(open: boolean) => (open ? undefined : setConfirmingDisconnect(false))}>
|
||||
<Dialog.Content className="w-[420px] max-w-[90vw] p-4">
|
||||
<div className="flex w-full flex-col gap-6" data-ui-id="ui.calendar.detail.disconnectConfirm">
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{t("calendar.detail.disconnectConfirm.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("calendar.detail.disconnectConfirm.body")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex w-full items-center justify-end gap-2">
|
||||
<Button variant="tertiary" onClick={() => setConfirmingDisconnect(false)}>
|
||||
{t("shared.cancel")}
|
||||
</Button>
|
||||
<Form method="post">
|
||||
{csrf ? <input type="hidden" name="csrf" value={csrf} /> : null}
|
||||
<input type="hidden" name="intent" value="disconnect" />
|
||||
<Button type="submit" variant="destructive" data-ui-id="ui.calendar.detail.disconnectSubmit">
|
||||
{t("calendar.detail.disconnect")}
|
||||
</Button>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
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 <div className="flex w-full flex-col" data-ui-id="ui.calendar.connections" />;
|
||||
}
|
||||
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 ? (
|
||||
<Form method="post">
|
||||
{csrf ? <input type="hidden" name="csrf" value={csrf} /> : null}
|
||||
<input type="hidden" name="intent" value="connect" />
|
||||
<Button type="submit" icon={<FeatherPlus />} data-ui-id="ui.calendar.connections.connect">
|
||||
{t("calendar.connections.connectButton")}
|
||||
</Button>
|
||||
</Form>
|
||||
) : undefined;
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col" data-ui-id="ui.calendar.connections">
|
||||
{embedded ? null : (
|
||||
<PageHeader
|
||||
icon={<FeatherCalendarClock className="text-heading-3 font-heading-3 text-icon-neutral-secondary" />}
|
||||
title={t("calendar.connections.title")}
|
||||
subtitle={t("calendar.connections.subtitle")}
|
||||
actions={connectAction}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="flex w-full flex-col gap-4 p-6 mobile:p-4">
|
||||
{embedded ? (
|
||||
<div className="mobile:flex-col mobile:items-start flex w-full items-start justify-between gap-4">
|
||||
<PageIntro uiId="ui.calendar.connections.intro">{t("calendar.connections.subtitle")}</PageIntro>
|
||||
{connectAction ? <div className="flex items-center gap-2">{connectAction}</div> : null}
|
||||
</div>
|
||||
) : (
|
||||
<PageBackLink to={backHref} label={t("integrations.connections.back")} uiId="ui.calendar.connections.back" />
|
||||
)}
|
||||
{!isConfigured ? (
|
||||
<div data-ui-id="ui.calendar.connections.notConfigured">
|
||||
<Alert variant="warning" title={t(notConfiguredKey)} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{/* Re-connect banner (hierarchy §8): at least one broken connection. */}
|
||||
{errored.length > 0 ? (
|
||||
<Alert
|
||||
variant="error"
|
||||
title={t("calendar.connections.banner.title", { count: errored.length })}
|
||||
description={errored[0]?.lastErrorText ?? undefined}
|
||||
data-ui-id="ui.calendar.connections.banner"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<div data-ui-id="ui.calendar.connections.empty">
|
||||
<EmptyState outlined fillContainer title={t(emptyHeadlineKey)} body={t(emptyBodyKey)} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full overflow-x-auto rounded-lg border border-solid border-border-default bg-surface-neutral-primary shadow-sm" data-ui-id="ui.calendar.connections.list">
|
||||
<Table
|
||||
header={
|
||||
<Table.HeaderRow>
|
||||
<Table.HeaderCell>{t("calendar.connections.table.account")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("calendar.connections.table.direction")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("calendar.connections.table.lastSync")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("calendar.connections.table.status")}</Table.HeaderCell>
|
||||
</Table.HeaderRow>
|
||||
}
|
||||
>
|
||||
{rows.map((row) => (
|
||||
<Table.Row key={row.id} data-row-id={row.id}>
|
||||
<Table.Cell>
|
||||
<Link
|
||||
to={row.detailHref}
|
||||
className="whitespace-nowrap text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary no-underline hover:text-text-feedback-link-default"
|
||||
>
|
||||
{row.externalAccountEmail}
|
||||
</Link>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">{t(row.syncDirectionKey)}</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{row.lastSyncAt ? formatters.dateTime(row.lastSyncAt) : t("calendar.detail.neverSynced")}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span data-status={row.status}>
|
||||
<BadgeFeedback farbe={statusBadgeTone(row.status)} size="small">
|
||||
{t(row.statusKey)}
|
||||
</BadgeFeedback>
|
||||
</span>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
import { useNavigate } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherCalendarClock, FeatherChevronLeft, FeatherChevronRight } from "@subframe/core";
|
||||
import {
|
||||
addDaysIso,
|
||||
addMonthsIso,
|
||||
buildCalendarMonthGrid,
|
||||
buildCalendarWeekDays,
|
||||
type CalendarDayCell,
|
||||
type CalendarViewEventRow,
|
||||
type CalendarViewVM,
|
||||
} from "@hivegrid/view-models";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { IconButton } from "~/ui/components/IconButton";
|
||||
import { ToggleGroup } from "~/ui/components/ToggleGroup";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { PageHeader } from "../automation/automationUi";
|
||||
|
||||
/**
|
||||
* AK-P16a · interim calendar view (AD-28): bespoke month/week event grid with
|
||||
* per-event source markers (DoD 5), composed from ~/ui primitives. Navigation
|
||||
* is GET-driven (`?view=&anchor=`) so the loader resolves the matching event
|
||||
* window. Final Subframe optics follow David's D-P16 delta (design-nachzug).
|
||||
*/
|
||||
|
||||
export type CalendarViewMode = "month" | "week";
|
||||
|
||||
export interface CalendarViewPageProps {
|
||||
vm: CalendarViewVM;
|
||||
view: CalendarViewMode;
|
||||
/** ISO calendar dates (`YYYY-MM-DD`), resolved by the loader. */
|
||||
anchorIso: string;
|
||||
todayIso: string;
|
||||
}
|
||||
|
||||
const MAX_VISIBLE_EVENTS = 3;
|
||||
|
||||
function viewHref(view: CalendarViewMode, anchorIso: string): string {
|
||||
return `?view=${view}&anchor=${anchorIso}`;
|
||||
}
|
||||
|
||||
function SourceDot({ source }: { source: CalendarViewEventRow["source"] }): React.JSX.Element {
|
||||
return (
|
||||
<span
|
||||
className={
|
||||
source === "hivegrid_internal"
|
||||
? "mt-1 flex h-1.5 w-1.5 flex-none rounded-round bg-surface-feedback-solid-information"
|
||||
: "mt-1 flex h-1.5 w-1.5 flex-none rounded-round bg-neutral-400"
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function DayEvents({ events, compact }: { events: readonly CalendarViewEventRow[]; compact: boolean }): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const formatters = useLocaleFormatters();
|
||||
const visible = compact ? events.slice(0, MAX_VISIBLE_EVENTS) : events;
|
||||
const hidden = events.length - visible.length;
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-1">
|
||||
{visible.map((event) => (
|
||||
<div key={event.id} className="flex w-full items-start gap-1.5" data-row-id={event.id} data-source={event.source} title={t(event.sourceKey)}>
|
||||
<SourceDot source={event.source} />
|
||||
<span className="min-w-0 grow truncate text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-primary">
|
||||
{event.isAllDay ? null : (
|
||||
<span className="text-text-neutral-tertiary">{formatters.date(event.startsAt, { hour: "2-digit", minute: "2-digit" })} </span>
|
||||
)}
|
||||
{event.title || t(event.sourceKey)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
{hidden > 0 ? (
|
||||
<span className="text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary">
|
||||
{t("calendar.view.grid.more", { count: hidden })}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function WeekdayHeader({ days }: { days: readonly CalendarDayCell[] }): React.JSX.Element {
|
||||
const formatters = useLocaleFormatters();
|
||||
return (
|
||||
<div className="grid w-full grid-cols-7 border-b border-solid border-border-default">
|
||||
{days.map((day) => (
|
||||
<span key={day.dateIso} className="px-2 py-2 text-center text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 uppercase tracking-wide text-text-neutral-tertiary">
|
||||
{formatters.date(`${day.dateIso}T12:00:00Z`, { weekday: "short" })}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DayCellBox({ cell, compact }: { cell: CalendarDayCell; compact: boolean }): React.JSX.Element {
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
cell.inAnchorMonth
|
||||
? "flex min-h-[96px] flex-col gap-1 border-b border-r border-solid border-border-default bg-surface-neutral-primary p-2"
|
||||
: "flex min-h-[96px] flex-col gap-1 border-b border-r border-solid border-border-default bg-surface-neutral-secondary p-2"
|
||||
}
|
||||
data-date={cell.dateIso}
|
||||
>
|
||||
<span
|
||||
className={
|
||||
cell.isToday
|
||||
? "flex h-6 w-6 items-center justify-center rounded-round bg-brand-brand-surface-solid-default text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 text-text-neutral-on-solid"
|
||||
: cell.inAnchorMonth
|
||||
? "text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 text-text-neutral-primary"
|
||||
: "text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary"
|
||||
}
|
||||
>
|
||||
{cell.dayOfMonth}
|
||||
</span>
|
||||
<DayEvents events={cell.events} compact={compact} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CalendarViewPage({ vm, view, anchorIso, todayIso }: CalendarViewPageProps): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const formatters = useLocaleFormatters();
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col" data-ui-id="ui.calendar.list" />;
|
||||
}
|
||||
const { events, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
|
||||
const prevAnchor = view === "month" ? addMonthsIso(anchorIso, -1) : addDaysIso(anchorIso, -7);
|
||||
const nextAnchor = view === "month" ? addMonthsIso(anchorIso, 1) : addDaysIso(anchorIso, 7);
|
||||
const weeks = view === "month" ? buildCalendarMonthGrid({ events, anchorIso, todayIso }) : [buildCalendarWeekDays({ events, anchorIso, todayIso })];
|
||||
const rangeLabel =
|
||||
view === "month"
|
||||
? formatters.date(`${anchorIso.slice(0, 7)}-01T12:00:00Z`, { month: "long", year: "numeric" })
|
||||
: `${formatters.date(`${weeks[0]?.[0]?.dateIso}T12:00:00Z`, { day: "2-digit", month: "2-digit" })} – ${formatters.date(`${weeks[0]?.[6]?.dateIso}T12:00:00Z`, { day: "2-digit", month: "2-digit", year: "numeric" })}`;
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col" data-ui-id="ui.calendar.list">
|
||||
<PageHeader
|
||||
icon={<FeatherCalendarClock className="text-heading-3 font-heading-3 text-icon-neutral-secondary" />}
|
||||
title={t("calendar.view.title")}
|
||||
subtitle={t("calendar.view.subtitle")}
|
||||
actions={
|
||||
<>
|
||||
<Button variant="secondary" size="medium" onClick={() => navigate(viewHref(view, todayIso))}>
|
||||
{t("calendar.view.grid.today")}
|
||||
</Button>
|
||||
<IconButton
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
icon={<FeatherChevronLeft />}
|
||||
aria-label={t("calendar.view.grid.prev")}
|
||||
onClick={() => navigate(viewHref(view, prevAnchor))}
|
||||
/>
|
||||
<IconButton
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
icon={<FeatherChevronRight />}
|
||||
aria-label={t("calendar.view.grid.next")}
|
||||
onClick={() => navigate(viewHref(view, nextAnchor))}
|
||||
/>
|
||||
<ToggleGroup
|
||||
value={view}
|
||||
onValueChange={(value: string) => {
|
||||
if (value === "month" || value === "week") navigate(viewHref(value, anchorIso));
|
||||
}}
|
||||
>
|
||||
<ToggleGroup.Item value="month" icon={null} aria-label={t("calendar.view.grid.viewMonth")}>
|
||||
{t("calendar.view.grid.viewMonth")}
|
||||
</ToggleGroup.Item>
|
||||
<ToggleGroup.Item value="week" icon={null} aria-label={t("calendar.view.grid.viewWeek")}>
|
||||
{t("calendar.view.grid.viewWeek")}
|
||||
</ToggleGroup.Item>
|
||||
</ToggleGroup>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="flex w-full flex-col gap-4 p-6 mobile:p-4">
|
||||
<div className="flex w-full flex-wrap items-center justify-between gap-4">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{rangeLabel}</span>
|
||||
<div className="flex flex-wrap items-center gap-2" data-ui-id="ui.calendar.list.legend">
|
||||
<BadgeFeedback farbe="subtle-information" size="small">
|
||||
{t("calendar.source.hivegrid_internal")}
|
||||
</BadgeFeedback>
|
||||
<BadgeFeedback farbe="subtle-neutral" size="small">
|
||||
{t("calendar.source.external_synced")}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* The grid always renders — an empty range shows the calendar plus a slim hint instead of replacing it. */}
|
||||
{events.length === 0 ? (
|
||||
<div data-ui-id="ui.calendar.list.empty" className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{t(emptyHeadlineKey)} — {t(emptyBodyKey)}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="w-full overflow-hidden rounded-lg border border-solid border-border-default" data-ui-id="ui.calendar.list.events">
|
||||
<WeekdayHeader days={weeks[0] ?? []} />
|
||||
<div className="grid w-full grid-cols-7 border-l border-solid border-border-default">
|
||||
{weeks.flat().map((cell) => (
|
||||
<DayCellBox key={cell.dateIso} cell={cell} compact={view === "month"} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user