import { File, Hash } from "lucide-react"; import type { FileSearchItem, TaskSearchItem } 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 }; tasks: TaskSearchItem[]; files: FileSearchItem[]; selectedIndex: number; onSelectTask: (task: TaskSearchItem) => void; onSelectFile: (file: FileSearchItem) => void; loading: boolean; } function getTaskRowIndex(taskIndex: number): number { return taskIndex; } function getFileRowIndex(taskCount: number, fileIndex: number): number { return taskCount + fileIndex; } /** * Shared hash-mention popup for chat composers. * Renders grouped task and file matches for the active `#` query. */ export function FileMentionPopup({ visible, position, tasks, files, selectedIndex, onSelectTask, onSelectFile, loading, }: FileMentionPopupProps): ReactNode | null { if (!visible) { return null; } const hasTasks = tasks.length > 0; const hasFiles = files.length > 0; return (