From a472f6387b9530ce440cb02101b5b778875f04a1 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 20 May 2021 23:30:18 -0400 Subject: Add support for moment tag notifications --- src/components/notifications/Notification.tsx | 134 ++++++++++++++------------ src/types/types.ts | 2 + 2 files changed, 74 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index cb62047a..b0692c9e 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -84,7 +84,8 @@ const Notification: React.FC = (props) => { let obj; if ( notification_type === 'MOM_3+' || - notification_type === 'MOM_FRIEND' + notification_type === 'MOM_FRIEND' || + notification_type === 'MOM_TAG' ) { obj = notification_object as MomentType; url = obj.thumbnail_url; @@ -185,6 +186,7 @@ const Notification: React.FC = (props) => { break; case 'MOM_3+': case 'MOM_FRIEND': + case 'MOM_TAG': const object = notification_object as MomentType; await fetchUserX( dispatch, @@ -236,19 +238,27 @@ const Notification: React.FC = (props) => { style={styles.avatarContainer}> - {notification_type === 'SYSTEM_MSG' ? ( - // Only verbage - - - {verbage} - - {getTimeInShorthand(timestamp)} - + <> + {/* Text content: Actor name and verbage*/} + {notification_type === 'SYSTEM_MSG' || + notification_type === 'MOM_TAG' ? ( + // Only verbage + + + {notification_type === 'SYSTEM_MSG' ? ( + {verbage} + ) : ( + + {notification_title} + {verbage} + + {getTimeInShorthand(timestamp)} + + + )} + - - ) : ( - <> - {/* Text content: Actor name and verbage*/} + ) : ( {notification_title} @@ -256,63 +266,63 @@ const Notification: React.FC = (props) => { - - {verbage} + + {verbage} - {' '} {getTimeInShorthand(timestamp)} {/* {verbage} */} - {/* Friend request accept/decline button */} - {notification_type === 'FRD_REQ' && ( - - - - )} - {notification_type === 'FRD_ACPT' && ( - - - + )} + {/* Friend request accept/decline button */} + {notification_type === 'FRD_REQ' && ( + + + + )} + {notification_type === 'FRD_ACPT' && ( + + + + )} + {/* Moment Image Preview */} + {(notification_type === 'CMT' || + notification_type === 'MOM_3+' || + notification_type === 'MOM_TAG' || + notification_type === 'MOM_FRIEND') && + notification_object && ( + + + )} - {/* Moment Image Preview */} - {(notification_type === 'CMT' || - notification_type === 'MOM_3+' || - notification_type === 'MOM_FRIEND') && - notification_object && ( - - - - )} - - )} + ); diff --git a/src/types/types.ts b/src/types/types.ts index e9975529..e1935d26 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -240,6 +240,8 @@ export type TypeOfNotification = | 'MOM_FRIEND' // notification_object is undefined | 'INVT_ONBRD' + // notification_object is MomentType + | 'MOM_TAG' // notification_object is undefined | 'SYSTEM_MSG'; -- cgit v1.2.3-70-g09d2