Jelajahi Sumber

Delete unwanted props

Shun Miyazawa 2 tahun lalu
induk
melakukan
997c9fb874

+ 0 - 2
apps/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -10,8 +10,6 @@ import { useModelNotification } from './PageNotification';
 
 
 interface Props {
 interface Props {
   notification: IInAppNotification & HasObjectId
   notification: IInAppNotification & HasObjectId
-  elemClassName?: string,
-  type?: 'button' | 'list',
 }
 }
 
 
 const InAppNotificationElm: FC<Props> = (props: Props) => {
 const InAppNotificationElm: FC<Props> = (props: Props) => {

+ 1 - 3
apps/app/src/components/InAppNotification/InAppNotificationList.tsx

@@ -9,8 +9,6 @@ import InAppNotificationElm from './InAppNotificationElm';
 
 
 type Props = {
 type Props = {
   inAppNotificationData?: PaginateResult<IInAppNotification>,
   inAppNotificationData?: PaginateResult<IInAppNotification>,
-  elemClassName?: string,
-  type?: 'button' | 'list',
 };
 };
 
 
 const InAppNotificationList: FC<Props> = (props: Props) => {
 const InAppNotificationList: FC<Props> = (props: Props) => {
@@ -32,7 +30,7 @@ const InAppNotificationList: FC<Props> = (props: Props) => {
     <div className="list-group">
     <div className="list-group">
       { notifications.map((notification: IInAppNotification & HasObjectId) => {
       { notifications.map((notification: IInAppNotification & HasObjectId) => {
         return (
         return (
-          <InAppNotificationElm key={notification._id} notification={notification} type={props.type} elemClassName={props.elemClassName} />
+          <InAppNotificationElm key={notification._id} notification={notification} />
         );
         );
       }) }
       }) }
     </div>
     </div>

+ 1 - 3
apps/app/src/components/InAppNotification/InAppNotificationPage.tsx

@@ -100,9 +100,7 @@ export const InAppNotificationPage: FC = () => {
           ? t('in_app_notification.mark_all_as_read')
           ? t('in_app_notification.mark_all_as_read')
           // render list-group
           // render list-group
           : (
           : (
-            <div className="list-group">
-              <InAppNotificationList inAppNotificationData={notificationData} type="button" elemClassName="list-group-item list-group-item-action" />
-            </div>
+            <InAppNotificationList inAppNotificationData={notificationData} />
           )
           )
         }
         }
 
 

+ 11 - 1
apps/app/src/components/Sidebar/InAppNotification/InAppNotificationSubstance.tsx

@@ -1,16 +1,26 @@
 import React from 'react';
 import React from 'react';
 
 
+import { useTranslation } from 'next-i18next';
+
 import InAppNotificationList from '~/components/InAppNotification/InAppNotificationList';
 import InAppNotificationList from '~/components/InAppNotification/InAppNotificationList';
 import { useSWRxInAppNotifications } from '~/stores/in-app-notification';
 import { useSWRxInAppNotifications } from '~/stores/in-app-notification';
 
 
 export const InAppNotificationSubstance = (): JSX.Element => {
 export const InAppNotificationSubstance = (): JSX.Element => {
+  const { t } = useTranslation('commons');
 
 
   // TODO: Infinite scroll implemented (https://redmine.weseek.co.jp/issues/138057)
   // TODO: Infinite scroll implemented (https://redmine.weseek.co.jp/issues/138057)
   const { data: inAppNotificationData } = useSWRxInAppNotifications(6, undefined, undefined, { revalidateOnFocus: true });
   const { data: inAppNotificationData } = useSWRxInAppNotifications(6, undefined, undefined, { revalidateOnFocus: true });
 
 
   return (
   return (
     <>
     <>
-      <InAppNotificationList type="list" inAppNotificationData={inAppNotificationData} />
+      {inAppNotificationData != null && inAppNotificationData.docs.length === 0
+      // no items
+        ? t('in_app_notification.mark_all_as_read')
+      // render list-group
+        : (
+          <InAppNotificationList inAppNotificationData={inAppNotificationData} />
+        )
+      }
     </>
     </>
   );
   );
 };
 };