ui-ux: Setting-Menu

ui-ux: Setting Modal Changes
This commit is contained in:
Dustin Loring 2024-12-15 08:08:41 -05:00 committed by GitHub
commit 7c3a3bbde6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View File

@ -27,8 +27,8 @@ export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [ const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
{ id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> }, { id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
{ id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> }, { id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
{ id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> }, { id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
...(debug ...(debug
? [ ? [
{ {

View File

@ -22,17 +22,20 @@ export default function ChatHistoryTab() {
}; };
const handleDeleteAllChats = async () => { const handleDeleteAllChats = async () => {
const confirmDelete = window.confirm("Are you sure you want to delete all chats? This action cannot be undone.");
if (!confirmDelete) {
return; // Exit if the user cancels
}
if (!db) { if (!db) {
const error = new Error('Database is not available'); const error = new Error('Database is not available');
logStore.logError('Failed to delete chats - DB unavailable', error); logStore.logError('Failed to delete chats - DB unavailable', error);
toast.error('Database is not available'); toast.error('Database is not available');
return; return;
} }
try { try {
setIsDeleting(true); setIsDeleting(true);
const allChats = await getAll(db); const allChats = await getAll(db);
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id))); await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
logStore.logSystem('All chats deleted successfully', { count: allChats.length }); logStore.logSystem('All chats deleted successfully', { count: allChats.length });
@ -52,7 +55,6 @@ export default function ChatHistoryTab() {
const error = new Error('Database is not available'); const error = new Error('Database is not available');
logStore.logError('Failed to export chats - DB unavailable', error); logStore.logError('Failed to export chats - DB unavailable', error);
toast.error('Database is not available'); toast.error('Database is not available');
return; return;
} }

View File

@ -1,6 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { useSettings } from '~/lib/hooks/useSettings'; import { useSettings } from '~/lib/hooks/useSettings';
import commit from '~/commit.json'; import commit from '~/commit.json';
import { toast } from 'react-toastify';
interface ProviderStatus { interface ProviderStatus {
name: string; name: string;
@ -308,8 +309,9 @@ export default function DebugTab() {
Version: versionHash, Version: versionHash,
Timestamp: new Date().toISOString(), Timestamp: new Date().toISOString(),
}; };
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => { navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
alert('Debug information copied to clipboard!'); toast.success('Debug information copied to clipboard!');
}); });
}, [activeProviders, systemInfo]); }, [activeProviders, systemInfo]);