@@ -13,10 +13,21 @@ import { useChatContext } from '@/contexts/ChatContext'
13
13
import { useContentContext } from '@/contexts/ContentContext'
14
14
import NewDirectoryComponent from '../File/NewDirectory'
15
15
16
- const IconsSidebar : React . FC = ( ) => {
16
+ export interface IconsSidebarProps {
17
+ readonly getShortcutDescription : ( action : string ) => string
18
+
19
+ readonly isNewDirectoryModalOpen : boolean
20
+
21
+ readonly setIsNewDirectoryModalOpen : React . Dispatch < React . SetStateAction < boolean > >
22
+ }
23
+
24
+ const IconsSidebar : React . FC < IconsSidebarProps > = ( {
25
+ getShortcutDescription,
26
+ isNewDirectoryModalOpen,
27
+ setIsNewDirectoryModalOpen,
28
+ } ) => {
17
29
const { sidebarShowing, setSidebarShowing } = useChatContext ( )
18
30
const [ sidebarWidth , setSidebarWidth ] = useState < number > ( 40 )
19
- const [ isNewDirectoryModalOpen , setIsNewDirectoryModalOpen ] = useState ( false )
20
31
21
32
const { isSettingsModalOpen, setIsSettingsModalOpen, setIsFlashcardModeOpen } = useModalOpeners ( )
22
33
const { createUntitledNote } = useContentContext ( )
@@ -50,7 +61,7 @@ const IconsSidebar: React.FC = () => {
50
61
className = "mx-auto text-gray-200"
51
62
color = { sidebarShowing === 'files' ? 'white' : 'gray' }
52
63
size = { 18 }
53
- title = " Files"
64
+ title = { getShortcutDescription ( 'open-files' ) || 'Open Files' }
54
65
/>
55
66
</ div >
56
67
</ div >
@@ -63,7 +74,7 @@ const IconsSidebar: React.FC = () => {
63
74
color = { sidebarShowing === 'chats' ? 'white' : 'gray' }
64
75
className = "cursor-pointer text-gray-100 "
65
76
size = { 18 }
66
- title = { sidebarShowing === 'chats' ? 'Close Chatbot' : 'Open Chatbot' }
77
+ title = { getShortcutDescription ( 'open-chat-bot' ) || 'Open Chatbot' }
67
78
/>
68
79
</ div >
69
80
</ div >
@@ -76,7 +87,7 @@ const IconsSidebar: React.FC = () => {
76
87
color = { sidebarShowing === 'search' ? 'white' : 'gray' }
77
88
size = { 18 }
78
89
className = "text-gray-200"
79
- title = " Semantic Search"
90
+ title = { getShortcutDescription ( 'open-search' ) || ' Semantic Search' }
80
91
/>
81
92
</ div >
82
93
</ div >
@@ -85,23 +96,38 @@ const IconsSidebar: React.FC = () => {
85
96
onClick = { ( ) => createUntitledNote ( ) }
86
97
>
87
98
< div className = "flex size-4/5 items-center justify-center rounded hover:bg-neutral-700" >
88
- < HiOutlinePencilAlt className = "text-gray-200" color = "gray" size = { 22 } title = "New Note" />
99
+ < HiOutlinePencilAlt
100
+ className = "text-gray-200"
101
+ color = "gray"
102
+ size = { 22 }
103
+ title = { getShortcutDescription ( 'open-new-note' ) || 'New Note' }
104
+ />
89
105
</ div >
90
106
</ div >
91
107
< div
92
108
className = "mt-[2px] flex h-8 w-full cursor-pointer items-center justify-center border-none bg-transparent "
93
109
onClick = { ( ) => setIsNewDirectoryModalOpen ( true ) }
94
110
>
95
111
< div className = "flex size-4/5 items-center justify-center rounded hover:bg-neutral-700" >
96
- < VscNewFolder className = "text-gray-200" color = "gray" size = { 18 } title = "New Directory" />
112
+ < VscNewFolder
113
+ className = "text-gray-200"
114
+ color = "gray"
115
+ size = { 18 }
116
+ title = { getShortcutDescription ( 'open-new-directory-modal' ) || 'New Directory' }
117
+ />
97
118
</ div >
98
119
</ div >
99
120
< div
100
121
className = "flex h-8 w-full cursor-pointer items-center justify-center border-none bg-transparent "
101
122
onClick = { ( ) => setIsFlashcardModeOpen ( true ) }
102
123
>
103
124
< div className = "flex size-4/5 items-center justify-center rounded hover:bg-neutral-700" >
104
- < MdOutlineQuiz className = "text-gray-200" color = "gray" size = { 19 } title = "Flashcard quiz" />
125
+ < MdOutlineQuiz
126
+ className = "text-gray-200"
127
+ color = "gray"
128
+ size = { 19 }
129
+ title = { getShortcutDescription ( 'open-flashcard-quiz-modal' ) || 'Flashcard quiz' }
130
+ />
105
131
</ div >
106
132
</ div >
107
133
@@ -118,13 +144,14 @@ const IconsSidebar: React.FC = () => {
118
144
type = "button"
119
145
aria-label = "Open Settings"
120
146
>
121
- < MdSettings color = "gray" size = { 18 } className = "mb-3 size-6 text-gray-100" title = "Settings" />
147
+ < MdSettings
148
+ color = "gray"
149
+ size = { 18 }
150
+ className = "mb-3 size-6 text-gray-100"
151
+ title = { getShortcutDescription ( 'open-settings-modal' ) || 'Settings' }
152
+ />
122
153
</ button >
123
- < NewDirectoryComponent
124
- isOpen = { isNewDirectoryModalOpen }
125
- onClose = { ( ) => setIsNewDirectoryModalOpen ( false ) }
126
- // parentDirectoryPath={parentDirectoryPathForNewDirectory}
127
- />
154
+ < NewDirectoryComponent isOpen = { isNewDirectoryModalOpen } onClose = { ( ) => setIsNewDirectoryModalOpen ( false ) } />
128
155
</ div >
129
156
)
130
157
}
0 commit comments