import "./components/ui/tidal.css"; import { useState, type MouseEvent } from "react"; import { TidalFooterWorkspace, type TidalFooterWorkspaceLink, type TidalFooterWorkspaceOption, type TidalFooterWorkspaceSignOutState } from "./components/ui/footer-workspace"; import "./components/ui/footer-workspace.css"; import "./components/ui/native-select.css"; import "./components/ui/status-badge.css"; const tidalExampleStyles = ".tidal-scope .footer-pilot-07-demo {\n inline-size: 100%;\n min-inline-size: 0;\n}"; const workspaces: readonly TidalFooterWorkspaceOption[] = [ { id: "northstar", label: "Northstar studio", role: "Administrator", status: "success", statusLabel: "Operational", }, { id: "field-notes", label: "Field notes workspace", role: "Editor", status: "neutral", statusLabel: "Limited access", }, ]; const links: readonly TidalFooterWorkspaceLink[] = [ { id: "account", label: "Account settings", href: "#workspace-account" }, { id: "help", label: "Help center", href: "#workspace-help" }, { id: "privacy", label: "Privacy", href: "#workspace-privacy" }, ]; function handlePreviewClick( label: string, setStatus: (status: string) => void, ) { return (event: MouseEvent) => { if ( event.defaultPrevented || event.button !== 0 || (event.detail !== 0 && event.detail !== 1) || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.currentTarget.target ) { return; } event.preventDefault(); setStatus(`${label} selected in this local preview.`); }; } export function FooterWorkspaceDemo() { const [activeWorkspaceId, setActiveWorkspaceId] = useState("northstar"); const [signOutState, setSignOutState] = useState("idle"); const [status, setStatus] = useState("No workspace callback has run."); const previewLinks = links.map((link) => ({ ...link, onClick: handlePreviewClick(String(link.label), setStatus), })); return (
TidalUI workspace} heading="Your workspace." description="Manage your workspace and account." identity={{ name: "Alex Morgan", email: "alex@example.test", role: "Workspace administrator", }} workspaces={workspaces} activeWorkspaceId={activeWorkspaceId} onWorkspaceChange={(id) => { setActiveWorkspaceId(id); setStatus(`Workspace change proposed for ${id}.`); }} workspaceDescription="This sample changes the selected workspace locally." accountLinks={previewLinks} onSignOut={() => { setSignOutState("confirmed"); setStatus( "Local preview only. The consumer sign-out callback ran; no session changed.", ); }} signOutLabel="Test sign out" signOutState={signOutState} signOutStatus={ signOutState === "confirmed" ? "Consumer callback completed locally; no auth request was sent." : undefined } status={status} legal={Fictional account. No real session is changed.} />
); } export default function AgentExample() { return (
); }