Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
tsx 116 lines 4.61 KB
Raw
1 import { EyeOff } from 'lucide-react';
2
3 const LOGO_CDN = 'https://logos.composio.dev/api';
4
5 const PAYLOADS: { label: string; lines: [string, string][] }[] = [
6 {
7 label: 'request',
8 lines: [
9 ['recipient_email', '"maya@example.com"'],
10 ['subject', '"Q3 renewal terms"'],
11 ['body', '"Hi Maya, the updated terms are…"'],
12 ],
13 },
14 {
15 label: 'response',
16 lines: [
17 ['id', '"18f2c9a1e4b7"'],
18 ['labelIds', '["SENT"]'],
19 ],
20 },
21 ];
22
23 /**
24 * ZdrLogVisual — a Gmail tool call's execution log as Zero Data Retention
25 * switches on. The request and response dissolve to "not stored" while the
26 * tool, status, and latency stay, mirroring the dashboard's ZDR upgrade screen.
27 * Server component, light/dark via fd-* tokens. The loop is CSS in global.css
28 * (`zdr-log-*`) and holds the ZDR-on state under reduced motion.
29 */
30 export function ZdrLogVisual() {
31 return (
32 <figure className="not-prose my-6">
33 <div
34 aria-hidden="true"
35 className="mx-auto w-full max-w-[420px] overflow-hidden rounded-sm border border-fd-border bg-fd-background font-mono"
36 >
37 {/* tool row */}
38 <div className="flex items-center gap-2 border-b border-fd-border px-3 py-2.5">
39 <span className="flex size-6 shrink-0 items-center justify-center rounded-md bg-white ring-1 ring-fd-border">
40 <img
41 alt=""
42 className="size-[15px] object-contain"
43 draggable={false}
44 src={`${LOGO_CDN}/gmail`}
45 />
46 </span>
47 <code className="truncate text-[12px] font-medium text-fd-foreground">
48 GMAIL_SEND_EMAIL
49 </code>
50 <span className="ml-auto rounded-sm bg-green-500/10 px-1.5 py-0.5 text-[10px] text-green-600 dark:text-green-400">
51 200
52 </span>
53 <span className="text-[10px] text-fd-foreground/45">412 ms</span>
54 </div>
55
56 {/* metadata that ZDR keeps */}
57 <div className="flex gap-1.5 px-3 pt-3 text-[10px] text-fd-foreground/45">
58 <span>production</span>
59 <span>·</span>
60 <span>user_7f3a</span>
61 <span>·</span>
62 <span>just now</span>
63 </div>
64
65 {/* payloads that ZDR drops */}
66 <div className="space-y-3 px-3 pb-3 pt-3">
67 {PAYLOADS.map((payload) => (
68 <div key={payload.label}>
69 <span className="mb-1.5 block text-[9px] uppercase tracking-[0.06em] text-fd-foreground/40">
70 {payload.label}
71 </span>
72 <div className="grid">
73 <div className="zdr-log-payload col-start-1 row-start-1 border border-fd-border bg-fd-card px-2.5 py-2 text-[11px] leading-[18px]">
74 {payload.lines.map(([key, value]) => (
75 <div key={key} className="truncate">
76 <span className="text-fd-foreground/45">{key}: </span>
77 <span className="text-fd-foreground">{value}</span>
78 </div>
79 ))}
80 </div>
81 <div className="zdr-log-not-stored zdr-log-hatch col-start-1 row-start-1 flex items-center justify-center gap-1.5 border border-dashed border-fd-border text-[11px] text-fd-foreground/60">
82 <EyeOff className="size-3.5" />
83 not stored
84 </div>
85 </div>
86 </div>
87 ))}
88 </div>
89
90 {/* the ZDR switch */}
91 <div className="flex items-center gap-2 border-t border-fd-border px-3 py-2.5">
92 <span className="text-[11px] text-fd-foreground">
93 Zero Data Retention
94 </span>
95 <span className="ml-auto grid text-[10px]">
96 <span className="zdr-log-state-off col-start-1 row-start-1 text-right text-fd-foreground/45">
97 off
98 </span>
99 <span className="zdr-log-state-on col-start-1 row-start-1 text-right text-[var(--composio-brand)]">
100 on
101 </span>
102 </span>
103 <span className="relative inline-flex h-4 w-7 shrink-0 items-center rounded-full p-0.5">
104 <span className="zdr-log-state-off absolute inset-0 rounded-full bg-fd-foreground/15" />
105 <span className="zdr-log-state-on absolute inset-0 rounded-full bg-[var(--composio-brand)]" />
106 <span className="zdr-log-thumb relative size-3 rounded-full bg-white shadow-sm" />
107 </span>
108 </div>
109 </div>
110 <figcaption className="mt-3 text-center text-[11px] text-fd-foreground/50">
111 With ZDR on, the log keeps the tool, status, and latency. The request and
112 response are not stored.
113 </figcaption>
114 </figure>
115 );
116 }