"use client"; import "./components/ui/tidal.css"; import { useMemo, useState } from "react"; import { CalendarClock, Check, Download, FileText, MessageSquareText } from "lucide-react"; import { TidalActivityTimeline, type TidalActivityEvent, type TidalActivityGroup } from "./components/ui/activity-timeline"; import "./components/ui/activity-timeline.css"; function tidalExampleAvatarDataUri(seed: unknown) { const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI"; const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"]; const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length]; const svg = ``; return `data:image/svg+xml,${encodeURIComponent(svg)}`; } function tidalExampleImageDataUri(label: string) { const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image"; const svg = `${safeLabel}`; return `data:image/svg+xml,${encodeURIComponent(svg)}`; } const tidalExampleStyles = ".tidal-scope .activity-timeline-demo {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n width: 100%;\n max-width: 1120px;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--t-border);\n border-radius: var(--t-radius-card);\n background: var(--t-subtle);\n color: var(--t-ink);\n box-shadow: 0 28px 58px -46px #00000075;\n container-type: inline-size;\n}\n\n.tidal-scope .activity-timeline-demo,\n.tidal-scope .activity-timeline-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .activity-demo-stage {\n min-width: 0;\n padding: 27px;\n background:\n linear-gradient(var(--t-border) 1px, transparent 1px),\n linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n color-mix(in srgb, var(--t-surface) 76%, var(--t-subtle));\n background-size: 24px 24px;\n}\n\n.tidal-scope .activity-demo-filters {\n display: grid;\n grid-template-columns: repeat(4, minmax(0, 1fr));\n gap: 6px;\n margin-bottom: 23px;\n}\n\n.tidal-scope .activity-demo-filters button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--t-border);\n border-radius: var(--t-radius-control);\n background: var(--t-surface);\n color: var(--t-muted);\n font: inherit;\n font-size: 11px;\n font-weight: 600;\n cursor: pointer;\n transition:\n background 160ms,\n color 160ms,\n border-color 160ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .activity-demo-filters button[aria-pressed=\"true\"] {\n border-color: var(--t-ink);\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n.tidal-scope .activity-demo-filters button:hover {\n border-color: var(--t-ink);\n}\n\n.tidal-scope .activity-demo-filters button:active {\n transform: scale(0.98);\n}\n\n.tidal-scope .activity-demo-filters button:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .activity-demo-stage > .tidal-activity {\n max-width: none;\n}\n\n.tidal-scope .activity-demo-status {\n min-height: 17px;\n margin: 17px 0 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.6;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .activity-demo-checklist > strong {\n color: var(--t-ink);\n font-size: 11px;\n}\n\n.tidal-scope .activity-demo-checklist ul,\n.tidal-scope .activity-demo-notes {\n display: grid;\n gap: 5px;\n margin: 8px 0 0;\n padding-inline-start: 17px;\n}\n\n.tidal-scope .activity-demo-file {\n display: flex;\n min-width: 0;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.tidal-scope .activity-demo-file > span,\n.tidal-scope .activity-demo-file > a {\n display: flex;\n min-width: 0;\n align-items: center;\n gap: 8px;\n}\n\n.tidal-scope .activity-demo-file strong,\n.tidal-scope .activity-demo-file small {\n display: block;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .activity-demo-file strong {\n color: var(--t-ink);\n font-size: 11px;\n}\n\n.tidal-scope .activity-demo-file small {\n margin-top: 2px;\n color: var(--t-muted);\n font-size: 11px;\n}\n\n.tidal-scope .activity-demo-file > a {\n min-width: 44px;\n min-height: 44px;\n flex: none;\n justify-content: center;\n padding: 8px 10px;\n border: 1px solid var(--t-border);\n border-radius: 8px;\n color: var(--t-ink);\n font-size: 11px;\n font-weight: 650;\n text-decoration: none;\n}\n\n.tidal-scope .activity-demo-file > a:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .activity-demo-change {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n margin: 0;\n}\n\n.tidal-scope .activity-demo-change > div {\n padding: 9px;\n border: 1px solid var(--t-border);\n border-radius: 8px;\n background: var(--t-surface);\n}\n\n.tidal-scope .activity-demo-change dt {\n color: var(--t-muted);\n font-size: 11px;\n text-transform: uppercase;\n}\n\n.tidal-scope .activity-demo-change dd {\n margin: 4px 0 0;\n color: var(--t-ink);\n font-size: 11px;\n font-weight: 650;\n}\n\n@container (max-width: 760px) {\n .tidal-scope .activity-timeline-demo {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n\n@container (max-width: 500px) {\n\n .tidal-scope .activity-demo-stage {\n padding: 14px;\n background-size: 18px 18px;\n }\n\n .tidal-scope .activity-demo-filters {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n\n .tidal-scope .activity-demo-file {\n align-items: stretch;\n flex-direction: column;\n }\n\n .tidal-scope .activity-demo-file > a {\n width: 100%;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .activity-demo-filters button {\n transition: none;\n transform: none;\n }\n}"; type ActivityKind = "decision" | "file" | "note"; interface SampleEvent extends TidalActivityEvent { kind: ActivityKind; plainTitle: string; } interface SampleGroup extends Omit { events: readonly SampleEvent[]; } const FILTERS: readonly { id: "all" | ActivityKind; label: string }[] = [ { id: "all", label: "All updates" }, { id: "decision", label: "Decisions" }, { id: "file", label: "Files" }, { id: "note", label: "Notes" }, ]; const SAMPLE_GROUPS: readonly SampleGroup[] = [ { id: "today", label: "Today", events: [ { id: "launch-checklist", kind: "decision", plainTitle: "Approved the launch checklist", dateTime: "2026-10-14T10:42:00-05:00", timeLabel: "10:42 AM", title: "Approved the launch checklist", description: "All eight sample tasks are marked ready for the local release plan.", marker: , meta: "Decision", actor: { name: "Mila Santos", detail: "Sample project lead", portrait: ( ), }, details: (
Approved items
  • Final copy reviewed
  • Keyboard paths checked
  • Sample files confirmed
), }, { id: "project-brief", kind: "file", plainTitle: "Uploaded project brief v3", dateTime: "2026-10-14T09:18:00-05:00", timeLabel: "9:18 AM", title: "Uploaded project brief v3", description: "Replaced the fictional project outline with the reviewed sample copy.", marker: , meta: "Text file", actor: { name: "Noah Price", detail: "Sample editor", portrait: ( ), }, details: (
), }, ], }, { id: "yesterday", label: "Yesterday", events: [ { id: "kickoff-date", kind: "decision", plainTitle: "Moved the sample kickoff to October 19", dateTime: "2026-10-13T15:26:00-05:00", timeLabel: "3:26 PM", title: "Moved the sample kickoff to October 19", description: "The connected preview now reflects the revised fictional schedule.", marker: , meta: "Schedule", actor: { name: "Ava Singh", detail: "Sample coordinator", portrait: ( ), }, details: (
Previous
October 17
Updated
October 19
), }, { id: "review-notes", kind: "note", plainTitle: "Added three review notes", dateTime: "2026-10-13T11:05:00-05:00", timeLabel: "11:05 AM", title: "Added three review notes", description: "The notes identify copy, spacing, and keyboard checks in this local sample.", marker: , meta: "3 notes", actor: { name: "Mila Santos", detail: "Sample project lead", portrait: ( ), }, details: (
  1. Clarify the empty-state copy.
  2. Keep all controls at least 44 pixels.
  3. Confirm the reduced-motion final state.
), }, ], }, ]; function findSampleEvent(id: string) { return SAMPLE_GROUPS.flatMap((group) => group.events).find( (event) => event.id === id, ); } export function ActivityTimelineDemo() { const [filter, setFilter] = useState<(typeof FILTERS)[number]["id"]>("all"); const [expandedIds, setExpandedIds] = useState>( () => new Set(["launch-checklist"]), ); const [status, setStatus] = useState( "Showing all four fictional project updates.", ); const visibleGroups = useMemo( () => SAMPLE_GROUPS.map((group) => ({ ...group, events: filter === "all" ? group.events : group.events.filter((event) => event.kind === filter), })), [filter], ); function chooseFilter(nextFilter: (typeof FILTERS)[number]["id"]) { setFilter(nextFilter); const label = FILTERS.find((item) => item.id === nextFilter)?.label; const nextCount = SAMPLE_GROUPS.reduce( (count, group) => count + group.events.filter( (event) => nextFilter === "all" || event.kind === nextFilter, ).length, 0, ); setStatus( `${label} selected. ${nextCount} fictional update${nextCount === 1 ? "" : "s"} shown.`, ); } function toggleEvent(eventId: string, expanded: boolean) { setExpandedIds((current) => { const next = new Set(current); if (expanded) next.add(eventId); else next.delete(eventId); return next; }); const event = findSampleEvent(eventId); setStatus( `${expanded ? "Opened" : "Closed"} details for ${event?.plainTitle ?? "the update"}.`, ); } return (
{FILTERS.map((item) => ( ))}

{status}

); } export default function AgentExample() { return (
); }