@@ -112,6 +112,27 @@ export function RemixUiTopbar () {
112
112
}
113
113
} , [ global . fs . browser . workspaces , global . fs . browser . workspaces . length ] )
114
114
115
+ useEffect ( ( ) => {
116
+ plugin . on ( 'theme' , 'themeChanged' , ( theme ) => {
117
+ setCurrentTheme ( theme )
118
+ } )
119
+ return ( ) => {
120
+ plugin . off ( 'theme' , 'themeChanged' )
121
+ }
122
+ } , [ ] )
123
+
124
+ useEffect ( ( ) => {
125
+ async function loadCurrentTheme ( ) {
126
+ try {
127
+ const ct = await plugin . call ( 'theme' , 'currentTheme' )
128
+ setCurrentTheme ( ct )
129
+ } catch ( error ) {
130
+ console . error ( "Error fetching current theme:" , error )
131
+ }
132
+ }
133
+ loadCurrentTheme ( )
134
+ } , [ ] ) ;
135
+
115
136
const subItems = useMemo ( ( ) => {
116
137
return [
117
138
{ label : 'Rename' , onClick : renameCurrentWorkspace , icon : 'far fa-edit' } ,
@@ -284,20 +305,6 @@ export function RemixUiTopbar () {
284
305
)
285
306
}
286
307
287
- const getCurrentTheme = async ( ) => {
288
- const theme = await plugin . call ( 'theme' , 'currentTheme' )
289
- return theme
290
- }
291
-
292
- useEffect ( ( ) => {
293
- plugin . on ( 'theme' , 'themeChanged' , ( theme ) => {
294
- setCurrentTheme ( theme )
295
- } )
296
- return ( ) => {
297
- plugin . off ( 'theme' , 'themeChanged' )
298
- }
299
- } , [ ] )
300
-
301
308
const renameModalMessage = ( workspaceName ?: string ) => {
302
309
return (
303
310
< div className = 'd-flex flex-column' >
@@ -332,8 +339,7 @@ export function RemixUiTopbar () {
332
339
)
333
340
}
334
341
335
- const checkIfLightTheme = ( themeName : string ) =>
336
- themeName . includes ( 'dark' ) || themeName . includes ( 'black' ) || themeName . includes ( 'hackerOwl' ) ? false : true
342
+ const checkIfLightTheme = ( themeName : string ) => themeName . includes ( 'dark' ) ? false : true
337
343
338
344
const IsGitRepoDropDownMenuItem = ( props : { isGitRepo : boolean , mName : string } ) => {
339
345
return (
@@ -536,8 +542,6 @@ export function RemixUiTopbar () {
536
542
fontSize : '0.8rem'
537
543
} }
538
544
onClick = { async ( ) => {
539
- const theme = await getCurrentTheme ( )
540
- setCurrentTheme ( theme )
541
545
setShowTheme ( ! showTheme )
542
546
} }
543
547
>
0 commit comments