feat(#73): deep-link to specific comments via ?commentId= query param
Some checks failed
CI / Unit & Component Tests (push) Failing after 1m55s
CI / Backend Unit Tests (push) Successful in 2m10s
CI / E2E Tests (push) Failing after 2h23m30s
CI / Unit & Component Tests (pull_request) Failing after 2m3s
CI / Backend Unit Tests (pull_request) Successful in 2m20s
CI / E2E Tests (pull_request) Failing after 2h3m35s
Some checks failed
CI / Unit & Component Tests (push) Failing after 1m55s
CI / Backend Unit Tests (push) Successful in 2m10s
CI / E2E Tests (push) Failing after 2h23m30s
CI / Unit & Component Tests (pull_request) Failing after 2m3s
CI / Backend Unit Tests (pull_request) Successful in 2m20s
CI / E2E Tests (pull_request) Failing after 2h3m35s
- +page.svelte: read ?commentId= from URL; on mount, if present open bottom panel to discussion tab - CommentThread: add targetCommentId prop — scrolls to comment on mount (scrollIntoView), applies ring highlight, removes highlight on first user interaction (click/keydown/scroll) - CommentThread: add data-comment-id attributes to thread root and reply divs - PanelDiscussion / DocumentBottomPanel: thread targetCommentId prop through the chain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/state';
|
||||
import DocumentTopBar from '$lib/components/DocumentTopBar.svelte';
|
||||
import DocumentViewer from '$lib/components/DocumentViewer.svelte';
|
||||
import DocumentBottomPanel from '$lib/components/DocumentBottomPanel.svelte';
|
||||
@@ -8,6 +9,8 @@ import type { DocumentPanelTab } from '$lib/types';
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
const targetCommentId = $derived(page.url.searchParams.get('commentId'));
|
||||
|
||||
const doc = $derived(data.document);
|
||||
const canComment = $derived((data.canAnnotate || data.canWrite) ?? false);
|
||||
const canAdmin = $derived(
|
||||
@@ -92,7 +95,11 @@ onMount(() => {
|
||||
if (!isNaN(h) && h >= 80) panelHeight = h;
|
||||
}
|
||||
|
||||
if (savedOpen === 'true') {
|
||||
if (targetCommentId) {
|
||||
// Deep-link: always open discussion tab regardless of saved state
|
||||
panelOpen = true;
|
||||
activeTab = 'discussion';
|
||||
} else if (savedOpen === 'true') {
|
||||
panelOpen = true;
|
||||
} else if (savedOpen === null && !doc?.filePath) {
|
||||
// No prior state and no file — open to metadata so the panel is immediately useful.
|
||||
@@ -175,6 +182,7 @@ $effect(() => {
|
||||
canComment={canComment}
|
||||
currentUserId={currentUserId}
|
||||
canAdmin={canAdmin}
|
||||
targetCommentId={targetCommentId}
|
||||
bind:open={panelOpen}
|
||||
bind:height={panelHeight}
|
||||
bind:activeTab={activeTab}
|
||||
|
||||
Reference in New Issue
Block a user