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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user