From ee708cc026a7c47f4ed2a3f0e1260949c3f1c9e4 Mon Sep 17 00:00:00 2001 From: samlhuillier Date: Wed, 13 Nov 2024 21:04:44 +0000 Subject: [PATCH 1/2] rm sidebar compact --- electron/main/electron-store/ipcHandlers.ts | 7 --- electron/main/electron-store/storeConfig.ts | 2 - electron/preload/index.ts | 2 - src/components/Settings/GeneralSettings.tsx | 51 +-------------------- src/components/Settings/Settings.tsx | 2 +- src/components/Sidebars/IconsSidebar.tsx | 23 +--------- 6 files changed, 5 insertions(+), 82 deletions(-) diff --git a/electron/main/electron-store/ipcHandlers.ts b/electron/main/electron-store/ipcHandlers.ts index 811da97a..3fa276a4 100644 --- a/electron/main/electron-store/ipcHandlers.ts +++ b/electron/main/electron-store/ipcHandlers.ts @@ -94,13 +94,6 @@ export const registerStoreHandlers = (store: Store, windowsManager: return store.get(StoreKeys.LLMGenerationParameters) }) - ipcMain.handle('set-sb-compact', (event, isSBCompact) => { - store.set(StoreKeys.IsSBCompact, isSBCompact) - event.sender.send('sb-compact-changed', isSBCompact) - }) - - ipcMain.handle('get-sb-compact', () => store.get(StoreKeys.IsSBCompact)) - ipcMain.handle('get-editor-flex-center', () => store.get(StoreKeys.EditorFlexCenter)) ipcMain.handle('set-editor-flex-center', (event, setEditorFlexCenter) => { diff --git a/electron/main/electron-store/storeConfig.ts b/electron/main/electron-store/storeConfig.ts index e347a61d..d0166a29 100644 --- a/electron/main/electron-store/storeConfig.ts +++ b/electron/main/electron-store/storeConfig.ts @@ -57,7 +57,6 @@ export interface StoreSchema { agentConfigs: AgentConfig[] analytics?: boolean chunkSize: number - isSBCompact: boolean spellCheck: string EditorFlexCenter: boolean showDocumentStats: boolean @@ -79,7 +78,6 @@ export enum StoreKeys { Chats = 'chats', AgentConfigs = 'agentConfigs', ChunkSize = 'chunkSize', - IsSBCompact = 'isSBCompact', SpellCheck = 'spellCheck', EditorFlexCenter = 'editorFlexCenter', showDocumentStats = 'showDocumentStats', diff --git a/electron/preload/index.ts b/electron/preload/index.ts index 5cc8286c..88da1001 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -70,8 +70,6 @@ const electronStore = { saveChat: createIPCHandler<(chat: Chat) => Promise>('save-chat'), deleteChat: createIPCHandler<(chatID: string) => Promise>('delete-chat'), getChat: createIPCHandler<(chatID: string | undefined) => Promise>('get-chat'), - getSBCompact: createIPCHandler<() => Promise>('get-sb-compact'), - setSBCompact: createIPCHandler<(isSBCompact: boolean) => Promise>('set-sb-compact'), getEditorFlexCenter: createIPCHandler<() => Promise>('get-editor-flex-center'), setEditorFlexCenter: createIPCHandler<(editorFlexCenter: boolean) => Promise>('set-editor-flex-center'), getAgentConfigs: createIPCHandler<() => Promise>('get-agent-configs'), diff --git a/src/components/Settings/GeneralSettings.tsx b/src/components/Settings/GeneralSettings.tsx index d09ecf81..b3b8cf88 100644 --- a/src/components/Settings/GeneralSettings.tsx +++ b/src/components/Settings/GeneralSettings.tsx @@ -1,49 +1,6 @@ import React, { useEffect, useState } from 'react' import Switch from '@mui/material/Switch' -export const AppearanceSection = () => { - const [isIconSBCompact, setIsIconSBCompact] = useState(false) - - useEffect(() => { - const fetchParams = async () => { - const storedIsIconSBCompact = await window.electronStore.getSBCompact() - - if (storedIsIconSBCompact !== undefined) { - setIsIconSBCompact(storedIsIconSBCompact) - } - } - - fetchParams() - }, []) - - return ( -
-

- Appearance -

-
-
-
-

- IconSidebar Compact - Decreases padding on IconSidebar -

-
- { - setIsIconSBCompact(!isIconSBCompact) - if (isIconSBCompact !== undefined) { - window.electronStore.setSBCompact(!isIconSBCompact) - } - }} - /> -
-
-
- ) -} - export const EditorSection = () => { const [tempSpellCheckEnabled, setTempSpellCheckEnabled] = useState(false) const [documentStatsEnabled, setDocumentStatsEnabled] = useState(false) @@ -90,10 +47,7 @@ export const EditorSection = () => { }, []) return ( -
-

- Editor -

+
@@ -157,8 +111,7 @@ export const EditorSection = () => { const GeneralSettings = () => { return (
-

General

- +

Editor

) diff --git a/src/components/Settings/Settings.tsx b/src/components/Settings/Settings.tsx index 32db9bba..0d892bd4 100644 --- a/src/components/Settings/Settings.tsx +++ b/src/components/Settings/Settings.tsx @@ -57,7 +57,7 @@ const SettingsModal: React.FC = ({ }`} onClick={() => setActiveTab(SettingsTab.GeneralSettingsTab)} > - General + Editor
= ({ getShortcutDescription }) => { const { sidebarShowing, setSidebarShowing } = useChatContext() - const [sidebarWidth, setSidebarWidth] = useState(40) const { isSettingsModalOpen, setIsSettingsModalOpen, setIsNewDirectoryModalOpen } = useModalOpeners() const { createUntitledNote } = useContentContext() - useEffect(() => { - const updateWidth = async () => { - const isCompact = await window.electronStore.getSBCompact() - setSidebarWidth(isCompact ? 40 : 60) - } - - const handleSettingsChange = (isCompact: number) => { - setSidebarWidth(isCompact ? 40 : 60) - } - - updateWidth() - - window.ipcRenderer.receive('sb-compact-changed', handleSettingsChange) - }, []) - return ( -
+
setSidebarShowing('files')} From 39e042a2397cc0cf8ed7b992835fbf9f49083339 Mon Sep 17 00:00:00 2001 From: samlhuillier Date: Wed, 13 Nov 2024 21:08:34 +0000 Subject: [PATCH 2/2] reduce delay --- src/components/Chat/MessageComponents/ChatSources.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Chat/MessageComponents/ChatSources.tsx b/src/components/Chat/MessageComponents/ChatSources.tsx index 00e05d63..67c1f767 100644 --- a/src/components/Chat/MessageComponents/ChatSources.tsx +++ b/src/components/Chat/MessageComponents/ChatSources.tsx @@ -53,7 +53,7 @@ const ChatSources: React.FC = ({ contextItems }) => {
{contextItems.map((contextItem) => ( - +