Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 14:30 UTC
Remove unused CodeTabs component
Sushmithamallesh committed
Jan 22, 2026 at 11:38 UTC
e1739aba59ab607167dade6a786173f9d4b06c23
1 file changed
-110
docs/components/code-tabs.tsx
deleted
-110
@@ -1,110 +0,0 @@
1
-'use client';
2
-
3
-import * as React from 'react';
4
-import { useState, useRef, useEffect } from 'react';
5
-import { Check, Clipboard } from 'lucide-react';
6
-import { cn } from '@/lib/utils';
7
-
8
-function CopyButton({ containerRef }: { containerRef: React.RefObject<HTMLDivElement | null> }) {
9
- const [copied, setCopied] = useState(false);
10
-
11
- const handleCopy = async () => {
12
- if (!containerRef.current) return;
13
- const pre = containerRef.current.querySelector('pre');
14
- if (!pre) return;
15
- const text = pre.textContent || '';
16
- await navigator.clipboard.writeText(text);
17
- setCopied(true);
18
- setTimeout(() => setCopied(false), 2000);
19
- };
20
-
21
- return (
22
- <button
23
- onClick={handleCopy}
24
- className={cn(
25
- 'p-1.5 rounded-md transition-colors',
26
- 'text-fd-muted-foreground hover:text-fd-foreground hover:bg-fd-muted'
27
- )}
28
- aria-label={copied ? 'Copied' : 'Copy code'}
29
- >
30
- {copied ? <Check className="size-4" /> : <Clipboard className="size-4" />}
31
- </button>
32
- );
33
-}
34
-
35
-export interface CodeTabsProps {
36
- children: React.ReactNode;
37
- groupId?: string;
38
- items: string[];
39
- persist?: boolean;
40
-}
41
-
42
-export function CodeTabs({ children, groupId, items, persist }: CodeTabsProps) {
43
- const [activeTab, setActiveTab] = useState(items[0]);
44
- const containerRef = useRef<HTMLDivElement>(null);
45
- const storageKey = persist && groupId ? `code-tabs-${groupId}` : null;
46
-
47
- useEffect(() => {
48
- if (!storageKey) return;
49
- const stored = localStorage.getItem(storageKey);
50
- if (stored && items.map(i => i.toLowerCase()).includes(stored.toLowerCase())) {
51
- setActiveTab(stored);
52
- }
53
- }, [storageKey, items]);
54
-
55
- const handleTabChange = (value: string) => {
56
- setActiveTab(value);
57
- if (storageKey) {
58
- localStorage.setItem(storageKey, value);
59
- }
60
- };
61
-
62
- return (
63
- <div className="my-4 rounded-xl border bg-fd-secondary overflow-hidden">
64
- <div className="flex items-center justify-between border-b px-1">
65
- <div className="flex">
66
- {items.map((item) => {
67
- const isActive = activeTab.toLowerCase() === item.toLowerCase();
68
- return (
69
- <button
70
- key={item}
71
- onClick={() => handleTabChange(item)}
72
- className={cn(
73
- 'px-3 py-2 text-sm font-medium transition-colors relative',
74
- isActive
75
- ? 'text-fd-primary'
76
- : 'text-fd-muted-foreground hover:text-fd-foreground'
77
- )}
78
- >
79
- {item}
80
- {isActive && (
81
- <div className="absolute bottom-0 left-3 right-3 h-0.5 bg-fd-primary" />
82
- )}
83
- </button>
84
- );
85
- })}
86
- </div>
87
- <div className="pr-2">
88
- <CopyButton containerRef={containerRef} />
89
- </div>
90
- </div>
91
-
92
- {/* DEBUG: Just render children directly */}
93
- <div
94
- ref={containerRef}
95
- className="[&_figure]:my-0 [&_figure]:rounded-none [&_figure]:border-0 [&_figure]:bg-transparent [&_pre]:my-0 [&_pre]:rounded-none [&_pre]:border-0 [&_pre]:bg-transparent [&_figure>div:last-child]:hidden"
96
- >
97
- {children}
98
- </div>
99
- </div>
100
- );
101
-}
102
-
103
-export interface CodeTabProps {
104
- children: React.ReactNode;
105
- value: string;
106
-}
107
-
108
-export function CodeTab({ children }: CodeTabProps) {
109
- return <>{children}</>;
110
-}