"use client";
import "./components/ui/tidal.css";
import { useId, useState, type MouseEvent } from "react";
import { TidalCustomerProfile, type TidalCustomerAction } from "./components/ui/customer-profile";
import "./components/ui/customer-profile.css";
import "./components/ui/status-badge.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 = ``;
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}
const tidalExampleStyles = ".tidal-scope .customer-profile-demo {\n display: grid;\n width: 100%;\n max-width: 980px;\n min-width: 0;\n gap: 13px;\n}\n\n.customer-profile-demo-status {\n min-width: 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n text-align: center;\n overflow-wrap: anywhere;\n}";
function isPlainPrimaryClick(event: MouseEvent) {
return (
event.button === 0 &&
!event.metaKey &&
!event.ctrlKey &&
!event.shiftKey &&
!event.altKey
);
}
export function CustomerProfileDemo() {
const generatedId = useId().replace(/:/g, "");
const noteId = `${generatedId}-customer-note`;
const [noteDraft, setNoteDraft] = useState(
"Follow up after the workspace review.",
);
const [savedNote, setSavedNote] = useState(
"The team is reviewing editor access for two new teammates.",
);
const [reviewed, setReviewed] = useState(false);
const [status, setStatus] = useState(
"Fictional local customer record. Changes stay on this page.",
);
const actions: readonly TidalCustomerAction[] = [
{
id: "workspace",
kind: "link",
label: "Open workspace",
href: "#sample-customer-workspace",
linkProps: {
onClick: (event: import("react").MouseEvent) => {
if (!isPlainPrimaryClick(event)) return;
event.preventDefault();
setStatus("Workspace selected in this local sample.");
},
},
},
{
id: "review",
kind: "button",
label: reviewed ? "Clear review" : "Mark for review",
onAction: () => {
setReviewed((current) => !current);
setStatus(
reviewed
? "Review marker cleared locally."
: "Customer marked for local review.",
);
},
},
];
return (
) => {
if (!isPlainPrimaryClick(event)) return;
event.preventDefault();
setStatus("Email destination selected. No message was sent.");
},
},
},
{
id: "phone",
label: "Phone",
value: "+1 555 014 0182",
href: "tel:+15550140182",
linkProps: {
onClick: (event: import("react").MouseEvent) => {
if (!isPlainPrimaryClick(event)) return;
event.preventDefault();
setStatus("Phone destination selected. No call was started.");
},
},
},
]}
fields={[
{ id: "owner", label: "Owner", value: "Mila Chen" },
{ id: "region", label: "Region", value: "Central" },
{ id: "renewal", label: "Review date", value: "November 18" },
]}
actions={actions}
note={{savedNote}
}
noteEditor={
}
activity={[
{
id: "note",
title: "Account note updated",
description: "Editor access is under review.",
actor: "Mila Chen",
time: "Today, 10:24 AM",
dateTime: "2026-10-15T10:24:00-05:00",
},
{
id: "seat",
title: "Seat count changed",
description: "The local record moved from 10 to 12 seats.",
actor: "Noah Reed",
time: "Yesterday",
dateTime: "2026-10-14",
},
{
id: "review",
title: "Workspace review scheduled",
actor: "Leah Kim",
time: "October 8",
dateTime: "2026-10-08",
},
]}
/>
);
}
export default function AgentExample() {
return (
);
}