From b232c67c52ba130900cacd2ad1f29b7841fc97e7 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Wed, 31 Dec 2025 21:53:50 +0100 Subject: [PATCH] fix: navigate to home when deleting active chat + text selection CSS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ConversationItem now navigates to / when deleting the currently active chat - Added text selection styling (violet highlight) for better visibility in dark theme 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- frontend/src/app.css | 9 +++++++++ .../lib/components/layout/ConversationItem.svelte | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/app.css b/frontend/src/app.css index 9ab9ed9..942dd40 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -8,6 +8,15 @@ body { @apply h-full; } +/* Text selection styling for dark theme */ +::selection { + @apply bg-violet-500/40 text-white; +} + +::-moz-selection { + @apply bg-violet-500/40 text-white; +} + /* Custom scrollbar */ ::-webkit-scrollbar { @apply w-2; diff --git a/frontend/src/lib/components/layout/ConversationItem.svelte b/frontend/src/lib/components/layout/ConversationItem.svelte index e92abb4..ac3466b 100644 --- a/frontend/src/lib/components/layout/ConversationItem.svelte +++ b/frontend/src/lib/components/layout/ConversationItem.svelte @@ -4,7 +4,8 @@ * Shows title, model, and hover actions (pin, delete) */ import type { Conversation } from '$lib/types/conversation.js'; - import { conversationsState, uiState } from '$lib/stores'; + import { goto } from '$app/navigation'; + import { conversationsState, uiState, chatState } from '$lib/stores'; import { deleteConversation } from '$lib/storage'; interface Props { @@ -40,11 +41,20 @@ async function handleDelete(e: MouseEvent) { e.preventDefault(); e.stopPropagation(); + + const isCurrentChat = chatState.conversationId === conversation.id; + // Delete from IndexedDB first const result = await deleteConversation(conversation.id); if (result.success) { // Then remove from state conversationsState.remove(conversation.id); + + // If deleting the active chat, navigate home + if (isCurrentChat) { + chatState.reset(); + goto('/'); + } } else { console.error('Failed to delete conversation:', result.error); }