"use client"; import { useEffect } from "react"; import { Layers, X } from "lucide-react"; import { useTranslation } from "react-i18next"; import NotebookSelector from "@/components/notebook/NotebookSelector"; import { useNotebookSelection } from "@/components/notebook/useNotebookSelection"; import type { SelectedRecord } from "@/lib/notebook-selection-types"; interface NotebookRecordPickerProps { open: boolean; onClose: () => void; onApply: (records: SelectedRecord[]) => void; actionLabel?: string; } export default function NotebookRecordPicker({ open, onClose, onApply, actionLabel = "Use Selected Records ({n})", }: NotebookRecordPickerProps) { const { t } = useTranslation(); const { notebooks, expandedNotebooks, notebookRecordsMap, selectedRecords, loadingNotebooks, loadingRecordsFor, fetchNotebooks, toggleNotebookExpanded, toggleRecordSelection, selectAllFromNotebook, deselectAllFromNotebook, clearAllSelections, } = useNotebookSelection(); useEffect(() => { if (!open) return; void fetchNotebooks(); }, [fetchNotebooks, open]); if (!open) return null; return (
{t("Choose records across one or more notebooks to ground the next request.")}