Compare commits

...

2 Commits

2 changed files with 9 additions and 3 deletions

View File

@ -52,7 +52,7 @@ const DashboardNavigation = () => {
const { userProfile } = useContext(AuthContext) const { userProfile } = useContext(AuthContext)
const { showSpotlight } = useContext(SpotlightContext) const { showSpotlight } = useContext(SpotlightContext)
const { connecting, connected } = useContext(ApiServerContext) const { connecting, connected } = useContext(ApiServerContext)
const { toggleNotificationCenter, unreadCount } = const { toggleNotificationCenter, unreadCount, notificationCenterVisible } =
useContext(NotificationContext) useContext(NotificationContext)
const [apiServerState, setApiServerState] = useState('disconnected') const [apiServerState, setApiServerState] = useState('disconnected')
const navigate = useNavigate() const navigate = useNavigate()
@ -335,7 +335,7 @@ const DashboardNavigation = () => {
<> <>
{isElectron ? ( {isElectron ? (
<Flex <Flex
className='ant-menu-horizontal ant-menu-light electron-navigation-wrapper' className={`ant-menu-horizontal ant-menu-light${!notificationCenterVisible ? ' electron-navigation-wrapper' : ''}`}
style={{ lineHeight: '40px', padding: '0 2px 0 2px' }} style={{ lineHeight: '40px', padding: '0 2px 0 2px' }}
> >
{navigationContents} {navigationContents}

View File

@ -19,7 +19,7 @@ const NotificationContext = createContext()
const NotificationProvider = ({ children }) => { const NotificationProvider = ({ children }) => {
const [api, contextHolder] = notification.useNotification() const [api, contextHolder] = notification.useNotification()
const location = useLocation() const location = useLocation()
const { authenticated } = useContext(AuthContext) const { authenticated, token } = useContext(AuthContext)
const { const {
showError, showError,
fetchNotificationsApi, fetchNotificationsApi,
@ -118,6 +118,12 @@ const NotificationProvider = ({ children }) => {
} }
}, [authenticated, notificationCenterVisible, fetchNotifications]) }, [authenticated, notificationCenterVisible, fetchNotifications])
useEffect(() => {
if (authenticated && token) {
fetchNotifications()
}
}, [authenticated, token, fetchNotifications])
useEffect(() => { useEffect(() => {
setNotificationCenterVisible(false) setNotificationCenterVisible(false)
}, [location.pathname]) }, [location.pathname])