Skip to content

Commit

Permalink
Merge pull request #485 from reorproject/rm-compact-sb
Browse files Browse the repository at this point in the history
Rm compact sb
samlhuillier authored Nov 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 298947b + 39e042a commit 73996b2
Showing 7 changed files with 6 additions and 83 deletions.
7 changes: 0 additions & 7 deletions electron/main/electron-store/ipcHandlers.ts
Original file line number Diff line number Diff line change
@@ -94,13 +94,6 @@ export const registerStoreHandlers = (store: Store<StoreSchema>, 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) => {
2 changes: 0 additions & 2 deletions electron/main/electron-store/storeConfig.ts
Original file line number Diff line number Diff line change
@@ -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',
2 changes: 0 additions & 2 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
@@ -70,8 +70,6 @@ const electronStore = {
saveChat: createIPCHandler<(chat: Chat) => Promise<void>>('save-chat'),
deleteChat: createIPCHandler<(chatID: string) => Promise<void>>('delete-chat'),
getChat: createIPCHandler<(chatID: string | undefined) => Promise<Chat | undefined>>('get-chat'),
getSBCompact: createIPCHandler<() => Promise<boolean>>('get-sb-compact'),
setSBCompact: createIPCHandler<(isSBCompact: boolean) => Promise<void>>('set-sb-compact'),
getEditorFlexCenter: createIPCHandler<() => Promise<boolean>>('get-editor-flex-center'),
setEditorFlexCenter: createIPCHandler<(editorFlexCenter: boolean) => Promise<void>>('set-editor-flex-center'),
getAgentConfigs: createIPCHandler<() => Promise<AgentConfig[]>>('get-agent-configs'),
2 changes: 1 addition & 1 deletion src/components/Chat/MessageComponents/ChatSources.tsx
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ const ChatSources: React.FC<ChatSourcesProps> = ({ contextItems }) => {

<div className="scrollbar-thumb-rounded-full flex space-x-2 overflow-x-auto p-0 pb-1 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-gray-800">

Check warning on line 54 in src/components/Chat/MessageComponents/ChatSources.tsx

GitHub Actions / build_and_package (macos-13)

Classname 'scrollbar-thumb-rounded-full' is not a Tailwind CSS class!

Check warning on line 54 in src/components/Chat/MessageComponents/ChatSources.tsx

GitHub Actions / build_and_package (macos-latest)

Classname 'scrollbar-thumb-rounded-full' is not a Tailwind CSS class!

Check warning on line 54 in src/components/Chat/MessageComponents/ChatSources.tsx

GitHub Actions / build_and_package (windows-latest)

Classname 'scrollbar-thumb-rounded-full' is not a Tailwind CSS class!

Check warning on line 54 in src/components/Chat/MessageComponents/ChatSources.tsx

GitHub Actions / build_and_package (ubuntu-latest, x64)

Classname 'scrollbar-thumb-rounded-full' is not a Tailwind CSS class!
{contextItems.map((contextItem) => (
<HoverCard key={getItemPath(contextItem)} openDelay={100}>
<HoverCard key={getItemPath(contextItem)} openDelay={600}>
<HoverCardTrigger>
<Card
className="flex h-10 w-28 shrink-0 cursor-pointer items-center justify-center bg-secondary"
51 changes: 2 additions & 49 deletions src/components/Settings/GeneralSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@
import React, { useEffect, useState } from 'react'
import Switch from '@mui/material/Switch'

export const AppearanceSection = () => {
const [isIconSBCompact, setIsIconSBCompact] = useState<boolean>(false)

useEffect(() => {
const fetchParams = async () => {
const storedIsIconSBCompact = await window.electronStore.getSBCompact()

if (storedIsIconSBCompact !== undefined) {
setIsIconSBCompact(storedIsIconSBCompact)
}
}

fetchParams()
}, [])

return (
<div className="flex w-full flex-col">
<h4 className="xs:text-sm mb-1 mt-10 flex w-full items-center justify-between gap-5 pb-2 text-lg text-white sm:text-base">
Appearance
</h4>
<div className="h-[2px] w-full bg-neutral-700" />
<div className="flex w-full flex-wrap items-center justify-between">
<div className="flex flex-col justify-center">
<p className="xs:text-xs flex flex-col text-base text-gray-100 opacity-80 sm:text-sm">
IconSidebar Compact
<span className="m-0 pt-1 text-xs text-gray-100">Decreases padding on IconSidebar</span>
</p>
</div>
<Switch
checked={isIconSBCompact}
onChange={() => {
setIsIconSBCompact(!isIconSBCompact)
if (isIconSBCompact !== undefined) {
window.electronStore.setSBCompact(!isIconSBCompact)
}
}}
/>
</div>
<div className="h-[2px] w-full bg-neutral-700" />
</div>
)
}

export const EditorSection = () => {
const [tempSpellCheckEnabled, setTempSpellCheckEnabled] = useState(false)
const [documentStatsEnabled, setDocumentStatsEnabled] = useState(false)
@@ -90,10 +47,7 @@ export const EditorSection = () => {
}, [])

return (
<div className="w-full flex-col">
<h4 className="xs:text-sm mb-1 mt-10 flex w-full items-center justify-between gap-5 pb-2 text-lg text-white sm:text-base">
Editor
</h4>
<div className="w-full flex-col pt-4">
<div className="h-[2px] w-full bg-neutral-700" />
<div className="flex w-full flex-wrap items-center justify-between">
<div className="flex w-[70%] flex-col justify-center">
@@ -157,8 +111,7 @@ export const EditorSection = () => {
const GeneralSettings = () => {
return (
<div className="w-full flex-col justify-between rounded bg-dark-gray-c-three">
<h2 className="mb-0 text-2xl font-semibold text-white">General</h2>
<AppearanceSection />
<h2 className="mb-0 text-2xl font-semibold text-white">Editor</h2>
<EditorSection />
</div>
)
2 changes: 1 addition & 1 deletion src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ const SettingsModal: React.FC<SettingsModalProps> = ({
}`}
onClick={() => setActiveTab(SettingsTab.GeneralSettingsTab)}
>
General
Editor
</div>
<div
className={`flex cursor-pointer items-center rounded border-b border-gray-200 p-2 text-sm hover:bg-neutral-600 ${
23 changes: 2 additions & 21 deletions src/components/Sidebars/IconsSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React from 'react'

import { FaSearch } from 'react-icons/fa'
import { GrNewWindow } from 'react-icons/gr'
@@ -18,31 +18,12 @@ export interface IconsSidebarProps {

const IconsSidebar: React.FC<IconsSidebarProps> = ({ getShortcutDescription }) => {
const { sidebarShowing, setSidebarShowing } = useChatContext()
const [sidebarWidth, setSidebarWidth] = useState<number>(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 (
<div
className="flex size-full flex-col items-center justify-between gap-1 bg-neutral-800"
style={{ width: `${sidebarWidth}px` }}
>
<div className="flex size-full w-[55px] flex-col items-center justify-between gap-1 bg-neutral-800 pt-2">
<div
className=" flex h-8 w-full cursor-pointer items-center justify-center"
onClick={() => setSidebarShowing('files')}

0 comments on commit 73996b2

Please sign in to comment.