diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/notifications/Notification.tsx | 147 | ||||
-rw-r--r-- | src/types/types.ts | 2 |
2 files changed, 79 insertions, 70 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index cb62047a..3f9cc56a 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,83 +238,88 @@ const Notification: React.FC<NotificationProps> = (props) => { style={styles.avatarContainer}> <Avatar style={styles.avatar} uri={avatar} /> </TouchableWithoutFeedback> - {notification_type === 'SYSTEM_MSG' ? ( - // Only verbage + {notification_type === 'SYSTEM_MSG' || notification_type === 'MOM_TAG' ? ( + // Single-line body text with timestamp <View style={styles.contentContainer}> <View style={styles.textContainerStyles}> - <Text style={styles.actorName}>{verbage}</Text> - <Text style={styles.timeStampStyles}> - {getTimeInShorthand(timestamp)} - </Text> - </View> - </View> - ) : ( - <> - {/* Text content: Actor name and verbage*/} - <View style={styles.contentContainer}> - <TouchableWithoutFeedback onPress={navigateToProfile}> - <Text style={styles.actorName}>{notification_title}</Text> - </TouchableWithoutFeedback> - <TouchableWithoutFeedback - style={styles.textContainerStyles} - onPress={onNotificationTap}> - <Text style={styles.verbageStyles}> - {verbage} + {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> - {/* <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> - )} - {/* 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> + </View> + ) : ( + // Two-line title and body text with timestamp + <View style={styles.contentContainer}> + <TouchableWithoutFeedback onPress={navigateToProfile}> + <Text style={styles.actorName}>{notification_title}</Text> + </TouchableWithoutFeedback> + <TouchableWithoutFeedback + style={styles.textContainerStyles} + onPress={onNotificationTap}> + <Text> + <Text style={styles.verbageStyles}>{verbage} </Text> + <Text style={styles.timeStampStyles}> + {getTimeInShorthand(timestamp)} + </Text> + </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> + )} + {/* Message button when user accepts friend request */} + {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> + )} </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'; |