Commit
·
1e73e88
1
Parent(s):
9efc709
ui-ux: Setting Modal Changes
Browse filesEnhancement - move the connection tab below chat history in left side of settings
Enhancement - on chat tab Delete all chats, should prompt to make sure you want to
Enhancement - Debug tab change copy debug info from a popup to a toast notification
app/components/settings/SettingsWindow.tsx
CHANGED
|
@@ -27,8 +27,8 @@ export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
|
|
| 27 |
const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
|
| 28 |
{ id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
|
| 29 |
{ id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
|
| 30 |
-
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
|
| 31 |
{ id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
|
|
|
|
| 32 |
...(debug
|
| 33 |
? [
|
| 34 |
{
|
|
|
|
| 27 |
const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
|
| 28 |
{ id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
|
| 29 |
{ id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
|
|
|
|
| 30 |
{ id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
|
| 31 |
+
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
|
| 32 |
...(debug
|
| 33 |
? [
|
| 34 |
{
|
app/components/settings/chat-history/ChatHistoryTab.tsx
CHANGED
|
@@ -22,17 +22,20 @@ export default function ChatHistoryTab() {
|
|
| 22 |
};
|
| 23 |
|
| 24 |
const handleDeleteAllChats = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
if (!db) {
|
| 26 |
const error = new Error('Database is not available');
|
| 27 |
logStore.logError('Failed to delete chats - DB unavailable', error);
|
| 28 |
toast.error('Database is not available');
|
| 29 |
-
|
| 30 |
return;
|
| 31 |
}
|
| 32 |
|
| 33 |
try {
|
| 34 |
setIsDeleting(true);
|
| 35 |
-
|
| 36 |
const allChats = await getAll(db);
|
| 37 |
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
| 38 |
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
|
@@ -52,7 +55,6 @@ export default function ChatHistoryTab() {
|
|
| 52 |
const error = new Error('Database is not available');
|
| 53 |
logStore.logError('Failed to export chats - DB unavailable', error);
|
| 54 |
toast.error('Database is not available');
|
| 55 |
-
|
| 56 |
return;
|
| 57 |
}
|
| 58 |
|
|
|
|
| 22 |
};
|
| 23 |
|
| 24 |
const handleDeleteAllChats = async () => {
|
| 25 |
+
const confirmDelete = window.confirm("Are you sure you want to delete all chats? This action cannot be undone.");
|
| 26 |
+
if (!confirmDelete) {
|
| 27 |
+
return; // Exit if the user cancels
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
if (!db) {
|
| 31 |
const error = new Error('Database is not available');
|
| 32 |
logStore.logError('Failed to delete chats - DB unavailable', error);
|
| 33 |
toast.error('Database is not available');
|
|
|
|
| 34 |
return;
|
| 35 |
}
|
| 36 |
|
| 37 |
try {
|
| 38 |
setIsDeleting(true);
|
|
|
|
| 39 |
const allChats = await getAll(db);
|
| 40 |
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
| 41 |
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
|
|
|
| 55 |
const error = new Error('Database is not available');
|
| 56 |
logStore.logError('Failed to export chats - DB unavailable', error);
|
| 57 |
toast.error('Database is not available');
|
|
|
|
| 58 |
return;
|
| 59 |
}
|
| 60 |
|
app/components/settings/debug/DebugTab.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { useSettings } from '~/lib/hooks/useSettings';
|
| 3 |
import commit from '~/commit.json';
|
|
|
|
| 4 |
|
| 5 |
interface ProviderStatus {
|
| 6 |
name: string;
|
|
@@ -308,8 +309,9 @@ export default function DebugTab() {
|
|
| 308 |
Version: versionHash,
|
| 309 |
Timestamp: new Date().toISOString(),
|
| 310 |
};
|
|
|
|
| 311 |
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
| 312 |
-
|
| 313 |
});
|
| 314 |
}, [activeProviders, systemInfo]);
|
| 315 |
|
|
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { useSettings } from '~/lib/hooks/useSettings';
|
| 3 |
import commit from '~/commit.json';
|
| 4 |
+
import { toast } from 'react-toastify';
|
| 5 |
|
| 6 |
interface ProviderStatus {
|
| 7 |
name: string;
|
|
|
|
| 309 |
Version: versionHash,
|
| 310 |
Timestamp: new Date().toISOString(),
|
| 311 |
};
|
| 312 |
+
|
| 313 |
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
| 314 |
+
toast.success('Debug information copied to clipboard!');
|
| 315 |
});
|
| 316 |
}, [activeProviders, systemInfo]);
|
| 317 |
|