|
1 | 1 | import { LogIn, Monitor, Moon, Sun } from 'lucide-react' |
2 | | -import React, { useEffect, useMemo } from 'react' |
| 2 | +import React, { useMemo } from 'react' |
3 | 3 | import { useTranslation, withTranslation } from 'react-i18next' |
4 | 4 | import { withResizeDetector } from 'react-resize-detector' |
5 | 5 | import { Link, withRouter } from 'react-router-dom' |
@@ -76,27 +76,37 @@ const Navbar = ({ t, loggedInUser, isAuthenticated, loggedInUserLoading, locatio |
76 | 76 | const loginRedirect = getRedirectUrl() |
77 | 77 | const { resolvedTheme } = useTheme() |
78 | 78 | const isDarkMode = resolvedTheme === 'dark' |
79 | | - |
80 | | - const notificationsPopupStyle = useMemo(() => ({ |
81 | | - zIndex: 9999, |
82 | | - overflow: 'hidden', |
83 | | - backgroundColor: isDarkMode ? 'hsl(0, 0%, 12%)' : '#ffffff', |
84 | | - border: isDarkMode ? '1px solid hsl(0, 0%, 20%)' : '1px solid #d3d3d3', |
85 | | - borderRadius: '5px', |
86 | | - boxShadow: isDarkMode ? 'rgba(0, 0, 0, 0.3) 5px 10px 15px -6px' : 'rgba(150, 150, 150, 0.2) 5px 10px 15px -6px', |
87 | | - width: isMobile ? '95%' : '400px', |
88 | | - }), [isDarkMode, isMobile]) |
89 | | - |
90 | | - const userMenuPopupStyle = useMemo(() => ({ |
91 | | - zIndex: 9999, |
92 | | - overflow: 'hidden', |
93 | | - backgroundColor: isDarkMode ? 'hsl(0, 0%, 12%)' : '#ffffff', |
94 | | - border: isDarkMode ? '1px solid hsl(0, 0%, 20%)' : '1px solid #d3d3d3', |
95 | | - borderRadius: '5px', |
96 | | - boxShadow: isDarkMode ? 'rgba(0, 0, 0, 0.3) 5px 10px 15px -6px' : 'rgba(150, 150, 150, 0.2) 5px 10px 15px -6px', |
97 | | - minWidth: '200px', |
98 | | - }), [isDarkMode]) |
99 | | - |
| 79 | + |
| 80 | + const notificationsPopupStyle = useMemo( |
| 81 | + () => ({ |
| 82 | + zIndex: 9999, |
| 83 | + overflow: 'hidden', |
| 84 | + backgroundColor: isDarkMode ? 'hsl(0, 0%, 12%)' : '#ffffff', |
| 85 | + border: isDarkMode ? '1px solid hsl(0, 0%, 20%)' : '1px solid #d3d3d3', |
| 86 | + borderRadius: '5px', |
| 87 | + boxShadow: isDarkMode |
| 88 | + ? 'rgba(0, 0, 0, 0.3) 5px 10px 15px -6px' |
| 89 | + : 'rgba(150, 150, 150, 0.2) 5px 10px 15px -6px', |
| 90 | + width: isMobile ? '95%' : '400px', |
| 91 | + }), |
| 92 | + [isDarkMode, isMobile], |
| 93 | + ) |
| 94 | + |
| 95 | + const userMenuPopupStyle = useMemo( |
| 96 | + () => ({ |
| 97 | + zIndex: 9999, |
| 98 | + overflow: 'hidden', |
| 99 | + backgroundColor: isDarkMode ? 'hsl(0, 0%, 12%)' : '#ffffff', |
| 100 | + border: isDarkMode ? '1px solid hsl(0, 0%, 20%)' : '1px solid #d3d3d3', |
| 101 | + borderRadius: '5px', |
| 102 | + boxShadow: isDarkMode |
| 103 | + ? 'rgba(0, 0, 0, 0.3) 5px 10px 15px -6px' |
| 104 | + : 'rgba(150, 150, 150, 0.2) 5px 10px 15px -6px', |
| 105 | + minWidth: '200px', |
| 106 | + }), |
| 107 | + [isDarkMode], |
| 108 | + ) |
| 109 | + |
100 | 110 | return ( |
101 | 111 | <div data-cy="Navbar"> |
102 | 112 | <div className="h-[60px] w-full" /> |
@@ -174,7 +184,9 @@ const Navbar = ({ t, loggedInUser, isAuthenticated, loggedInUserLoading, locatio |
174 | 184 | <UserPicture size={USER_PICTURE_LARGE} user={loggedInUser} /> |
175 | 185 | <div className="flex flex-col justify-center"> |
176 | 186 | <UserAppellation user={loggedInUser} withoutActions /> |
177 | | - <span className="text-[0.8em] text-[#252525] dark:text-muted-foreground">{loggedInUser.email}</span> |
| 187 | + <span className="text-[0.8em] text-[#252525] dark:text-muted-foreground"> |
| 188 | + {loggedInUser.email} |
| 189 | + </span> |
178 | 190 | </div> |
179 | 191 | </div> |
180 | 192 | <InlineThemeSelector /> |
|
0 commit comments