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 @@
+