this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Auto-refresh notifications in notifications menu

+25 -13
+6 -6
src/locales/en.po
··· 1409 1409 #: src/components/nav-menu.jsx:204 1410 1410 #: src/components/shortcuts-settings.jsx:58 1411 1411 #: src/components/shortcuts-settings.jsx:146 1412 - #: src/pages/home.jsx:228 1412 + #: src/pages/home.jsx:240 1413 1413 #: src/pages/mentions.jsx:21 1414 1414 #: src/pages/mentions.jsx:174 1415 1415 #: src/pages/settings.jsx:1163 ··· 1422 1422 #: src/components/shortcuts-settings.jsx:152 1423 1423 #: src/pages/filters.jsx:24 1424 1424 #: src/pages/home.jsx:86 1425 - #: src/pages/home.jsx:186 1425 + #: src/pages/home.jsx:198 1426 1426 #: src/pages/notifications.jsx:117 1427 1427 #: src/pages/notifications.jsx:591 1428 1428 msgid "Notifications" ··· 2520 2520 msgstr "" 2521 2521 2522 2522 #: src/components/timeline.jsx:586 2523 - #: src/pages/home.jsx:216 2523 + #: src/pages/home.jsx:228 2524 2524 #: src/pages/notifications.jsx:898 2525 2525 #: src/pages/status.jsx:1019 2526 2526 #: src/pages/status.jsx:1396 ··· 3262 3262 msgid "Go to my instance (<0>{currentInstance}</0>)" 3263 3263 msgstr "" 3264 3264 3265 - #: src/pages/home.jsx:212 3265 + #: src/pages/home.jsx:224 3266 3266 msgid "Unable to fetch notifications." 3267 3267 msgstr "" 3268 3268 3269 - #: src/pages/home.jsx:233 3269 + #: src/pages/home.jsx:245 3270 3270 msgid "<0>New</0> <1>Follow Requests</1>" 3271 3271 msgstr "" 3272 3272 3273 - #: src/pages/home.jsx:239 3273 + #: src/pages/home.jsx:251 3274 3274 msgid "See all" 3275 3275 msgstr "" 3276 3276
+19 -7
src/pages/home.jsx
··· 140 140 }); 141 141 } 142 142 143 - function loadNotifications() { 143 + function loadNotifications({ skipFollowRequests = false } = {}) { 144 144 setUIState('loading'); 145 145 (async () => { 146 146 try { 147 147 await fetchNotifications(); 148 - const followRequests = await fetchFollowRequests(); 149 - setHasFollowRequests(!!followRequests?.length); 148 + if (!skipFollowRequests) { 149 + const followRequests = await fetchFollowRequests(); 150 + setHasFollowRequests(!!followRequests?.length); 151 + } 150 152 setUIState('default'); 151 153 } catch (e) { 152 154 setUIState('error'); ··· 154 156 })(); 155 157 } 156 158 157 - useEffect(() => { 158 - if (state === 'open') loadNotifications(); 159 - }, [state]); 160 - 161 159 const menuRef = useRef(); 160 + const headerHeight = 52; 161 + useEffect(() => { 162 + if (state !== 'open') return; 163 + if (snapStates.notificationsShowNew) { 164 + const menuElement = menuRef.current; 165 + if (menuElement?.scrollTop <= headerHeight) { 166 + loadNotifications({ 167 + skipFollowRequests: true, 168 + }); 169 + } 170 + } else { 171 + loadNotifications(); 172 + } 173 + }, [state, snapStates.notificationsShowNew]); 162 174 163 175 return ( 164 176 <ControlledMenu