import { IconFileExport, IconMoon, IconSun } from '@tabler/icons-react'; import { useContext } from 'react'; import { useTranslation } from 'next-i18next'; import HomeContext from '@/pages/api/home/home.context'; import { Import } from '../../Settings/Import'; import { Key } from '../../Settings/Key'; import { SidebarButton } from '../../Sidebar/SidebarButton'; import ChatbarContext from '../Chatbar.context'; import { ClearConversations } from './ClearConversations'; import { PluginKeys } from './PluginKeys'; export const ChatbarSettings = () => { const { t } = useTranslation('sidebar'); const { state: { apiKey, lightMode, serverSideApiKeyIsSet, serverSidePluginKeysSet, conversations, }, dispatch: homeDispatch, } = useContext(HomeContext); const { handleClearConversations, handleImportConversations, handleExportData, handleApiKeyChange, } = useContext(ChatbarContext); return (
{conversations.length > 0 ? ( ) : null} } onClick={() => handleExportData()} /> : } onClick={() => homeDispatch({ field: 'lightMode', value: lightMode === 'light' ? 'dark' : 'light', }) } /> {!serverSideApiKeyIsSet ? ( ) : null} {!serverSidePluginKeysSet ? : null}
); };