refactor(notification-bell): use buildCommentHref helper
Drops the inline conditional href construction in favour of the shared helper. Identical URL shape — behaviour preserved. Refs #300. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { goto } from '$app/navigation';
|
|||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { clickOutside } from '$lib/actions/clickOutside';
|
import { clickOutside } from '$lib/actions/clickOutside';
|
||||||
import { notificationStore } from '$lib/stores/notifications.svelte';
|
import { notificationStore } from '$lib/stores/notifications.svelte';
|
||||||
|
import { buildCommentHref } from '$lib/utils/commentDeepLink';
|
||||||
import NotificationDropdown from './NotificationDropdown.svelte';
|
import NotificationDropdown from './NotificationDropdown.svelte';
|
||||||
|
|
||||||
let open = $state(false);
|
let open = $state(false);
|
||||||
@@ -31,9 +32,11 @@ function closeDropdown() {
|
|||||||
|
|
||||||
async function handleMarkRead(notification: Parameters<typeof stream.markRead>[0]) {
|
async function handleMarkRead(notification: Parameters<typeof stream.markRead>[0]) {
|
||||||
await stream.markRead(notification);
|
await stream.markRead(notification);
|
||||||
const url = notification.annotationId
|
const url = buildCommentHref(
|
||||||
? `/documents/${notification.documentId}?commentId=${notification.referenceId}&annotationId=${notification.annotationId}`
|
notification.documentId,
|
||||||
: `/documents/${notification.documentId}?commentId=${notification.referenceId}`;
|
notification.referenceId,
|
||||||
|
notification.annotationId
|
||||||
|
);
|
||||||
closeDropdown();
|
closeDropdown();
|
||||||
goto(url);
|
goto(url);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user