import { Viewer, DocumentGate } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { Stage, stagePlugin } from '@embedpdf/react/stage'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { SelectionLayer, selectionPlugin } from '@embedpdf/react/selection'; import { interactionPlugin } from '@embedpdf/react/interaction'; import { AnnotationLayer, annotationKey, annotationPlugin, useComments, useCommentThreads, type CommentThreadView, } from '@embedpdf/react/annotation'; import { localEngine } from '@embedpdf/engine'; import './review.css'; const engine = localEngine(); const plugins = [ stagePlugin(), renderPlugin(), interactionPlugin(), selectionPlugin(), annotationPlugin(), ]; // [!doc-source proposal] const proposal = async (): Promise => { const response = await fetch('https://www.embedpdf.com/pdfs/proposal.pdf'); return { kind: 'bytes', id: 'proposal', bytes: new Uint8Array(await response.arrayBuffer()) }; }; // [!/doc-source] // A thread's verdict, its check mark, and the buttons the user may use. function Review({ thread }: { thread: CommentThreadView }) { const comments = useComments(); const ref = thread.root.ref; const verdict = thread.review.lastChange?.state ?? 'none'; const marked = thread.review.markedBy.length > 0; return (

{thread.root.author} {thread.root.contents}

{verdict} {marked && ✓ checked off}

); } function Reviews() { const threads = useCommentThreads(); return (
{threads.length === 0 &&

No comments

} {threads.map((thread) => ( ))}
); } export default function App() { return ( Loading…

}>
{() => ( <> )}
); }