import "./components/ui/tidal.css"; import { useState, type MouseEvent } from "react"; import { Check, ClipboardCheck, RotateCcw, Settings2 } from "lucide-react"; import { TidalNotificationInbox, type TidalNotificationInboxItem } from "./components/ui/notification-inbox"; import "./components/ui/notification-inbox.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 .notification-inbox-specimen {\n width: 100%;\n max-width: 780px;\n min-width: 0;\n padding: 20px;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-subtle);\n color: var(--t-ink);\n box-shadow: 0 24px 48px -36px #00000048;\n container-type: inline-size;\n}\n\n.tidal-scope .notification-inbox-specimen,\n.tidal-scope .notification-inbox-specimen * {\n box-sizing: border-box;\n}\n\n.tidal-scope .notification-inbox-demo-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n margin-bottom: 13px;\n padding: 0 3px;\n}\n\n.tidal-scope .notification-inbox-demo-header > div {\n min-width: 0;\n}\n\n.tidal-scope .notification-inbox-demo-header span,\n.tidal-scope .notification-inbox-demo-detail > span {\n display: block;\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 600;\n letter-spacing: 0.95px;\n line-height: 1.4;\n}\n\n.tidal-scope .notification-inbox-demo-header strong {\n display: block;\n margin-top: 5px;\n color: var(--t-ink);\n font-size: 12px;\n font-weight: 600;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .notification-inbox-demo-header > button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 7px;\n min-height: 44px;\n flex: none;\n padding: 8px 11px;\n border: 1px solid var(--t-border);\n border-radius: 10px;\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n font-size: 11px;\n cursor: pointer;\n transition:\n background 160ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .notification-inbox-demo-header > button:hover {\n background: var(--t-wash);\n}\n\n.tidal-scope .notification-inbox-demo-header > button:active {\n transform: scale(0.98);\n}\n\n.tidal-scope .notification-inbox-demo-header > button:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 2px;\n}\n\n.tidal-scope .notification-inbox-specimen > .tidal-notification-inbox {\n max-width: none;\n}\n\n.tidal-scope .notification-inbox-demo-footer {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr);\n gap: 12px;\n margin-top: 13px;\n}\n\n.tidal-scope .notification-inbox-demo-detail,\n.tidal-scope .notification-inbox-demo-status {\n min-width: 0;\n margin: 0;\n border: 1px solid var(--t-border);\n border-radius: 11px;\n background: var(--t-surface);\n}\n\n.tidal-scope .notification-inbox-demo-detail {\n padding: 15px 16px;\n scroll-margin-block: 15px;\n}\n\n.tidal-scope .notification-inbox-demo-detail > strong {\n display: block;\n margin-top: 7px;\n color: var(--t-ink);\n font-size: 11px;\n font-weight: 600;\n line-height: 1.45;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .notification-inbox-demo-detail > p,\n.tidal-scope .notification-inbox-demo-status {\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.6;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .notification-inbox-demo-detail > p {\n margin: 5px 0 0;\n}\n\n.tidal-scope .notification-inbox-demo-status {\n display: flex;\n align-items: center;\n padding: 15px 16px;\n}\n\n@container (max-width: 520px) {\n .tidal-scope .notification-inbox-demo-footer {\n grid-template-columns: 1fr;\n }\n}\n\n@media (max-width: 390px) {\n .tidal-scope .notification-inbox-specimen {\n padding: 10px;\n }\n\n .tidal-scope .notification-inbox-demo-header {\n align-items: flex-start;\n flex-direction: column;\n }\n\n .tidal-scope .notification-inbox-demo-header > button {\n width: 100%;\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .tidal-scope .notification-inbox-demo-header,\n .tidal-scope .notification-inbox-demo-footer {\n animation: notification-inbox-demo-enter 420ms var(--t-ease-out) both;\n }\n\n .tidal-scope .notification-inbox-demo-footer {\n animation-delay: 120ms;\n }\n}\n\n@keyframes notification-inbox-demo-enter {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: none;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .notification-inbox-demo-header > button {\n transition-duration: 0.01ms;\n }\n\n .tidal-scope .notification-inbox-demo-header > button:active {\n transform: none;\n }\n}"; const INITIAL_ITEMS = [ { id: "launch-brief", title: "Lena Ortiz assigned the launch brief", description: "Review the final sections before the local sample deadline.", timestamp: "4 min ago", dateTime: "2026-10-14T18:24:00-05:00", category: "Assignment", read: false, avatar: { src: tidalExampleAvatarDataUri("01"), alt: "" }, detail: { label: "View brief", href: "#notification-demo-detail" }, action: { id: "review", label: "Review update" }, }, { id: "website-note", title: "Noah Kim mentioned you in Website notes", description: "The navigation copy is ready for a local review.", timestamp: "18 min ago", dateTime: "2026-10-14T18:10:00-05:00", category: "Mention", read: false, avatar: { src: tidalExampleAvatarDataUri("02"), alt: "" }, detail: { label: "Read note", href: "#notification-demo-detail" }, }, { id: "agenda-file", title: "Casey Morgan added the weekly agenda", description: "A fictional meeting document is listed in this preview.", timestamp: "42 min ago", dateTime: "2026-10-14T17:46:00-05:00", category: "File", read: true, avatar: { src: tidalExampleAvatarDataUri("03"), alt: "" }, detail: { label: "View details", href: "#notification-demo-detail" }, }, { id: "campaign-review", title: "Priya Shah moved Campaign to review", description: "The local board now shows the project in its review column.", timestamp: "1 hr ago", dateTime: "2026-10-14T17:22:00-05:00", category: "Project", read: false, avatar: { src: tidalExampleAvatarDataUri("04"), alt: "" }, detail: { label: "View project", href: "#notification-demo-detail" }, }, { id: "workspace-settings", title: "Workspace settings were updated", description: "Notification preferences changed in this fictional sample.", timestamp: "2 hr ago", dateTime: "2026-10-14T16:12:00-05:00", category: "System", read: true, icon: , detail: { label: "View summary", href: "#notification-demo-detail" }, }, { id: "feedback-request", title: "Jordan Lee requested feedback", description: "Two layout decisions are ready for local review.", timestamp: "Yesterday", dateTime: "2026-10-13T15:35:00-05:00", category: "Review", read: false, avatar: { src: tidalExampleAvatarDataUri("05"), alt: "" }, detail: { label: "View request", href: "#notification-demo-detail" }, action: { id: "review", label: "Review update" }, }, { id: "comment-resolved", title: "Maya Chen resolved three comments", description: "The resolved notes remain available in the local detail view.", timestamp: "Yesterday", dateTime: "2026-10-13T11:08:00-05:00", category: "Comment", read: true, avatar: { src: tidalExampleAvatarDataUri("06"), alt: "" }, detail: { label: "View comments", href: "#notification-demo-detail" }, }, ] satisfies TidalNotificationInboxItem[]; function isPlainPrimaryClick(event: MouseEvent) { return ( event.button === 0 && !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey ); } export function NotificationInboxDemo() { const [items, setItems] = useState(() => INITIAL_ITEMS.map((item) => ({ ...item })), ); const [selectedId, setSelectedId] = useState(INITIAL_ITEMS[0].id); const [handled, setHandled] = useState>(() => new Set()); const [status, setStatus] = useState( "Fictional local updates. No service is connected.", ); const selected = items.find((item) => item.id === selectedId) ?? items[0] ?? null; const displayItems = items.map((item) => ({ ...item, detail: item.detail ? { ...item.detail, linkProps: { onClick: (event: MouseEvent) => { if (!event.defaultPrevented && isPlainPrimaryClick(event)) { event.preventDefault(); setSelectedId(item.id); setStatus(`Showing ${item.title} in the local detail panel.`); } }, }, } : undefined, action: item.action ? { ...item.action, label: handled.has(item.id) ? "Reviewed" : item.action.label, icon: handled.has(item.id) ? ( ) : ( ), buttonProps: { disabled: handled.has(item.id) }, } : undefined, })); function reset() { setItems(INITIAL_ITEMS.map((item) => ({ ...item }))); setSelectedId(INITIAL_ITEMS[0].id); setHandled(new Set()); setStatus("Fictional local updates reset. No service is connected."); } return ( Fictional local updates Reset sample { setItems((current) => current.map((item) => (item.id === id ? { ...item, read } : item)), ); const item = items.find((candidate) => candidate.id === id); setStatus( `${item?.title ?? "Update"} marked ${read ? "read" : "unread"} locally.`, ); }} onMarkAllRead={(ids) => { const idSet = new Set(ids); setItems((current) => current.map((item) => idSet.has(item.id) ? { ...item, read: true } : item, ), ); setStatus( `${ids.length} fictional ${ids.length === 1 ? "update" : "updates"} marked read locally.`, ); }} onAction={(itemId) => { setHandled((current) => new Set(current).add(itemId)); setSelectedId(itemId); setStatus("Review state updated locally. No request was sent."); }} /> SELECTED UPDATE {selected ? ( <> {selected.title} {selected.description} > ) : ( No local update selected. )} {status} ); } export default function AgentExample() { return ( ); }
{selected.description}
No local update selected.
{status}