aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/notifications/Notification.tsx71
-rw-r--r--src/types/types.ts4
2 files changed, 47 insertions, 28 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx
index 8e008cf9..d66ca45e 100644
--- a/src/components/notifications/Notification.tsx
+++ b/src/components/notifications/Notification.tsx
@@ -57,6 +57,8 @@ const Notification: React.FC<NotificationProps> = (props) => {
const [avatar, setAvatar] = useState<string | undefined>(undefined);
const [momentURI, setMomentURI] = useState<string | undefined>(undefined);
+ const isSystemNotification =
+ username === 'Tagg' && notification_type === 'PROF_VIST';
useEffect(() => {
(async () => {
@@ -208,6 +210,9 @@ const Notification: React.FC<NotificationProps> = (props) => {
const isOwnProfile = id === loggedInUser.userId;
const navigateToProfile = async () => {
+ if (isSystemNotification) {
+ return;
+ }
if (!userXInStore(state, screenType, id)) {
await fetchUserX(dispatch, {userId: id, username: username}, screenType);
}
@@ -231,35 +236,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}
- />
+ {isSystemNotification ? (
+ // 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>
);
diff --git a/src/types/types.ts b/src/types/types.ts
index 376c4be0..b8746eea 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -251,7 +251,9 @@ export type TypeOfNotification =
// notification_object is MomentType
| 'MOM_FRIEND'
// notification_object is undefined
- | 'INVT_ONBRD';
+ | 'INVT_ONBRD'
+ // notification_object is undefined
+ | 'PROF_VIST';
export type UniversityBadge = {
id: number;