diff --git a/frontend/src/lib/components/AnnotationSidePanel.svelte b/frontend/src/lib/components/AnnotationSidePanel.svelte new file mode 100644 index 00000000..0a337662 --- /dev/null +++ b/frontend/src/lib/components/AnnotationSidePanel.svelte @@ -0,0 +1,65 @@ + + +
+ +
+ + {m.doc_panel_discussion_annotation_tab({ page: String(activeAnnotationPage ?? '?') })} + + +
+ + +
+ {#if activeAnnotationId} + {#key activeAnnotationId} + + {/key} + {/if} +
+
diff --git a/frontend/src/lib/components/DocumentBottomPanel.svelte b/frontend/src/lib/components/DocumentBottomPanel.svelte index cb2dbc02..33de26e6 100644 --- a/frontend/src/lib/components/DocumentBottomPanel.svelte +++ b/frontend/src/lib/components/DocumentBottomPanel.svelte @@ -48,9 +48,6 @@ type Props = { open: boolean; height: number; activeTab: Tab; - activeAnnotationId: string | null; - activeAnnotationPage: number | null; - onAnnotationCommentCountChange?: (annotationId: string, count: number) => void; }; let { @@ -61,10 +58,7 @@ let { canAdmin, open = $bindable(), height = $bindable(), - activeTab = $bindable(), - activeAnnotationId, - activeAnnotationPage, - onAnnotationCommentCountChange + activeTab = $bindable() }: Props = $props(); const MIN_HEIGHT = 52; // drag handle (8px) + tab bar (~44px) @@ -187,13 +181,10 @@ const panelHeight = $derived(open ? height : MIN_HEIGHT); {:else if activeTab === 'discussion'} {:else if activeTab === 'history'} diff --git a/frontend/src/lib/components/PanelDiscussion.svelte b/frontend/src/lib/components/PanelDiscussion.svelte index 8ebf4abd..22fb9d6b 100644 --- a/frontend/src/lib/components/PanelDiscussion.svelte +++ b/frontend/src/lib/components/PanelDiscussion.svelte @@ -1,5 +1,4 @@ -
- - {#if activeAnnotationId} -
- - -
- {/if} - - -
- {#if !activeAnnotationId || activeSubTab === 'document'} - - (docCommentCount = count)} - /> - {:else} - - {#key activeAnnotationId} - onAnnotationCommentCountChange?.(activeAnnotationId, count)} - /> - {/key} - {/if} -
+
+
diff --git a/frontend/src/routes/documents/[id]/+page.svelte b/frontend/src/routes/documents/[id]/+page.svelte index b3682c10..9142083d 100644 --- a/frontend/src/routes/documents/[id]/+page.svelte +++ b/frontend/src/routes/documents/[id]/+page.svelte @@ -3,6 +3,7 @@ import { onMount } from 'svelte'; import DocumentTopBar from '$lib/components/DocumentTopBar.svelte'; import DocumentViewer from '$lib/components/DocumentViewer.svelte'; import DocumentBottomPanel from '$lib/components/DocumentBottomPanel.svelte'; +import AnnotationSidePanel from '$lib/components/AnnotationSidePanel.svelte'; type Tab = 'metadata' | 'transcription' | 'discussion' | 'history'; @@ -58,14 +59,6 @@ let annotateMode = $state(false); let activeAnnotationId = $state(null); let activeAnnotationPage = $state(null); -// When an annotation is clicked, open the Diskussion tab. -$effect(() => { - if (activeAnnotationId) { - activeTab = 'discussion'; - panelOpen = true; - } -}); - // Close the panel when entering annotate mode so the PDF is fully visible. $effect(() => { if (annotateMode) panelOpen = false; @@ -152,6 +145,18 @@ $effect(() => { activeAnnotationId = id; }} /> + { + activeAnnotationId = null; + activeAnnotationPage = null; + }} + />
{ bind:open={panelOpen} bind:height={panelHeight} bind:activeTab={activeTab} - activeAnnotationId={activeAnnotationId} - activeAnnotationPage={activeAnnotationPage} />