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 133 lines 6.34 KB
Raw
1 'use client';
2
3 import { useState, useRef, useEffect } from 'react';
4 import Link from 'next/link';
5 import { Bot, FileText, Terminal, Copy, Check, ExternalLink } from 'lucide-react';
6
7 function CopyableCommand({ text }: { text: string }) {
8 const [copied, setCopied] = useState(false);
9 const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);
10
11 useEffect(() => () => { clearTimeout(timerRef.current); }, []);
12
13 return (
14 <button
15 onClick={async () => {
16 try {
17 await navigator.clipboard.writeText(text);
18 clearTimeout(timerRef.current);
19 setCopied(true);
20 timerRef.current = setTimeout(() => setCopied(false), 2000);
21 } catch {
22 // clipboard write failed
23 }
24 }}
25 aria-label={`Copy command: ${text}`}
26 className="flex w-full cursor-pointer items-center gap-2 rounded-lg border border-fd-border bg-fd-background dark:bg-fd-background/50 px-3 py-[7px] font-mono text-[12.5px] text-fd-foreground transition-colors hover:border-[var(--composio-orange)]/40"
27 >
28 <span className="select-none text-fd-muted-foreground/50">$</span>
29 <span className="min-w-0 flex-1 overflow-x-auto text-left whitespace-nowrap">{text}</span>
30 {copied ? (
31 <Check className="h-3.5 w-3.5 shrink-0 text-green-500" />
32 ) : (
33 <Copy className="h-3.5 w-3.5 shrink-0 text-fd-muted-foreground/50" />
34 )}
35 </button>
36 );
37 }
38
39 export function AIToolsBanner() {
40 return (
41 <div className="not-prose relative mt-4 mb-4 sm:mt-6 sm:mb-6 overflow-hidden rounded-xl border border-fd-border bg-fd-card @container">
42 {/* Shader gradient blobs — same as PromptBanner */}
43 <div
44 className="pointer-events-none absolute -left-16 -top-24 h-64 w-64 rounded-full"
45 style={{ background: 'radial-gradient(circle, rgba(0,7,205,0.12) 0%, rgba(0,7,205,0) 70%)' }}
46 />
47 <div
48 className="pointer-events-none absolute right-10 -bottom-20 h-56 w-56 rounded-full"
49 style={{ background: 'radial-gradient(circle, rgba(0,7,205,0.08) 0%, rgba(0,7,205,0) 70%)' }}
50 />
51 <div
52 className="pointer-events-none absolute right-32 -top-16 h-44 w-44 rounded-full"
53 style={{ background: 'radial-gradient(circle, rgba(0,7,205,0.06) 0%, rgba(0,7,205,0) 70%)' }}
54 />
55 <div className="relative flex flex-col gap-3 p-4 sm:px-5 sm:py-4">
56 {/* Header */}
57 <div className="flex items-center gap-2.5">
58 <div className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-[var(--composio-orange)]/10">
59 <Bot aria-hidden="true" className="h-4 w-4 text-[var(--composio-orange)]" />
60 </div>
61 <span className="text-sm font-semibold tracking-tight text-fd-foreground">
62 For AI tools
63 </span>
64 </div>
65
66 {/* Two-column: Skills + CLI */}
67 <div className="flex flex-col gap-3 @2xl:flex-row @2xl:gap-4">
68 {/* Skills */}
69 <div className="flex flex-1 flex-col gap-1">
70 <span className="text-[11px] font-semibold uppercase tracking-[0.08em] text-[var(--composio-orange)]">Skills</span>
71 <CopyableCommand text="npx skills add ComposioHQ/composio --skill composio -y" />
72 <div className="flex items-center gap-2.5 pl-0.5 text-[11px]">
73 <Link
74 href="https://skills.sh/composiohq/composio/composio"
75 target="_blank"
76 rel="noopener noreferrer"
77 className="text-fd-muted-foreground hover:text-[var(--composio-orange)] transition-colors"
78 >
79 Skills.sh
80 <ExternalLink aria-hidden="true" className="ml-1 inline h-2.5 w-2.5" />
81 </Link>
82 <Link
83 href="https://github.com/ComposioHQ/composio/tree/next/skills/composio"
84 target="_blank"
85 rel="noopener noreferrer"
86 className="text-fd-muted-foreground hover:text-[var(--composio-orange)] transition-colors"
87 >
88 GitHub
89 <ExternalLink aria-hidden="true" className="ml-1 inline h-2.5 w-2.5" />
90 </Link>
91 </div>
92 </div>
93
94 {/* CLI */}
95 <div className="flex flex-1 flex-col gap-1">
96 <span className="text-[11px] font-semibold uppercase tracking-[0.08em] text-[var(--composio-orange)]">CLI</span>
97 <CopyableCommand text="curl -fsSL https://composio.dev/install | sh" />
98 <div className="flex items-center gap-2.5 pl-0.5 text-[11px]">
99 <Link
100 href="/docs/cli"
101 className="inline-flex items-center gap-1 text-fd-muted-foreground hover:text-[var(--composio-orange)] transition-colors"
102 >
103 <Terminal aria-hidden="true" className="h-2.5 w-2.5" />
104 CLI Reference
105 </Link>
106 </div>
107 </div>
108 </div>
109
110 {/* Context row */}
111 <div className="flex flex-wrap items-center gap-2.5 border-t border-fd-border pt-3">
112 <span className="text-[11px] font-semibold uppercase tracking-[0.08em] text-[var(--composio-orange)]">Context</span>
113 <Link
114 href="/llms.txt"
115 className="group flex items-center gap-1.5 rounded-lg border border-fd-border bg-fd-background dark:bg-fd-background/30 px-3 py-1.5 transition-all hover:border-[var(--composio-orange)]/40"
116 >
117 <FileText aria-hidden="true" className="h-3.5 w-3.5 shrink-0 text-fd-muted-foreground group-hover:text-[var(--composio-orange)] transition-colors" />
118 <span className="text-[12.5px] font-medium text-fd-foreground">llms.txt</span>
119 <span className="text-[10px] text-fd-muted-foreground">Index</span>
120 </Link>
121 <Link
122 href="/llms-full.txt"
123 className="group flex items-center gap-1.5 rounded-lg border border-fd-border bg-fd-background dark:bg-fd-background/30 px-3 py-1.5 transition-all hover:border-[var(--composio-orange)]/40"
124 >
125 <FileText aria-hidden="true" className="h-3.5 w-3.5 shrink-0 text-fd-muted-foreground group-hover:text-[var(--composio-orange)] transition-colors" />
126 <span className="text-[12.5px] font-medium text-fd-foreground">llms-full.txt</span>
127 <span className="text-[10px] text-fd-muted-foreground">Complete</span>
128 </Link>
129 </div>
130 </div>
131 </div>
132 );
133 }