import { type KeyboardEvent, type MouseEvent } from "react"; import { Shield } from "lucide-react"; import { DashboardSection } from "./DashboardSection"; import { DashboardEmptyState } from "./DashboardEmptyState"; import { Markdown } from "@/components/atoms/Markdown"; import type { ActivityEventRead } from "@/api/generated/model"; export type ActivityEvent = ActivityEventRead; interface RecentActivitySectionProps { events: ActivityEvent[]; feedHref: string; onRowClick: (e: MouseEvent, href: string) => void; onRowKeyDown: (e: KeyboardEvent, href: string) => void; buildHref: (event: ActivityEvent) => string; formatRelative: (ts: string) => string; formatTimestamp: (ts: string) => string; } export function RecentActivitySection({ events, feedHref, onRowClick, onRowKeyDown, buildHref, formatRelative, formatTimestamp, }: RecentActivitySectionProps) { return (
{events.length > 0 ? ( events.map((event) => { const href = buildHref(event); return (
onRowClick(e, href)} onKeyDown={(e) => onRowKeyDown(e, href)} className="cursor-pointer overflow-hidden rounded-lg border border-[color:var(--border)] bg-[color:var(--surface-muted)] px-3 py-2 transition hover:border-[color:var(--border-strong)] hover:bg-[color:var(--surface-strong)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--accent)]" >

{event.event_type}

{formatRelative(event.created_at)}

{formatTimestamp(event.created_at)}

); }) ) : ( } message="No activity yet" sub="Activity appears here when events are emitted." /> )}
); }