From 903841b24e537d7920286ad9fbda5c990db199c0 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Fri, 21 Aug 2026 15:14:20 +0200 Subject: [PATCH] chat : make the whole tab item act as a link The full tab is now a link instead of only the inner label button, while the stop and close buttons stay interactive by swallowing their clicks. Assisted-by: pi --- .../app/chat/ChatTabs/ChatTabsItem.svelte | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/tools/ui/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte b/tools/ui/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte index 0ac06ca4ed..86b04ddc96 100644 --- a/tools/ui/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte +++ b/tools/ui/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte @@ -2,6 +2,8 @@ import { Loader2, Square, SquarePen, X } from '@lucide/svelte'; import * as Tooltip from '$lib/components/ui/tooltip'; import { cn } from '$lib/components/ui/utils'; + import { ROUTES } from '$lib/constants'; + import { RouterService } from '$lib/services/router.service'; interface Tab { id: string; @@ -29,18 +31,39 @@ tab }: Props = $props(); - let contentOpacity = $derived(isActive ? '' : 'opacity-40 group-hover:opacity-100'); + let contentOpacity = $derived(isActive ? '' : 'opacity-45 group-hover:opacity-75'); + + let href = $derived(tab.isNewChat ? ROUTES.START : RouterService.chat(tab.id)); + + function handleActivate(event: MouseEvent) { + // keep routing through tabsStore.activate() so the new-chat sentinel + // and history behave exactly like the programmatic navigation + event.preventDefault(); + onActivate?.(tab.id); + } + + // stop/close sit inside the tab link; swallow the click so the tab does + // not also navigate + function handleActionClick(event: MouseEvent, action: () => void) { + event.preventDefault(); + event.stopPropagation(); + action(); + } -
onAuxClick?.(tab.id, e)} + aria-current={isActive ? 'page' : undefined} > {#if isLoading} @@ -49,12 +72,13 @@ + {tab.name} @@ -87,9 +104,10 @@
+