diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-21 13:25:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 13:25:23 -0400 |
commit | cdc90fee17175bbf2015b40f18652f75799671a4 (patch) | |
tree | 01c920c8abbfff3bfcc605fc98cd96852f6ef824 /src/components/notifications | |
parent | fa39bb545fefefeea1a941c6610e6f072dba6f61 (diff) | |
parent | e050709c3be4e9bae828caa6a01bfdab5f4bcfcf (diff) |
Merge pull request #372 from IvanIFChen/tma378-viewed-your-profile
[TMA-378] Viewed your profile
Diffstat (limited to 'src/components/notifications')
-rw-r--r-- | src/components/notifications/Notification.tsx | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index 8e008cf9..3cc1c7f1 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -208,6 +208,9 @@ const Notification: React.FC<NotificationProps> = (props) => { const isOwnProfile = id === loggedInUser.userId; const navigateToProfile = async () => { + if (notification_type === 'SYSTEM_MSG') { + return; + } if (!userXInStore(state, screenType, id)) { await fetchUserX(dispatch, {userId: id, username: username}, screenType); } @@ -231,35 +234,47 @@ const Notification: React.FC<NotificationProps> = (props) => { } /> </TouchableWithoutFeedback> - <View style={styles.contentContainer}> - <TouchableWithoutFeedback onPress={navigateToProfile}> - <Text style={styles.actorName}> - {first_name} {last_name} - </Text> - </TouchableWithoutFeedback> - <TouchableWithoutFeedback onPress={onNotificationTap}> - <Text>{verbage}</Text> - </TouchableWithoutFeedback> - </View> - {notification_type === 'FRD_REQ' && ( - <View style={styles.buttonsContainer}> - <AcceptDeclineButtons - requester={{id, username, first_name, last_name}} - onAccept={handleAcceptRequest} - onReject={handleDeclineFriendRequest} - /> + {notification_type === 'SYSTEM_MSG' ? ( + // Only verbage + <View style={styles.contentContainer}> + <Text style={styles.actorName}>{verbage}</Text> </View> + ) : ( + <> + {/* Text content: Actor name and verbage*/} + <View style={styles.contentContainer}> + <TouchableWithoutFeedback onPress={navigateToProfile}> + <Text style={styles.actorName}> + {first_name} {last_name} + </Text> + </TouchableWithoutFeedback> + <TouchableWithoutFeedback onPress={onNotificationTap}> + <Text>{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> + )} + {/* 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> + )} + </> )} - {(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> ); |