'use client'; import { VscodeFileIcon } from '@/app/components/vscodeFileIcon'; import { ScrollArea } from '@/components/ui/scroll-area'; import { cn } from '@/lib/utils'; import { ChevronDown, ChevronRight, Loader2 } from 'lucide-react'; import Link from 'next/link'; import React from 'react'; import { getBrowsePath } from "@/app/[domain]/browse/hooks/utils"; import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants"; export const FileListItem = ({ path, repoName, }: { path: string, repoName: string, }) => { return (
{path}
) } export const TreeList = ({ children }: { children: React.ReactNode }) => { const childrenArray = React.Children.toArray(children); return ( {/* vertical line */}
0 ? `${100 / childrenArray.length * 0.6}%` : '0' }} /> {childrenArray.map((child, index) => { const isLast = index === childrenArray.length - 1; return (
{!isLast && (
)} {isLast && (
)}
{child}
) })} ); }; interface ToolHeaderProps { isLoading: boolean; isError: boolean; isExpanded: boolean; label: React.ReactNode; Icon: React.ElementType; onExpand: (isExpanded: boolean) => void; className?: string; } export const ToolHeader = ({ isLoading, isError, isExpanded, label, Icon, onExpand, className }: ToolHeaderProps) => { return (
{ onExpand(!isExpanded) }} onKeyDown={(e) => { if (e.key !== "Enter") { return; } onExpand(!isExpanded); }} > {isLoading ? ( ) : ( )} {label} {!isLoading && (
{isExpanded ? ( ) : ( )}
)}
) }