import React, { FC, useState } from 'react' import { Panel, PanelGroup } from 'react-resizable-panels' import NoSelectionPane from '@/features/ide-react/components/editor/no-selection-pane' import FileView from '@/features/file-view/components/file-view' import MultipleSelectionPane from '@/features/ide-react/components/editor/multiple-selection-pane' import { HorizontalResizeHandle } from '@/features/ide-react/components/resize/horizontal-resize-handle' import { HorizontalToggler } from '@/features/ide-react/components/resize/horizontal-toggler' import { DefaultSynctexControl } from '@/features/pdf-preview/components/detach-synctex-control' import PdfPreview from '@/features/pdf-preview/components/pdf-preview' import { usePdfPane } from '@/features/ide-react/hooks/use-pdf-pane' import { useLayoutContext } from '@/shared/context/layout-context' import { useTranslation } from 'react-i18next' import classNames from 'classnames' import { fileViewFile } from '@/features/ide-react/util/file-view' import { useFileTreeOpenContext } from '@/features/ide-react/context/file-tree-open-context' import { EditorPane } from '@/features/ide-react/components/editor/editor-pane' export const EditorAndPdf: FC = () => { const [resizing, setResizing] = useState(false) const { t } = useTranslation() const { togglePdfPane, handlePdfPaneExpand, handlePdfPaneCollapse, setPdfIsOpen, pdfIsOpen, pdfPanelRef, } = usePdfPane() const { view, pdfLayout } = useLayoutContext() const { selectedEntityCount, openEntity } = useFileTreeOpenContext() const editorIsOpen = view === 'editor' || view === 'file' || pdfLayout === 'sideBySide' return ( {/* main */} {selectedEntityCount === 0 && } {selectedEntityCount === 1 && openEntity?.type === 'fileRef' && ( )} {selectedEntityCount > 1 && ( )} {pdfLayout === 'sideBySide' && (
)}
{/* pdf */} {pdfIsOpen && } {/* ensure that "sync to code" is available in PDF only layout */} {pdfLayout === 'flat' && view === 'pdf' && ( )}
) }