"use client"; import "./components/ui/tidal.css"; import { useRef, useState } from "react"; import { TidalSavedViewManager, type TidalSavedView } from "./components/ui/saved-view-manager"; import "./components/ui/saved-view-manager.css"; import "./components/ui/alert-dialog.css"; const tidalExampleStyles = ".tidal-scope .saved-view-manager-demo {\n display: grid;\n width: 100%;\n max-width: 680px;\n min-width: 0;\n gap: 14px;\n}\n\n.tidal-scope .saved-view-manager-demo > footer {\n display: flex;\n min-width: 0;\n align-items: start;\n justify-content: space-between;\n gap: 12px;\n padding-inline: 2px;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n}\n\n.tidal-scope .saved-view-manager-demo > footer p,\n.tidal-scope .saved-view-manager-demo > footer span {\n min-width: 0;\n margin: 0;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .saved-view-manager-demo > footer p {\n color: var(--t-ink);\n}\n\n@media (max-width: 420px) {\n .tidal-scope .saved-view-manager-demo > footer {\n flex-direction: column;\n }\n}"; const INITIAL_VIEWS: readonly TidalSavedView[] = [ { id: "my-work", name: "My work", description: "Assigned work that needs attention this week.", filterSummary: "Assignee: me · Status: active · Updated: newest first", isDefault: true, }, { id: "launch-readiness", name: "Launch readiness", description: "Open launch tasks across product, support and operations.", filterSummary: "Project: autumn launch · Status: open or blocked", isShared: true, }, { id: "needs-review", name: "Needs review", description: "Recently completed work waiting for a final review.", filterSummary: "Status: review · Completed: past 7 days", }, ]; export function SavedViewManagerDemo() { const [views, setViews] = useState([...INITIAL_VIEWS]); const [currentId, setCurrentId] = useState("my-work"); const [status, setStatus] = useState("My work is selected."); const copyCounter = useRef(1); return (
{ setCurrentId(id); const next = views.find((view) => view.id === id); setStatus(`${next?.name ?? "Saved view"} is selected.`); }} renameAction={{ onRequest: (view, name, event) => { event.preventDefault(); setViews((current) => current.map((item) => item.id === view.id ? { ...item, name } : item, ), ); setStatus(`Renamed the local view to ${name}.`); }, }} duplicateAction={{ onRequest: (view, name, event) => { event.preventDefault(); const id = `${view.id}-copy-${copyCounter.current++}`; setViews((current) => [ ...current, { ...view, id, name, isDefault: false, isShared: false, }, ]); setCurrentId(id); setStatus(`Created the local copy ${name}.`); }, }} defaultAction={{ onChange: (view, next) => { setViews((current) => current.map((item) => ({ ...item, isDefault: next ? item.id === view.id : false, })), ); setStatus( next ? `${view.name} is the local default.` : `${view.name} is no longer the local default.`, ); }, }} sharedAction={{ onChange: (view, next) => { setViews((current) => current.map((item) => item.id === view.id ? { ...item, isShared: next } : item, ), ); setStatus(`${view.name} is now ${next ? "shared" : "private"}.`); }, }} deleteAction={{ onRequest: (view) => { const remaining = views.filter((item) => item.id !== view.id); setViews(remaining); if (currentId === view.id) setCurrentId(remaining[0]?.id ?? null); setStatus(`Removed ${view.name} from this local sample.`); }, }} />

{status}

Local sample only. No views are saved or shared elsewhere.
); } export default function AgentExample() { return (
); }