diff --git a/packages/web/components/templates/AddLinkModal.tsx b/packages/web/components/templates/AddLinkModal.tsx index 309bf2024..0eec8a252 100644 --- a/packages/web/components/templates/AddLinkModal.tsx +++ b/packages/web/components/templates/AddLinkModal.tsx @@ -62,17 +62,16 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element { }} > - {/* */} + /> {selectedTab == 'link' && } - {/* {selectedTab == 'feed' && } + {selectedTab == 'feed' && } {selectedTab == 'opml' && } {selectedTab == 'pdf' && } - {selectedTab == 'import' && } */} @@ -550,6 +549,7 @@ const UploadPad = (props: UploadPadProps): JSX.Element => { withCredentials: false, headers: { 'Content-Type': file.file.type, + 'origin': 'http://localhost:3000' }, onUploadProgress: (p) => { if (!p.total) { diff --git a/packages/web/components/templates/UploadModal.tsx b/packages/web/components/templates/UploadModal.tsx index 26fb49a2c..a3dc64937 100644 --- a/packages/web/components/templates/UploadModal.tsx +++ b/packages/web/components/templates/UploadModal.tsx @@ -293,8 +293,7 @@ export function UploadModal(props: UploadModalProps): JSX.Element { title="Upload file" onOpenChange={props.onOpenChange} /> - The uploader is currently disabled. - {/* { setInDragOperation(true) @@ -448,7 +447,7 @@ export function UploadModal(props: UploadModalProps): JSX.Element { )} - */} + diff --git a/packages/web/components/templates/article/NativePdfArticleContainer.tsx b/packages/web/components/templates/article/NativePdfArticleContainer.tsx new file mode 100644 index 000000000..3d036e87e --- /dev/null +++ b/packages/web/components/templates/article/NativePdfArticleContainer.tsx @@ -0,0 +1,91 @@ +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) + }} + /> + +
+ ) +} diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx index 86f273be9..15bf39930 100644 --- a/packages/web/pages/[username]/[slug]/index.tsx +++ b/packages/web/pages/[username]/[slug]/index.tsx @@ -39,7 +39,7 @@ import { import { useGetViewer } from '../../../lib/networking/viewer/useGetViewer' const PdfArticleContainerNoSSR = dynamic( - () => import('./../../../components/templates/article/PdfArticleContainer'), + () => import(`./../../../components/templates/article/${(process.env.USE_NATIVE_PDF == 'false' || process.env.USE_NATIVE_PDF == undefined) ? 'PDF' : 'Native' }PdfArticleContainer`), { ssr: false } ) diff --git a/self-hosting/docker-compose/docker-compose.yml b/self-hosting/docker-compose/docker-compose.yml index 6e196b9ea..6a8e91de7 100644 --- a/self-hosting/docker-compose/docker-compose.yml +++ b/self-hosting/docker-compose/docker-compose.yml @@ -70,6 +70,7 @@ services: - BASE_URL=http://localhost:3000 - SERVER_BASE_URL=http://localhost:4000 - HIGHLIGHTS_BASE_URL=http://localhost:3000 + - USE_NATIVE_PDF=true container_name: "omnivore-web" ports: - "3000:8080"