"use client"; import { useEffect } from "react"; import { Layers } from "lucide-react"; import { useTranslation } from "react-i18next"; import PickerShell from "@/components/common/PickerShell"; import PickerHeader from "@/components/common/PickerHeader"; 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]); return (
{ onApply(Array.from(selectedRecords.values()) as SelectedRecord[]); onClose(); }} actionLabel={actionLabel} />
); }