Просмотр исходного кода

switch InAppNotificationContent messages

kaori 4 лет назад
Родитель
Сommit
e9f2b47876
1 измененных файлов с 14 добавлено и 18 удалено
  1. 14 18
      packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

+ 14 - 18
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -76,26 +76,22 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
     }
     }
   };
   };
 
 
-  // const renderInAppNotificationContent = (): JSX.Element => {
-  //   const propsNew = {
-  //     actionUsers: getActionUsers(),
-  //     ...props,
-  //   };
-  //   const action: string = notification.action;
-  //   switch (action) {
-  //     case 'PAGE_UPDATE':
-  //       return <PageUpdateNotification {...propsNew} />;
-  //     case 'COMMENT_CREATE':
-  //       return <PageCommentNotification {...propsNew} />;
-  //     default:
-  //       return <></>;
-  //   }
-  // };
-
-
   const actionUsers = getActionUsers();
   const actionUsers = getActionUsers();
   const pagePath = { path: props.notification.target.path };
   const pagePath = { path: props.notification.target.path };
 
 
+  const renderInAppNotificationContent = (): string => {
+    const action: string = notification.action;
+
+    switch (action) {
+      case 'PAGE_UPDATE':
+        return 'updated on';
+      case 'COMMENT_CREATE':
+        return 'commented on';
+      default:
+        return '';
+    }
+  };
+
 
 
   return (
   return (
     <>
     <>
@@ -106,7 +102,7 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
         <div className="p-2">
         <div className="p-2">
           <div onClick={() => notificationClickHandler(notification)}>
           <div onClick={() => notificationClickHandler(notification)}>
             <div>
             <div>
-              <b>{actionUsers}</b> page updated on <PagePathLabel page={pagePath} />
+              <b>{actionUsers}</b> {renderInAppNotificationContent()} <PagePathLabel page={pagePath} />
             </div>
             </div>
             <i className="fa fa-file-o mr-2" />
             <i className="fa fa-file-o mr-2" />
             <FormattedDistanceDate id={notification._id} date={notification.createdAt} isShowTooltip={false} />
             <FormattedDistanceDate id={notification._id} date={notification.createdAt} isShowTooltip={false} />