@@ -40,6 +40,7 @@ import {
4040} from "@/components/ui/context-menu" ;
4141import { Input } from "@/components/ui/input" ;
4242import { Skeleton } from "@/components/ui/skeleton" ;
43+ import { useTranslation } from "@/app/i18n" ;
4344
4445interface Project {
4546 id : number ;
@@ -53,6 +54,7 @@ const Sidebar = ({
5354 setSelectedProject,
5455 refreshProjects,
5556} : any ) => {
57+ const { t } = useTranslation ( "common" ) ;
5658 const [ projects , setProjects ] = useState < Project [ ] > ( [ ] ) ;
5759 const [ isLoading , setIsLoading ] = useState ( true ) ;
5860 const [ isDeleteDialogOpen , setIsDeleteDialogOpen ] = useState ( false ) ;
@@ -122,7 +124,7 @@ const Sidebar = ({
122124 variant = { "secondary" }
123125 onClick = { ( ) => setSelectedProject ( null ) }
124126 >
125- < Plus className = "mr-2" /> New Project
127+ < Plus className = "mr-2" /> { t ( "new-project" ) }
126128 </ Button >
127129 < div className = "mt-4 flex flex-row justify-between space-x-2" >
128130 < Select
@@ -131,43 +133,51 @@ const Sidebar = ({
131133 defaultValue = "date_modified"
132134 >
133135 < SelectTrigger className = "text-black dark:text-white dark:border-gray-700 dark:bg-gray-800" >
134- < SelectValue placeholder = "Sort By" />
136+ < SelectValue placeholder = { t ( "sort-by" ) } />
135137 </ SelectTrigger >
136138 < SelectContent className = "dark:bg-gray-800 dark:border-gray-700" >
137139 < SelectItem
138140 className = "dark:text-white dark:bg-gray-800 dark:hover:bg-gray-700 dark:hover:text-white"
139141 value = "name"
140142 >
141- Name
143+ { t ( "name" ) }
142144 </ SelectItem >
143145 < SelectItem
144146 className = "dark:text-white dark:bg-gray-800 dark:hover:bg-gray-700 dark:hover:text-white"
145147 value = "date_created"
146148 >
147- Date Created
149+ { t ( "date-created" ) }
148150 </ SelectItem >
149151 < SelectItem
150152 className = "dark:text-white dark:bg-gray-800 dark:hover:bg-gray-700 dark:hover:text-white"
151153 value = "date_modified"
152154 >
153- Date Modified
155+ { t ( "date-modified" ) }
154156 </ SelectItem >
155157 </ SelectContent >
156158 </ Select >
157159
158- < Button className = "text-black dark:bg-gray-900 dark:text-white dark:hover:bg-gray-700" variant = { "secondary" } onClick = { ( ) => setSortAsc ( ! sortAsc ) } >
160+ < Button
161+ className = "text-black dark:bg-gray-900 dark:text-white dark:hover:bg-gray-700"
162+ variant = { "secondary" }
163+ onClick = { ( ) => setSortAsc ( ! sortAsc ) }
164+ >
159165 { sortAsc ? < SortAsc /> : < SortDesc /> }
160166 </ Button >
161167 </ div >
162168 < div className = "mt-4 flex flex-row justify-between space-x-2" >
163169 < Input
164170 type = "text"
165- placeholder = "Search projects..."
171+ placeholder = { t ( "search- projects" ) }
166172 value = { searchTerm }
167173 onChange = { ( e ) => setSearchTerm ( e . target . value ) }
168174 className = "text-black dark:text-white dark:bg-gray-800 dark:border-gray-700"
169175 />
170- < Button className = "text-black dark:bg-gray-900 dark:text-white dark:hover:bg-gray-700" variant = { "secondary" } onClick = { handleSearch } >
176+ < Button
177+ className = "text-black dark:bg-gray-900 dark:text-white dark:hover:bg-gray-700"
178+ variant = { "secondary" }
179+ onClick = { handleSearch }
180+ >
171181 < Search className = "w-4 h-4" />
172182 </ Button >
173183 </ div >
@@ -205,16 +215,16 @@ const Sidebar = ({
205215 </ ContextMenuTrigger >
206216 < ContextMenuContent >
207217 < ContextMenuItem onClick = { ( ) => setSelectedProject ( project ) } >
208- Edit
218+ { t ( "edit" ) }
209219 </ ContextMenuItem >
210220 < ContextMenuItem onClick = { ( ) => handleDelete ( project . id ) } >
211- Delete
221+ { t ( "delete" ) }
212222 </ ContextMenuItem >
213223 < ContextMenuItem onClick = { ( ) => handleFocus ( project . id ) } >
214- Focus Project
224+ { t ( "focus-project" ) }
215225 </ ContextMenuItem >
216226 < ContextMenuItem onClick = { ( ) => handleShare ( project ) } >
217- Share
227+ { t ( "share" ) }
218228 </ ContextMenuItem >
219229 </ ContextMenuContent >
220230 </ ContextMenu >
@@ -232,19 +242,19 @@ const Sidebar = ({
232242 < Dialog open = { isDeleteDialogOpen } onOpenChange = { setIsDeleteDialogOpen } >
233243 < DialogContent >
234244 < DialogHeader >
235- < DialogTitle > Delete Project </ DialogTitle >
245+ < DialogTitle > { t ( "delete-project" ) } </ DialogTitle >
236246 </ DialogHeader >
237247 < DialogDescription >
238- Are you sure you want to delete this project?
248+ { t ( " delete- project-description" ) }
239249 </ DialogDescription >
240250 < DialogFooter >
241251 < Button
242252 variant = "secondary"
243253 onClick = { ( ) => setIsDeleteDialogOpen ( false ) }
244254 >
245- Cancel
255+ { t ( "cancel" ) }
246256 </ Button >
247- < Button onClick = { confirmDelete } > Delete </ Button >
257+ < Button onClick = { confirmDelete } > { t ( "delete" ) } </ Button >
248258 </ DialogFooter >
249259 </ DialogContent >
250260 </ Dialog >
@@ -253,7 +263,7 @@ const Sidebar = ({
253263 < Dialog open = { isShareDialogOpen } onOpenChange = { setIsShareDialogOpen } >
254264 < DialogContent >
255265 < DialogHeader >
256- < DialogTitle > Share Project </ DialogTitle >
266+ < DialogTitle > { t ( "share-project" ) } </ DialogTitle >
257267 </ DialogHeader >
258268 < DialogDescription >
259269 < div className = "flex flex-row items-center gap-2" >
@@ -296,7 +306,7 @@ const Sidebar = ({
296306 variant = "secondary"
297307 onClick = { ( ) => setIsShareDialogOpen ( false ) }
298308 >
299- Close
309+ { t ( "close" ) }
300310 </ Button >
301311 </ DialogFooter >
302312 </ DialogContent >
0 commit comments