diff --git a/packages/web/components/templates/article/Notebook.tsx b/packages/web/components/templates/article/Notebook.tsx index ab15b7afc..8c3ac0ff8 100644 --- a/packages/web/components/templates/article/Notebook.tsx +++ b/packages/web/components/templates/article/Notebook.tsx @@ -204,8 +204,6 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element { setNoteText('') }, [noteState, highlights]) - const [tabSelected, setTabSelected] = useState<'note' | 'highlights'>('note') - const [errorSaving, setErrorSaving] = useState(undefined) const [lastChanged, setLastChanged] = useState(undefined) const [lastSaved, setLastSaved] = useState(undefined) diff --git a/packages/web/components/templates/article/PdfArticleContainer.tsx b/packages/web/components/templates/article/PdfArticleContainer.tsx index be65a9583..9beff0387 100644 --- a/packages/web/components/templates/article/PdfArticleContainer.tsx +++ b/packages/web/components/templates/article/PdfArticleContainer.tsx @@ -13,11 +13,15 @@ import { articleReadingProgressMutation } from '../../../lib/networking/mutation import { mergeHighlightMutation } from '../../../lib/networking/mutations/mergeHighlightMutation' import { useCanShareNative } from '../../../lib/hooks/useCanShareNative' import { pspdfKitKey } from '../../../lib/appConfig' -import { NotebookModal } from './NotebookModal' import { HighlightNoteModal } from './HighlightNoteModal' import { showErrorToast } from '../../../lib/toastHelpers' import { HEADER_HEIGHT } from '../homeFeed/HeaderSpacer' import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery' +import SlidingPane from 'react-sliding-pane' +import 'react-sliding-pane/dist/react-sliding-pane.css' +import { NotebookContent } from './Notebook' +import { NotebookHeader } from './NotebookHeader' +import useWindowDimensions from '../../../lib/hooks/useGetWindowDimensions' export type PdfArticleContainerProps = { viewer: UserBasicData @@ -30,14 +34,12 @@ export default function PdfArticleContainer( props: PdfArticleContainerProps ): JSX.Element { const containerRef = useRef(null) - const [shareTarget, setShareTarget] = useState( - undefined - ) + const [shareTarget, setShareTarget] = + useState(undefined) const [notebookKey, setNotebookKey] = useState(uuidv4()) const [noteTarget, setNoteTarget] = useState(undefined) - const [noteTargetPageIndex, setNoteTargetPageIndex] = useState< - number | undefined - >(undefined) + const [noteTargetPageIndex, setNoteTargetPageIndex] = + useState(undefined) const highlightsRef = useRef([]) const canShareNative = useCanShareNative() @@ -475,6 +477,8 @@ export default function PdfArticleContainer( // the PSPDFKit instance if the theme, article URL, or page URL changes. Everything else // should be handled by the PSPDFKit instance callbacks. + const windowDimensions = useWindowDimensions() + return ( )} - {props.showHighlightsModal && ( - { - console.log( - 'closed PDF notebook: ', - updatedHighlights, - deletedHighlights - ) - deletedHighlights.forEach((highlight) => { - const event = new CustomEvent('deleteHighlightbyId', { - detail: highlight.id, + { + props.setShowHighlightsModal(false) + }} + > + <> + + { + const event = new CustomEvent('scrollToHighlightId', { + detail: highlightId, }) document.dispatchEvent(event) - }) - props.setShowHighlightsModal(false) - }} - viewHighlightInReader={(highlightId) => { - const event = new CustomEvent('scrollToHighlightId', { - detail: highlightId, - }) - document.dispatchEvent(event) - props.setShowHighlightsModal(false) - }} - /> - )} + }} + /> + + ) }