diff --git a/apps/native/app/src/messages/en.ts b/apps/native/app/src/messages/en.ts index 2490a8017358..6792e2614ac4 100644 --- a/apps/native/app/src/messages/en.ts +++ b/apps/native/app/src/messages/en.ts @@ -281,6 +281,9 @@ export const en: TranslatedMessages = { 'notifications.markAllAsRead': 'Mark all as read', 'notifications.settings': 'My settings', 'notifications.errorUnknown': 'Error occurred while loading notifications', + 'notifications.emptyListTitle': 'No notifications', + 'notifications.emptyListDescription': + 'When you receive notifications, they will appear here.', // profile 'profile.screenTitle': 'More', diff --git a/apps/native/app/src/messages/is.ts b/apps/native/app/src/messages/is.ts index f6754c762e4c..c3bcdb5d8bf4 100644 --- a/apps/native/app/src/messages/is.ts +++ b/apps/native/app/src/messages/is.ts @@ -415,6 +415,9 @@ export const is = { 'notifications.markAllAsRead': 'Merkja allt lesið', 'notifications.settings': 'Mínar stillingar', 'notifications.errorUnknown': 'Villa kom upp við að sækja tilkynningar', + 'notifications.emptyListTitle': 'Engar tilkynningar', + 'notifications.emptyListDescription': + 'Þegar þú færð sendar tilkynningar þá birtast þær hér.', // applications screen 'applications.title': 'Umsóknir', diff --git a/apps/native/app/src/screens/inbox/inbox.tsx b/apps/native/app/src/screens/inbox/inbox.tsx index 334c2ae70252..308966c19068 100644 --- a/apps/native/app/src/screens/inbox/inbox.tsx +++ b/apps/native/app/src/screens/inbox/inbox.tsx @@ -217,6 +217,7 @@ function useInboxQuery(incomingFilters?: Filters) { ...(data.documentsV2?.data ?? []), ], totalCount: data.documentsV2?.totalCount ?? 0, + unreadCount: data.documentsV2?.unreadCount ?? 0, })) } else { setData(data.documentsV2) diff --git a/apps/native/app/src/screens/notifications/notifications.tsx b/apps/native/app/src/screens/notifications/notifications.tsx index 548498d79e15..aa54c3fe624a 100644 --- a/apps/native/app/src/screens/notifications/notifications.tsx +++ b/apps/native/app/src/screens/notifications/notifications.tsx @@ -4,13 +4,20 @@ import { NotificationCard, Problem, ListItemSkeleton, + EmptyList, } from '@ui' import { useApolloClient } from '@apollo/client' import { dismissAllNotificationsAsync } from 'expo-notifications' import React, { useCallback, useEffect, useMemo, useState } from 'react' import { useIntl } from 'react-intl' -import { ActivityIndicator, FlatList, SafeAreaView } from 'react-native' +import { + ActivityIndicator, + FlatList, + SafeAreaView, + View, + Image, +} from 'react-native' import { Navigation, NavigationFunctionComponent, @@ -37,6 +44,7 @@ import { isAndroid } from '../../utils/devices' import { testIDs } from '../../utils/test-ids' import settings from '../../assets/icons/settings.png' import inboxRead from '../../assets/icons/inbox-read.png' +import emptyIllustrationSrc from '../../assets/illustrations/le-company-s3.png' const LoadingWrapper = styled.View` padding-vertical: ${({ theme }) => theme.spacing[3]}px; @@ -47,10 +55,14 @@ const ButtonWrapper = styled.View` flex-direction: row; margin-horizontal: ${({ theme }) => theme.spacing[2]}px; margin-top: ${({ theme }) => theme.spacing[2]}px; + margin-bottom: ${({ theme }) => theme.spacing[2]}px; ` const DEFAULT_PAGE_SIZE = 50 +const FALLBACK_ICON_URL = + 'https://images.ctfassets.net/8k0h54kbe6bj/6XhCz5Ss17OVLxpXNVDxAO/d3d6716bdb9ecdc5041e6baf68b92ba6/coat_of_arms.svg' + const { getNavigationOptions, useNavigationOptions } = createNavigationOptionHooks(() => ({ topBar: { @@ -62,7 +74,12 @@ type NotificationItem = NonNullable< NonNullable['data'] >[0] -type ListItem = SkeletonItem | NotificationItem +export type EmptyItem = { + id: string + __typename: 'Empty' +} + +type ListItem = SkeletonItem | NotificationItem | EmptyItem export const NotificationsScreen: NavigationFunctionComponent = ({ componentId, @@ -123,6 +140,10 @@ export const NotificationsScreen: NavigationFunctionComponent = ({ return createSkeletonArr(9) } + if (data?.userNotifications?.data?.length === 0) { + return [{ id: '0', __typename: 'Empty' }] + } + return data?.userNotifications?.data || [] }, [data, loading]) @@ -185,6 +206,26 @@ export const NotificationsScreen: NavigationFunctionComponent = ({ return } + if (item.__typename === 'Empty') { + return ( + + + } + /> + + ) + } + return ( onNotificationPress(item)} testID={testIDs.NOTIFICATION_CARD_BUTTON} @@ -219,40 +260,6 @@ export const NotificationsScreen: NavigationFunctionComponent = ({ showLoading={loading && !!data} /> - -