fix: navigate to home when deleting active chat + text selection CSS

- 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 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 21:53:50 +01:00
parent 3cf6036c15
commit b232c67c52
2 changed files with 20 additions and 1 deletions

View File

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

View File

@@ -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);
}