"use client"; import { MessageSquarePlus } from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { toast } from "sonner"; import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarTrigger, useSidebar, } from "@/components/ui/sidebar"; import { useThreadChat } from "@/components/workspace/chats"; import { useI18n } from "@/core/i18n/hooks"; import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages"; import { env } from "@/env"; import { cn } from "@/lib/utils"; import { copyToClipboard } from "@/lib/utils"; export function WorkspaceHeader({ className }: { className?: string }) { const { t } = useI18n(); const { state } = useSidebar(); const pathname = usePathname(); const { threadId } = useThreadChat(); const threadUrl = threadId ? `/workspace/chats/${threadId}` : ""; const handleCopyThreadId = async () => { if (!threadId) return; sendToParent({ type: POST_MESSAGE_TYPES.COPY_TO_CLIPBOARD, text: threadId, }); try { await copyToClipboard(threadId); toast.success(t.clipboard.copiedToClipboard); } catch { toast.error(t.clipboard.failedToCopyToClipboard); } }; return ( <>