From 098969cbd94fd74fe00ed974d9c019ad434a2f8a Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 20 Apr 2021 14:34:10 -0400
Subject: modified style to match figma

---
 src/components/notifications/Notification.tsx | 71 +++++++++++++++++----------
 1 file changed, 44 insertions(+), 27 deletions(-)

(limited to 'src/components/notifications/Notification.tsx')

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>
   );
 
-- 
cgit v1.2.3-70-g09d2


From 419681ad0d832808caec5252fb65aa154b0e4ae2 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 20 Apr 2021 14:40:18 -0400
Subject: created SYSTEM_MSG

---
 src/components/notifications/Notification.tsx | 6 ++----
 src/types/types.ts                            | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

(limited to 'src/components/notifications/Notification.tsx')

diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx
index d66ca45e..3cc1c7f1 100644
--- a/src/components/notifications/Notification.tsx
+++ b/src/components/notifications/Notification.tsx
@@ -57,8 +57,6 @@ 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 () => {
@@ -210,7 +208,7 @@ const Notification: React.FC<NotificationProps> = (props) => {
 
   const isOwnProfile = id === loggedInUser.userId;
   const navigateToProfile = async () => {
-    if (isSystemNotification) {
+    if (notification_type === 'SYSTEM_MSG') {
       return;
     }
     if (!userXInStore(state, screenType, id)) {
@@ -236,7 +234,7 @@ const Notification: React.FC<NotificationProps> = (props) => {
           }
         />
       </TouchableWithoutFeedback>
-      {isSystemNotification ? (
+      {notification_type === 'SYSTEM_MSG' ? (
         // Only verbage
         <View style={styles.contentContainer}>
           <Text style={styles.actorName}>{verbage}</Text>
diff --git a/src/types/types.ts b/src/types/types.ts
index b8746eea..8d7f4aed 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -253,7 +253,7 @@ export type TypeOfNotification =
   // notification_object is undefined
   | 'INVT_ONBRD'
   // notification_object is undefined
-  | 'PROF_VIST';
+  | 'SYSTEM_MSG';
 
 export type UniversityBadge = {
   id: number;
-- 
cgit v1.2.3-70-g09d2

