Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rm compact sb #485

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions electron/main/electron-store/ipcHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 0 additions & 2 deletions electron/main/electron-store/storeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export interface StoreSchema {
agentConfigs: AgentConfig[]
analytics?: boolean
chunkSize: number
isSBCompact: boolean
spellCheck: string
EditorFlexCenter: boolean
showDocumentStats: boolean
Expand All @@ -79,7 +78,6 @@ export enum StoreKeys {
Chats = 'chats',
AgentConfigs = 'agentConfigs',
ChunkSize = 'chunkSize',
IsSBCompact = 'isSBCompact',
SpellCheck = 'spellCheck',
EditorFlexCenter = 'editorFlexCenter',
showDocumentStats = 'showDocumentStats',
Expand Down
2 changes: 0 additions & 2 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat/MessageComponents/ChatSources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<div>
<div className="mb-1 text-sm text-muted-foreground">Sources:</div>

<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

View workflow job for this annotation

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

View workflow job for this annotation

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

View workflow job for this annotation

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

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

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

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

View workflow job for this annotation

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

View workflow job for this annotation

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

View workflow job for this annotation

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

View workflow job for this annotation

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"
Expand Down
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)
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${
Expand Down
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'
Expand All @@ -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')}
Expand Down
Loading