From c758829621b78aadfb17c52da81aa2cba28dbf4d Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Mon, 1 Feb 2021 17:44:11 -0500 Subject: first version --- src/components/notifications/Notification.tsx | 14 ++++++++++++++ src/types/types.ts | 19 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index e0ae231e..265c21b1 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -166,6 +166,20 @@ const Notification: React.FC = (props) => { }, 500); } break; + case 'MOMENT_3+': + case 'MOMENT_FRIEND': + const object = notification_object as MomentType; + await fetchUserX( + dispatch, + {userId: id, username: username}, + screenType, + ); + navigation.push('IndividualMoment', { + moment: object, + userXId: id, + screenType, + }); + break; default: break; } diff --git a/src/types/types.ts b/src/types/types.ts index 1775cd5f..f5f96278 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -179,10 +179,25 @@ export type TaggPopupType = { export type NotificationType = { actor: ProfilePreviewType; verbage: string; - notification_type: 'DFT' | 'FRD_REQ' | 'FRD_ACPT' | 'FRD_DEC' | 'CMT'; - notification_object: CommentType | CommentThreadType | undefined; + notification_type: TypeOfNotification; + notification_object: CommentType | CommentThreadType | MomentType | undefined; timestamp: string; unread: boolean; }; export type TypeOfComment = 'Comment' | 'Thread'; +export type TypeOfNotification = + // notification_object is undefined + | 'DFT' + // notification_object is undefined + | 'FRD_REQ' + // notification_object is undefined + | 'FRD_ACPT' + // notification_object is undefined + | 'FRD_DEC' + // notification_object is CommentType || CommentThreadType + | 'CMT' + // notification_object is MomentType + | 'MOMENT_3+' + // notification_object is MomentType + | 'MOMENT_FRIEND'; -- cgit v1.2.3-70-g09d2