diff options
| author | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-13 20:10:52 +0000 |
|---|---|---|
| committer | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-13 20:10:52 +0000 |
| commit | 60002e62c933712611c55f116ef4c80deec9e23e (patch) | |
| tree | d45894e0ddff710fe8deffb5c954f400f2276ba6 /frontend | |
| parent | 711452fc3beae15153711cbed5af0f59eb5398f2 (diff) | |
Add copy response button to response toolbar
Adds a clipboard copy button next to the response label that copies
the raw response text. Shows a brief green checkmark on success.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/src/components/Sidebar.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index b73c513..ac48c6f 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -17,7 +17,7 @@ const preprocessLaTeX = (content: string): string => { .replace(/\\\(([\s\S]*?)\\\)/g, (_, math) => `$${math}$`); }; -import { Play, Settings, Info, ChevronLeft, ChevronRight, Maximize2, Edit3, X, Check, FileText, MessageCircle, Send, GripVertical, GitMerge, Trash2, AlertCircle, Loader2, Navigation, Upload, Search, Link, Layers, Eye, EyeOff } from 'lucide-react'; +import { Play, Settings, Info, ChevronLeft, ChevronRight, Maximize2, Edit3, X, Check, FileText, MessageCircle, Send, GripVertical, GitMerge, Trash2, AlertCircle, Loader2, Navigation, Upload, Search, Link, Layers, Eye, EyeOff, Copy, ClipboardCheck } from 'lucide-react'; interface SidebarProps { isOpen: boolean; @@ -56,6 +56,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => { const [isEditing, setIsEditing] = useState(false); const [editedResponse, setEditedResponse] = useState(''); const [rawTextMode, setRawTextMode] = useState(false); + const [copiedResponse, setCopiedResponse] = useState(false); // Summary states const [showSummaryModal, setShowSummaryModal] = useState(false); @@ -1856,6 +1857,17 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => { {selectedNode.data.response && ( <> <button + onClick={() => { + navigator.clipboard.writeText(selectedNode.data.response || ''); + setCopiedResponse(true); + setTimeout(() => setCopiedResponse(false), 1500); + }} + className={`p-1 rounded ${isDark ? 'text-gray-400 hover:bg-gray-700' : 'text-gray-500 hover:bg-gray-200'}`} + title="Copy response" + > + {copiedResponse ? <ClipboardCheck size={14} className="text-green-500" /> : <Copy size={14} />} + </button> + <button onClick={() => setRawTextMode(!rawTextMode)} className={`p-1 rounded ${rawTextMode ? (isDark ? 'bg-blue-900/50 text-blue-400' : 'bg-blue-100 text-blue-600') |
