fix(#73): open annotation side panel when deep-linking via ?annotationId=
- NotificationBell now includes annotationId in the deep-link URL when available - +page.svelte reads ?annotationId= param and sets activeAnnotationId on mount, opening the side panel instead of the bottom discussion drawer - AnnotationSidePanel accepts and forwards targetCommentId to CommentThread so the specific comment is highlighted when navigating via a notification Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import type { DocumentPanelTab } from '$lib/types';
|
||||
let { data } = $props();
|
||||
|
||||
const targetCommentId = $derived(page.url.searchParams.get('commentId'));
|
||||
const targetAnnotationId = $derived(page.url.searchParams.get('annotationId'));
|
||||
|
||||
const doc = $derived(data.document);
|
||||
const canComment = $derived((data.canAnnotate || data.canWrite) ?? false);
|
||||
@@ -95,8 +96,11 @@ onMount(() => {
|
||||
if (!isNaN(h) && h >= 80) panelHeight = h;
|
||||
}
|
||||
|
||||
if (targetCommentId) {
|
||||
// Deep-link: always open discussion tab regardless of saved state
|
||||
if (targetAnnotationId) {
|
||||
// Deep-link into an annotation comment: open the side panel
|
||||
activeAnnotationId = targetAnnotationId;
|
||||
} else if (targetCommentId) {
|
||||
// Deep-link into a document-level comment: open discussion tab
|
||||
panelOpen = true;
|
||||
activeTab = 'discussion';
|
||||
} else if (savedOpen === 'true') {
|
||||
@@ -169,6 +173,7 @@ $effect(() => {
|
||||
canComment={canComment}
|
||||
currentUserId={currentUserId}
|
||||
canAdmin={canAdmin}
|
||||
targetCommentId={targetAnnotationId ? targetCommentId : null}
|
||||
onClose={() => {
|
||||
activeAnnotationId = null;
|
||||
activeAnnotationPage = null;
|
||||
|
||||
Reference in New Issue
Block a user