import { MenuContainer, MenuRow } from '@components/Menu' import { useNavigation } from '@react-navigation/native' import { useAnnouncementQuery } from '@utils/queryHooks/announcement' import { useListsQuery } from '@utils/queryHooks/lists' import { useAccountStorage } from '@utils/storage/actions' import React from 'react' import { useTranslation } from 'react-i18next' const Collections: React.FC = () => { const { t } = useTranslation(['screenAnnouncements', 'screenTabs']) const navigation = useNavigation() const [pageMe, setPageMe] = useAccountStorage.object('page_me') useListsQuery({ options: { onSuccess: data => setPageMe({ ...pageMe, lists: { shown: !!data?.length } }) } }) useAnnouncementQuery({ showAll: true, options: { onSuccess: data => setPageMe({ ...pageMe, announcements: { shown: !!data?.length ? true : false, unread: data?.filter(announcement => !announcement.read).length } }) } }) const [instancePush] = useAccountStorage.object('push') return ( navigation.navigate('Tab-Me-Conversations')} /> navigation.navigate('Tab-Me-Bookmarks')} /> navigation.navigate('Tab-Me-Favourites')} /> {pageMe.lists.shown ? ( navigation.navigate('Tab-Me-List-List')} /> ) : null} {pageMe.followedTags.shown ? ( navigation.navigate('Tab-Me-FollowedTags')} /> ) : null} {pageMe.announcements.shown ? ( navigation.navigate('Screen-Announcements', { showAll: true })} /> ) : null} navigation.navigate('Tab-Me-Push')} /> ) } export default Collections