diff options
Diffstat (limited to 'src/view/shell')
-rw-r--r-- | src/view/shell/Drawer.tsx | 10 | ||||
-rw-r--r-- | src/view/shell/bottom-bar/BottomBar.tsx | 10 | ||||
-rw-r--r-- | src/view/shell/desktop/LeftNav.tsx | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/view/shell/Drawer.tsx b/src/view/shell/Drawer.tsx index 609348e4d..8a84a07c6 100644 --- a/src/view/shell/Drawer.tsx +++ b/src/view/shell/Drawer.tsx @@ -49,6 +49,7 @@ import {useSetDrawerOpen} from '#/state/shell' import {useModalControls} from '#/state/modals' import {useSession, SessionAccount} from '#/state/session' import {useProfileQuery} from '#/state/queries/profile' +import {useUnreadNotifications} from '#/state/queries/notifications/unread' export function DrawerProfileCard({ account, @@ -110,8 +111,7 @@ export const DrawerContent = observer(function DrawerContentImpl() { const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} = useNavigationTabState() const {currentAccount} = useSession() - - const {notifications} = store.me + const numUnreadNotifications = useUnreadNotifications() // events // = @@ -286,11 +286,11 @@ export const DrawerContent = observer(function DrawerContentImpl() { label="Notifications" accessibilityLabel={_(msg`Notifications`)} accessibilityHint={ - notifications.unreadCountLabel === '' + numUnreadNotifications === '' ? '' - : `${notifications.unreadCountLabel} unread` + : `${numUnreadNotifications} unread` } - count={notifications.unreadCountLabel} + count={numUnreadNotifications} bold={isAtNotifications} onPress={onPressNotifications} /> diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 3dd7f57c5..81552635f 100644 --- a/src/view/shell/bottom-bar/BottomBar.tsx +++ b/src/view/shell/bottom-bar/BottomBar.tsx @@ -28,6 +28,7 @@ import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' import {useModalControls} from '#/state/modals' import {useShellLayout} from '#/state/shell/shell-layout' +import {useUnreadNotifications} from '#/state/queries/notifications/unread' type TabOptions = 'Home' | 'Search' | 'Notifications' | 'MyProfile' | 'Feeds' @@ -43,9 +44,8 @@ export const BottomBar = observer(function BottomBarImpl({ const {footerHeight} = useShellLayout() const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} = useNavigationTabState() - + const numUnreadNotifications = useUnreadNotifications() const {footerMinimalShellTransform} = useMinimalShellMode() - const {notifications} = store.me const onPressTab = React.useCallback( (tab: TabOptions) => { @@ -178,14 +178,14 @@ export const BottomBar = observer(function BottomBarImpl({ ) } onPress={onPressNotifications} - notificationCount={notifications.unreadCountLabel} + notificationCount={numUnreadNotifications} accessible={true} accessibilityRole="tab" accessibilityLabel={_(msg`Notifications`)} accessibilityHint={ - notifications.unreadCountLabel === '' + numUnreadNotifications === '' ? '' - : `${notifications.unreadCountLabel} unread` + : `${numUnreadNotifications} unread` } /> <Btn diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 0586323b4..c9a03ce62 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -43,6 +43,7 @@ import {useLingui} from '@lingui/react' import {Trans, msg} from '@lingui/macro' import {useProfileQuery} from '#/state/queries/profile' import {useSession} from '#/state/session' +import {useUnreadNotifications} from '#/state/queries/notifications/unread' const ProfileCard = observer(function ProfileCardImpl() { const {currentAccount} = useSession() @@ -253,6 +254,7 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { const store = useStores() const pal = usePalette('default') const {isDesktop, isTablet} = useWebMediaQueries() + const numUnread = useUnreadNotifications() return ( <View @@ -314,7 +316,7 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { /> <NavItem href="/notifications" - count={store.me.notifications.unreadCountLabel} + count={numUnread} icon={ <BellIcon strokeWidth={2} |