"use client"; import { useState } from "react"; import { Copy, Check, ExternalLink } from "lucide-react"; import { cn } from "@/lib/utils"; interface FileBreadcrumbProps { path: string; className?: string; } export function FileBreadcrumb({ path, className }: FileBreadcrumbProps) { const [copied, setCopied] = useState(false); const segments = path.split("/").filter(Boolean); const isAbsolute = path.startsWith("/"); const handleCopy = async () => { await navigator.clipboard.writeText(path); setCopied(true); setTimeout(() => setCopied(false), 1500); }; const openInVSCode = () => { window.open(`vscode://file${isAbsolute ? path : `/${path}`}`); }; return (
{/* Segments */}
{isAbsolute && ( / )} {segments.map((seg, i) => ( {i > 0 && /} {seg} ))}
{/* Actions */}
); }