import { ArticleAttributes, } from '../../../lib/networking/library_items/useLibraryItems' import { Box } from '../../elements/LayoutPrimitives' import { useState, useRef } from 'react' import type { Highlight } from '../../../lib/networking/fragments/highlightFragment' import { HighlightNoteModal } from './HighlightNoteModal' import { DEFAULT_HEADER_HEIGHT } from '../homeFeed/HeaderSpacer' import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery' import 'react-sliding-pane/dist/react-sliding-pane.css' import { NotebookContent } from './Notebook' import { NotebookHeader } from './NotebookHeader' import useWindowDimensions from '../../../lib/hooks/useGetWindowDimensions' import { ResizableSidebar } from './ResizableSidebar' export type PdfArticleContainerProps = { viewer: UserBasicData article: ArticleAttributes showHighlightsModal: boolean setShowHighlightsModal: React.Dispatch> } export default function NativePdfArticleContainer( props: PdfArticleContainerProps ): JSX.Element { const containerRef = useRef(null) const [noteTarget, setNoteTarget] = useState(undefined) useState(undefined) const highlightsRef = useRef([]) const windowDimensions = useWindowDimensions() return (
{noteTarget && ( { const savedHighlight = highlightsRef.current.find( (other: Highlight) => { return other.id == highlight.id } ) if (savedHighlight) { savedHighlight.annotation = highlight.annotation } }} onOpenChange={() => { setNoteTarget(undefined) }} /> )} { props.setShowHighlightsModal(false) }} > { const event = new CustomEvent('scrollToHighlightId', { detail: highlightId, }) document.dispatchEvent(event) }} />
) }