@@ -33,7 +33,8 @@ import { NotificationsMenu } from '@/views/menus/NotificationsMenu';
3333
3434import { getOnboardingState } from '@/state/accountSelectors' ;
3535import { useAppDispatch , useAppSelector } from '@/state/appTypes' ;
36- import { getHasSeenLaunchIncentives } from '@/state/appUiConfigsSelectors' ;
36+ import { AppTheme , setAppThemeSetting } from '@/state/appUiConfigs' ;
37+ import { getAppTheme , getHasSeenLaunchIncentives } from '@/state/appUiConfigsSelectors' ;
3738import { openDialog } from '@/state/dialogs' ;
3839
3940import { isTruthy } from '@/lib/isTruthy' ;
@@ -46,9 +47,15 @@ export const HeaderDesktop = () => {
4647 const onboardingState = useAppSelector ( getOnboardingState ) ;
4748 const { complianceState } = useComplianceState ( ) ;
4849 const isSpotEnabled = useEnableSpot ( ) ;
50+ const currentTheme = useAppSelector ( getAppTheme ) ;
4951
5052 const hasSeenLaunchIncentives = useAppSelector ( getHasSeenLaunchIncentives ) ;
5153
54+ const handleThemeToggle = ( ) => {
55+ const newTheme = currentTheme === AppTheme . Dark ? AppTheme . Light : AppTheme . Dark ;
56+ dispatch ( setAppThemeSetting ( newTheme ) ) ;
57+ } ;
58+
5259 const navItems = [
5360 {
5461 group : 'navigation' ,
@@ -184,6 +191,12 @@ export const HeaderDesktop = () => {
184191 />
185192 ) }
186193
194+ < $ThemeToggleButton
195+ shape = { ButtonShape . Rectangle }
196+ iconName = { currentTheme === AppTheme . Dark ? IconName . Sun : IconName . Moon }
197+ onClick = { handleThemeToggle }
198+ />
199+
187200 < $AccountMenuWrapper >
188201 < AccountMenu />
189202 </ $AccountMenuWrapper >
@@ -290,6 +303,13 @@ const $IconButton = styled(IconButton)<{ size?: string }>`
290303 --button-padding: 0 0.5em;
291304` ;
292305
306+ const $ThemeToggleButton = styled ( IconButton ) `
307+ ${ headerMixins . button }
308+ --button-border: none;
309+ --button-icon-size: 1.25em;
310+ --button-padding: 0.33rem 0.5rem;
311+ ` ;
312+
293313const $LanguageSelector = styled ( LanguageSelector ) `
294314 ${ headerMixins . dropdownTrigger }
295315 --trigger-padding: 0.33rem 0.5rem;
0 commit comments