import * as RadixDialog from '@radix-ui/react-dialog'; import { motion } from 'framer-motion'; import { useState, type ReactElement } from 'react'; import { classNames } from '~/utils/classNames'; import { DialogTitle, dialogVariants, dialogBackdropVariants } from '~/components/ui/Dialog'; import { IconButton } from '~/components/ui/IconButton'; import styles from './Settings.module.scss'; import ChatHistoryTab from './chat-history/ChatHistoryTab'; import ProvidersTab from './providers/ProvidersTab'; import { useSettings } from '~/lib/hooks/useSettings'; import FeaturesTab from './features/FeaturesTab'; import DebugTab from './debug/DebugTab'; import EventLogsTab from './event-logs/EventLogsTab'; import ConnectionsTab from './connections/ConnectionsTab'; interface SettingsProps { open: boolean; onClose: () => void; } type TabType = 'chat-history' | 'providers' | 'features' | 'debug' | 'event-logs' | 'connection'; export const SettingsWindow = ({ open, onClose }: SettingsProps) => { const { debug, eventLogs } = useSettings(); const [activeTab, setActiveTab] = useState('chat-history'); const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [ { id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: }, { id: 'providers', label: 'Providers', icon: 'i-ph:key', component: }, { id: 'connection', label: 'Connection', icon: 'i-ph:link', component: }, { id: 'features', label: 'Features', icon: 'i-ph:star', component: }, ...(debug ? [ { id: 'debug' as TabType, label: 'Debug Tab', icon: 'i-ph:bug', component: , }, ] : []), ...(eventLogs ? [ { id: 'event-logs' as TabType, label: 'Event Logs', icon: 'i-ph:list-bullets', component: , }, ] : []), ]; return (
Settings {tabs.map((tab) => ( ))}
{tabs.find((tab) => tab.id === activeTab)?.component}
); };