This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(header): reduce spacing and align user menu access buttons (#11201)
* remove switch from header * updtae userMenu style * update userMenu style * fixes * fixes * update switchMode * update * fix blocking witch mode * fixes * Update www/front_src/src/Header/SwitchThemeMode/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * Update www/front_src/src/Header/SwitchThemeMode/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * fixes * fix ut of userMenu * Update www/front_src/src/Header/SwitchThemeMode/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * fixes * Update www/front_src/src/Header/userMenu/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * fixes * fix hooks sort * fix position of anchor * replace HOC with custom hook * fixes * fixes * fixes * enh position of popper * init visual test userMenu * userMenuTest * first fix * fix names * fix test * Update www/front_src/src/Header/SwitchThemeMode/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * Update www/front_src/src/Header/userMenu/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * Update www/front_src/src/Header/userMenu/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * Update www/front_src/src/Header/SwitchThemeMode/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * Update www/front_src/src/Header/userMenu/index.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * snapshots * fix and update tests * Update www/front_src/src/Header/userMenu/index.cypress.spec.tsx Co-authored-by: Bruno d'Auria <bdauria@centreon.com> * fix spacing * Update www/front_src/src/Header/userMenu/index.cypress.spec.tsx Co-authored-by: Tom Darneix <tomdar87@outlook.com> * fixes Co-authored-by: Tom Darneix <tomdar87@outlook.com> Co-authored-by: Bruno d'Auria <bdauria@centreon.com>
- Loading branch information
1 parent
b897835
commit 87f3d64
Showing
15 changed files
with
289 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"autologinkey": null, | ||
"fullname": "admin admin", | ||
"hasAccessToProfile": true, | ||
"locale": "en_US.UTF-8", | ||
"password_remaining_time": 15369910, | ||
"soundNotificationsEnabled": true, | ||
"timezone": "Europe/Paris", | ||
"userId": "1", | ||
"username": "admin" | ||
} |
Binary file added
BIN
+11.7 KB
.../User Menu -- style change for darklight texts when switch is clicked.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.1 KB
...ll Specs/User Menu -- expands the popper when the user icon is clicked.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.81 KB
...napshots/All Specs/User Menu -- matches the current snapshot user menu.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
www/front_src/src/Header/SwitchThemeMode/useSwitchThemeMode.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useTransition } from 'react'; | ||
|
||
import { useAtom } from 'jotai'; | ||
import { equals } from 'ramda'; | ||
|
||
import { userAtom, ThemeMode } from '@centreon/ui-context'; | ||
|
||
const useSwitchThemeMode = (): [ | ||
isDarkMode: boolean, | ||
isPending: boolean, | ||
themeMode: ThemeMode, | ||
updateUser: () => void, | ||
] => { | ||
const [user, setUser] = useAtom(userAtom); | ||
const isDarkMode = equals(user.themeMode, ThemeMode.dark); | ||
const [isPending, startTransition] = useTransition(); | ||
|
||
const themeMode = isDarkMode ? ThemeMode.light : ThemeMode.dark; | ||
const updateUser = (): void => | ||
startTransition(() => { | ||
setUser({ | ||
...user, | ||
themeMode, | ||
}); | ||
}); | ||
|
||
return [isPending, isDarkMode, themeMode, updateUser]; | ||
}; | ||
|
||
export default useSwitchThemeMode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { useLocaleDateTimeFormat } from '@centreon/ui'; | ||
|
||
export const centreonUi = { | ||
useLocaleDateTimeFormat, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.