import { ListTree } from "lucide-react"; import type { ReactNode } from "react"; import { useTranslation } from "react-i18next"; import CloseIcon from "#/icons/u-close.svg?react"; import { I18nKey } from "#/i18n/declaration"; import { cn } from "#/utils/utils"; interface FileQuickRowProps { /** Open file tabs only (paths the user or agent has opened). */ openPaths: string[]; selectedPath: string | null; onSelectFile: (path: string) => void; onCloseFile: (path: string) => void; /** Whether the left-hand file tree is currently visible. */ isTreeVisible: boolean; /** Toggle the visibility of the left-hand file tree. */ onToggleTree: () => void; /** Trailing actions (e.g. refresh), pinned to the right. */ actions?: ReactNode; } const HIDDEN_SCROLLBAR_CLASSNAME = "[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"; /** * Horizontal strip of open-file tabs. A path only appears after the user or * agent opens it. Overflow scrolls horizontally without a visible scrollbar. */ export function FileQuickRow({ openPaths, selectedPath, onSelectFile, onCloseFile, isTreeVisible, onToggleTree, actions, }: FileQuickRowProps) { const { t } = useTranslation("openhands"); return (
{openPaths.length > 0 ? (
{openPaths.map((path, index) => { const isSelected = selectedPath === path; const fileName = path.split("/").pop() || path; return (
); })}
) : (
)} {actions ? (
{actions}
) : null}
); }