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

Merge branch 'feat/notification' into imprv/81019-time-notation

Shun Miyazawa 4 лет назад
Родитель
Сommit
e4fddcc63c

+ 5 - 2
packages/app/src/components/InAppNotification/InAppNotificationDropdown.tsx

@@ -23,7 +23,7 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
   const [count, setCount] = useState(0);
   const [isOpen, setIsOpen] = useState(false);
   const limit = 6;
-  const { data: inAppNotificationData } = useSWRxInAppNotifications(limit);
+  const { data: inAppNotificationData, mutate } = useSWRxInAppNotifications(limit);
 
   useEffect(() => {
     initializeSocket(props);
@@ -59,11 +59,14 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
   };
 
   const toggleDropdownHandler = () => {
-    if (isOpen === false && count > 0) {
+    if (!isOpen && count > 0) {
       updateNotificationStatus();
     }
 
     const newIsOpenState = !isOpen;
+    if (newIsOpenState) {
+      mutate();
+    }
     setIsOpen(newIsOpenState);
   };
 

+ 1 - 1
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -78,7 +78,7 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
   switch (actionType) {
     case 'PAGE_UPDATE':
       actionMsg = 'updated on';
-      actionIcon = 'ti-file';
+      actionIcon = 'ti-agenda';
       break;
     case 'COMMENT_CREATE':
       actionMsg = 'commented on';