Quellcode durchsuchen

componentize notificationDate

Shun Miyazawa vor 4 Jahren
Ursprung
Commit
61508ba445
1 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen
  1. 12 6
      packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

+ 12 - 6
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -56,6 +56,17 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
     );
     );
   };
   };
 
 
+  const renderNotificationDate = (): JSX.Element => {
+    return (
+      <FormattedDistanceDate
+        id={notification._id}
+        date={notification.createdAt}
+        isShowTooltip={false}
+        differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
+      />
+    );
+  };
+
   const actionUsers = getActionUsers();
   const actionUsers = getActionUsers();
 
 
   const actionType: string = notification.action;
   const actionType: string = notification.action;
@@ -119,12 +130,7 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
             <b>{actionUsers}</b> {actionMsg} <PagePathLabel page={pagePath} />
             <b>{actionUsers}</b> {actionMsg} <PagePathLabel page={pagePath} />
           </div>
           </div>
           <i className={`${actionIcon} mr-2`} />
           <i className={`${actionIcon} mr-2`} />
-          <FormattedDistanceDate
-            id={notification._id}
-            date={notification.createdAt}
-            isShowTooltip={false}
-            differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
-          />
+          {renderNotificationDate()}
         </div>
         </div>
       </div>
       </div>
     );
     );