diff --git a/src/components/notification/view/notificationView.tsx b/src/components/notification/view/notificationView.tsx index d4112a304..7f2a38522 100644 --- a/src/components/notification/view/notificationView.tsx +++ b/src/components/notification/view/notificationView.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/jsx-wrap-multilines */ import React, { PureComponent } from 'react'; -import { View, FlatList, ActivityIndicator, RefreshControl, Text, SectionList } from 'react-native'; +import { View, FlatList, ActivityIndicator, RefreshControl, Text } from 'react-native'; import { injectIntl } from 'react-intl'; // Constants @@ -13,7 +13,7 @@ import { ListPlaceHolder } from '../../basicUIElements'; import { ThemeContainer } from '../../../containers'; // Utils -import { isToday, isYesterday, isThisWeek, isThisMonth } from '../../../utils/time'; +import { isToday, isYesterday, isThisWeek, isLastWeek, isThisMonth } from '../../../utils/time'; // Styles import styles from './notificationStyles'; @@ -109,6 +109,12 @@ class NotificationView extends PureComponent { }), data: [], }, + { + title: intl.formatMessage({ + id: 'notification.last_week', + }), + data: [], + }, { title: intl.formatMessage({ id: 'notification.this_month', @@ -152,11 +158,15 @@ class NotificationView extends PureComponent { return 2; } - if (isThisMonth(timestamp)) { + if (isLastWeek(timestamp)) { return 3; } - return 4; + if (isThisMonth(timestamp)) { + return 4; + } + + return 5; }; diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index e83ae416f..00a9a183d 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -128,6 +128,7 @@ "recent": "Recent", "yesterday": "Yesterday", "this_week": "This Week", + "last_week": "Last Week", "this_month": "This Month", "older_then": "Older Than A Month", "activities": "All", diff --git a/src/utils/time.js b/src/utils/time.js index 5a2816283..b50e3820d 100644 --- a/src/utils/time.js +++ b/src/utils/time.js @@ -93,6 +93,11 @@ export const isThisWeek = (value) => { return day < TODAY.getTime() && day > SEVEN_DAY.getTime(); }; +export const isLastWeek = (value) => { + const day = new Date(value).getTime(); + return day < SEVEN_DAY.getTime() && day > 2 * SEVEN_DAY.getTime(); +}; + export const isThisMonth = (value) => { const day = new Date(value); return TODAY.getMonth() === day.getMonth() && TODAY.getFullYear() === day.getFullYear() ? 1 : 0;