#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import { useState } from "react";
import { useFilesModalContext } from "@editor/contexts/FilesModalContext";
import { LibraryFilePicker } from "@editor/components/filesPage/LibraryFilePicker";
import { LibraryPickerModal } from "@editor/components/filesPage/LibraryPickerModal";
interface FileManagerProps {
selectedTool?: { supportedFormats?: string[] } | null;
}
/** Unmounting discards tentative selections; file ingestion remains owned by FilesModalContext. */
export default function FileManager({ selectedTool }: FileManagerProps) {
const { isFilesModalOpen, closeFilesModal, supportedFormats } =
useFilesModalContext();
const [busy, setBusy] = useState(false);
const [externalPickerOpen, setExternalPickerOpen] = useState(false);
return (
<LibraryPickerModal
opened={isFilesModalOpen}
onClose={closeFilesModal}
busy={busy}
externalPickerOpen={externalPickerOpen}
>
{isFilesModalOpen && (
<LibraryFilePicker
supportedFormats={supportedFormats ?? selectedTool?.supportedFormats}
onBusyChange={setBusy}
onExternalPickerChange={setExternalPickerOpen}
/>
)}
</LibraryPickerModal>
);
}