This repository was archived by the owner on Mar 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 528
Expand file tree
/
Copy pathIconsSidebar.tsx
More file actions
152 lines (140 loc) · 5.39 KB
/
Copy pathIconsSidebar.tsx
File metadata and controls
152 lines (140 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import React, { useState } from 'react'
import { GrNewWindow } from 'react-icons/gr'
import { MdSettings } from 'react-icons/md'
// New folder and new note icons removed from nav (moved to Files sidebar)
import { Files, MessageCircle, Search, Moon, SunMoon } from '@tamagui/lucide-icons'
import { YStack } from 'tamagui'
import { useModalOpeners } from '../../contexts/ModalContext'
import { useChatContext } from '@/contexts/ChatContext'
// Removed new note action from nav; handled in Files sidebar
import { useThemeManager } from '@/contexts/ThemeContext'
import InitialSetupSinglePage from '../Settings/InitialSettingsSinglePage'
export interface IconsSidebarProps {
getShortcutDescription: (action: string) => string
}
const IconsSidebar: React.FC<IconsSidebarProps> = ({ getShortcutDescription }) => {
const { sidebarShowing, setSidebarShowing } = useChatContext()
const [showVaultSetup, setShowVaultSetup] = useState(false)
const { state, actions } = useThemeManager() // State => theme, actions => toggle, set, syncWithSystem
const { isSettingsModalOpen, setIsSettingsModalOpen } = useModalOpeners()
const handleAllInitialSettingsAreReady = () => {
setShowVaultSetup(false)
window.database.indexFilesInDirectory()
}
const determineColor = (sidebarName: string) => {
return sidebarShowing === sidebarName ? '$gray11' : '$gray9'
}
return (
<YStack
backgroundColor="$gray3"
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')}
>
<YStack
alignItems="center"
hoverStyle={{
backgroundColor: '$gray7',
}}
backgroundColor={sidebarShowing === 'files' ? '$gray6' : ''}
className="flex size-4/5 items-center justify-center rounded"
>
<Files size={20} color={determineColor('files')} title={getShortcutDescription('open-files') || 'Files'} />
</YStack>
</div>
<div
className=" flex h-8 w-full cursor-pointer items-center justify-center"
onClick={() => setSidebarShowing('chats')}
>
<YStack
alignItems="center"
hoverStyle={{
backgroundColor: '$gray7',
}}
backgroundColor={sidebarShowing === 'chats' ? '$gray6' : ''}
className="flex size-4/5 items-center justify-center rounded"
>
<MessageCircle
size={20}
color={determineColor('chats')}
title={getShortcutDescription('open-chat-bot') || 'Open Chatbot'}
/>
</YStack>
</div>
<div
className="flex h-8 w-full cursor-pointer items-center justify-center"
onClick={() => setSidebarShowing('search')}
>
<YStack
alignItems="center"
hoverStyle={{
backgroundColor: '$gray7',
}}
backgroundColor={sidebarShowing === 'search' ? '$gray6' : ''}
className="flex size-4/5 items-center justify-center rounded"
>
<Search
size={20}
color={determineColor('search')}
title={getShortcutDescription('open-search') || 'Semantic Search'}
/>
</YStack>
</div>
{/* New Note and New Directory actions moved into Files sidebar header */}
<div className="grow border-yellow-300" />
<div className="flex h-8 w-full cursor-pointer items-center justify-center border-none bg-transparent">
<YStack
alignItems="center"
onPress={() => actions.toggle()}
hoverStyle={{
backgroundColor: '$gray7',
}}
className="flex size-4/5 items-center justify-center rounded"
>
{state === 'dark' ? (
<SunMoon size={20} color="gray" title={getShortcutDescription('toggle-theme') || 'Toggle Theme'} />
) : (
<Moon size={20} color="gray" title={getShortcutDescription('toggle-theme') || 'Toggle Theme'} />
)}
</YStack>
</div>
<div className="flex h-8 w-full cursor-pointer items-center justify-center border-none bg-transparent">
<YStack
alignItems="center"
hoverStyle={{
backgroundColor: '$gray7',
}}
className="flex size-4/5 items-center justify-center rounded"
onPress={() => setShowVaultSetup(true)}
>
<GrNewWindow className="text-gray-100" color="gray" size={14} title="Open New Vault" />
</YStack>
</div>
<div
className="mb-[8px] flex h-8 w-full cursor-pointer items-center justify-center border-none bg-transparent"
onClick={() => setIsSettingsModalOpen(!isSettingsModalOpen)}
>
<YStack
alignItems="center"
hoverStyle={{
backgroundColor: '$gray7',
}}
className="flex size-4/5 items-center justify-center rounded"
>
<MdSettings color="gray" size={18} title={getShortcutDescription('open-settings-modal') || 'Settings'} />
</YStack>
</div>
<div>
{showVaultSetup && (
<InitialSetupSinglePage
readyForIndexing={handleAllInitialSettingsAreReady}
onClose={() => setShowVaultSetup(false)}
/>
)}
</div>
</YStack>
)
}
export default IconsSidebar