22import { useState , useEffect , useCallback , useRef , useMemo } from 'react' ;
33import { useSelector } from 'react-redux' ;
44
5- export default function BellNotification ( ) {
5+ export default function BellNotification ( { userId } ) {
66 // State variables to manage notifications and UI state
77 const [ hasNotification , setHasNotification ] = useState ( false ) ;
88 const [ isDataReady , setIsDataReady ] = useState ( false ) ;
@@ -13,7 +13,13 @@ export default function BellNotification() {
1313 const timeEntries = useSelector ( state => state . timeEntries ?. weeks ?. [ 0 ] || [ ] ) ;
1414 const weeklycommittedHours = useSelector ( state => state . userProfile ?. weeklycommittedHours || 0 ) ;
1515 const darkMode = useSelector ( state => state . theme . darkMode ) ;
16- const userId = useSelector ( state => state . auth . user ?. userid ) ;
16+ // const userId = useSelector(state => {
17+ // console.log(state.auth)
18+ // return state.auth.user?.userid });
19+ // const checkSessionStorage = () => JSON.parse(sessionStorage.getItem('viewingUser')) ?? false;
20+ // const [viewingUser, setViewingUser] = useState(checkSessionStorage);
21+ // const [displayUserId, setDisplayUserId] = useState( viewingUser?.userId || userId);
22+
1723
1824 /**
1925 * Memoized function to calculate the total effort (hours + minutes) logged by the user
@@ -127,6 +133,10 @@ export default function BellNotification() {
127133 } ;
128134 } , [ ] ) ;
129135
136+ useEffect ( ( ) => {
137+ setIsDataReady ( false ) ;
138+ } , [ userId ] )
139+
130140 /**
131141 * Utility function to format time values in hours and minutes
132142 */
0 commit comments