import { File } from "lucide-react"; import type { FileSearchItem } from "../hooks/useFileMention"; import { getDisplayDirname } from "../utils/pathDisplay"; import "./FileMentionPopup.css"; import type { ReactNode } from "react"; export interface FileMentionPopupProps { visible: boolean; position: { top: number; left: number }; files: FileSearchItem[]; selectedIndex: number; onSelect: (file: FileSearchItem) => void; loading: boolean; } /** * File mention popup component. * Shows a searchable list of files matching the current # mention query. */ export function FileMentionPopup({ visible, position, files, selectedIndex, onSelect, loading, }: FileMentionPopupProps): ReactNode | null { if (!visible) { return null; } return (
{ // Prevent losing focus from textarea when clicking popup e.preventDefault(); }} > {loading && (
)} {!loading && files.length === 0 && (
No files found
)} {!loading && files.length > 0 && ( )}
); }