'use client' import { useState } from 'react' import { Check, ChevronDown, ChevronRight, Copy, Files, Trash2 } from 'lucide-react' import type { AdvisorThread } from './useAdvisorCase' import { formatCaseForCopy, formatThreadForCopy } from '@/lib/sdk/advisor/copy' import { useClipboard } from './useClipboard' function IconBtn({ title, onClick, children, }: { title: string onClick: () => void children: React.ReactNode }) { return ( ) } /** * Left-menu topic tree: each thread's first question is the Thema; follow-ups nest underneath and * expand/collapse. Per row: copy (single Q&A) + delete; per topic: copy the whole thread. */ export function ThreadMenu({ threads, activeCaseId, onSelectCase, onRemove, }: { threads: AdvisorThread[] activeCaseId: string | null onSelectCase: (id: string) => void onRemove: (id: string) => void }) { const { copiedKey, copy } = useClipboard() const [collapsed, setCollapsed] = useState>({}) const ic = 'h-3.5 w-3.5' return (
Themen
{threads.map((t) => { const first = t.cases[0] const followups = t.cases.slice(1) const open = !collapsed[t.id] const activeInThread = t.cases.some((c) => c.id === activeCaseId) return (
{followups.length > 0 ? ( ) : ( )}
copy(`thread:${t.id}`, formatThreadForCopy(t.title, t.cases))}> {copiedKey === `thread:${t.id}` ? : } copy(`case:${first.id}`, formatCaseForCopy(first))}> {copiedKey === `case:${first.id}` ? : } onRemove(first.id)}>
{open && followups.map((c) => (
copy(`case:${c.id}`, formatCaseForCopy(c))}> {copiedKey === `case:${c.id}` ? : } onRemove(c.id)}>
))}
) })}
) }