|
|
@@ -1,5 +1,7 @@
|
|
|
import React from 'react';
|
|
|
|
|
|
+import { useTranslation } from 'next-i18next';
|
|
|
+
|
|
|
import InAppNotificationList from '~/components/InAppNotification/InAppNotificationList';
|
|
|
import { InAppNotificationStatuses } from '~/interfaces/in-app-notification';
|
|
|
import { useSWRxInAppNotifications } from '~/stores/in-app-notification';
|
|
|
@@ -12,7 +14,7 @@ export const InAppNotificationForms = (props: InAppNotificationFormsProps): JSX.
|
|
|
const { onChangeUnreadNotificationsVisible } = props;
|
|
|
|
|
|
return (
|
|
|
- <div className="px-4 my-2">
|
|
|
+ <div className="my-2">
|
|
|
<div className="form-check form-switch">
|
|
|
<label className="form-check-label" htmlFor="flexSwitchCheckDefault">Only unread</label>
|
|
|
<input
|
|
|
@@ -33,6 +35,7 @@ type InAppNotificationContentProps = {
|
|
|
}
|
|
|
export const InAppNotificationContent = (props: InAppNotificationContentProps): JSX.Element => {
|
|
|
const { isUnreadNotificationsVisible } = props;
|
|
|
+ const { t } = useTranslation('commons');
|
|
|
|
|
|
// TODO: Infinite scroll implemented (https://redmine.weseek.co.jp/issues/138057)
|
|
|
const { data: inAppNotificationData } = useSWRxInAppNotifications(
|
|
|
@@ -44,7 +47,14 @@ export const InAppNotificationContent = (props: InAppNotificationContentProps):
|
|
|
|
|
|
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} />
|
|
|
+ )
|
|
|
+ }
|
|
|
</>
|
|
|
);
|
|
|
};
|