diff options
-rw-r--r-- | src/components/notifications/Notification.tsx | 134 | ||||
-rw-r--r-- | src/types/types.ts | 2 |
2 files changed, 74 insertions, 62 deletions
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<NotificationProps> = (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<NotificationProps> = (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<NotificationProps> = (props) => { style={styles.avatarContainer}> <Avatar style={styles.avatar} uri={avatar} /> </TouchableWithoutFeedback> - {notification_type === 'SYSTEM_MSG' ? ( - // Only verbage - <View style={styles.contentContainer}> - <View style={styles.textContainerStyles}> - <Text style={styles.actorName}>{verbage}</Text> - <Text style={styles.timeStampStyles}> - {getTimeInShorthand(timestamp)} - </Text> + <> + {/* Text content: Actor name and verbage*/} + {notification_type === 'SYSTEM_MSG' || + notification_type === 'MOM_TAG' ? ( + // Only verbage + <View style={styles.contentContainer}> + <View style={styles.textContainerStyles}> + {notification_type === 'SYSTEM_MSG' ? ( + <Text style={styles.actorName}>{verbage}</Text> + ) : ( + <Text> + <Text style={styles.actorName}>{notification_title} </Text> + <Text style={styles.verbageStyles}>{verbage} </Text> + <Text style={styles.timeStampStyles}> + {getTimeInShorthand(timestamp)} + </Text> + </Text> + )} + </View> </View> - </View> - ) : ( - <> - {/* Text content: Actor name and verbage*/} + ) : ( <View style={styles.contentContainer}> <TouchableWithoutFeedback onPress={navigateToProfile}> <Text style={styles.actorName}>{notification_title}</Text> @@ -256,63 +266,63 @@ const Notification: React.FC<NotificationProps> = (props) => { <TouchableWithoutFeedback style={styles.textContainerStyles} onPress={onNotificationTap}> - <Text style={styles.verbageStyles}> - {verbage} + <Text> + <Text style={styles.verbageStyles}>{verbage} </Text> <Text style={styles.timeStampStyles}> - {' '} {getTimeInShorthand(timestamp)} </Text> </Text> {/* <Text style={styles.verbageStyles}>{verbage}</Text> */} </TouchableWithoutFeedback> </View> - {/* Friend request accept/decline button */} - {notification_type === 'FRD_REQ' && ( - <View style={styles.buttonsContainer}> - <AcceptDeclineButtons - requester={{id, username, first_name, last_name}} - onAccept={handleAcceptRequest} - onReject={handleDeclineFriendRequest} - /> - </View> - )} - {notification_type === 'FRD_ACPT' && ( - <View style={styles.buttonsContainer}> - <MessageButton - userXId={id} - isBlocked={false} - friendship_status={'friends'} - externalStyles={{ - container: { - width: normalize(63), - height: normalize(21), - marginTop: '7%', - }, - buttonTitle: { - fontSize: normalize(11), - lineHeight: normalize(13.13), - letterSpacing: normalize(0.5), - fontWeight: '700', - textAlign: 'center', - }, - }} - solid - /> - </View> + )} + {/* Friend request accept/decline button */} + {notification_type === 'FRD_REQ' && ( + <View style={styles.buttonsContainer}> + <AcceptDeclineButtons + requester={{id, username, first_name, last_name}} + onAccept={handleAcceptRequest} + onReject={handleDeclineFriendRequest} + /> + </View> + )} + {notification_type === 'FRD_ACPT' && ( + <View style={styles.buttonsContainer}> + <MessageButton + userXId={id} + isBlocked={false} + friendship_status={'friends'} + externalStyles={{ + container: { + width: normalize(63), + height: normalize(21), + marginTop: '7%', + }, + buttonTitle: { + fontSize: normalize(11), + lineHeight: normalize(13.13), + letterSpacing: normalize(0.5), + fontWeight: '700', + textAlign: 'center', + }, + }} + solid + /> + </View> + )} + {/* Moment Image Preview */} + {(notification_type === 'CMT' || + notification_type === 'MOM_3+' || + notification_type === 'MOM_TAG' || + notification_type === 'MOM_FRIEND') && + notification_object && ( + <TouchableWithoutFeedback + style={styles.moment} + onPress={onNotificationTap}> + <Image style={styles.imageFlex} source={{uri: momentURI}} /> + </TouchableWithoutFeedback> )} - {/* Moment Image Preview */} - {(notification_type === 'CMT' || - notification_type === 'MOM_3+' || - notification_type === 'MOM_FRIEND') && - notification_object && ( - <TouchableWithoutFeedback - style={styles.moment} - onPress={onNotificationTap}> - <Image style={styles.imageFlex} source={{uri: momentURI}} /> - </TouchableWithoutFeedback> - )} - </> - )} + </> </View> ); 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'; |