import "./components/ui/tidal.css"; import { useState } from "react"; import { TidalRoiCalculator, type TidalRoiInput } from "./components/ui/roi-calculator"; import "./components/ui/roi-calculator.css"; import "./components/ui/number-stepper.css"; const tidalExampleStyles = ".tidal-scope .roi-calculator-demo {\n width: 100%;\n max-width: 940px;\n min-width: 0;\n}\n.roi-calculator-demo .tidal-roi-formula p {\n margin: 6px 0 0;\n}\n@media (max-width: 400px) {\n .roi-calculator-demo .tidal-roi {\n padding: 18px;\n }\n}"; const initial = { people: 8, hours: 3, rate: 45, subscription: 240 }; export const roiInputs: readonly TidalRoiInput[] = [ { id: "people", label: "People using the product", min: 1, max: 500, step: 1, unit: "people", }, { id: "hours", label: "Time saved each week", description: "Per person, based on your own estimate.", min: 0, max: 40, step: 0.5, unit: "hours", }, { id: "rate", label: "Value of one hour", min: 1, max: 500, step: 1, unit: "USD", }, { id: "subscription", label: "Monthly product cost", min: 1, max: 50000, step: 1, unit: "USD", }, ]; export function RoiCalculatorDemo() { const [values, setValues] = useState>(initial); const complete = Object.values(values).every((v) => v !== null); const monthly = complete ? (values.people! * values.hours! * values.rate! * 52) / 12 : null; const net = monthly === null ? null : monthly - values.subscription!; const roi = net === null || !values.subscription || values.subscription <= 0 ? null : (net / values.subscription) * 100; const money = (v: number) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0, }).format(v); return (
setValues((v) => ({ ...v, [id]: value }))} inputProps={(i) => ({ name: i.id })} results={[ { id: "net", label: "Estimated monthly net value", value: net, formatValue: money, description: "Time value less the product cost.", }, { id: "roi", label: "Estimated return on cost", value: roi, formatValue: (v) => `${Math.round(v).toLocaleString("en-US")}%`, }, ]} formula={ <>

Monthly time value = people × weekly hours saved × hourly value × 52 ÷ 12.

Net value = monthly time value − monthly cost. Return = net value ÷ monthly cost × 100.

} disclaimer="Illustrative estimates only. Time saved is not cash earned, and actual results depend on your assumptions." onReset={() => setValues(initial)} />
); } export default function AgentExample() { return (
); }