import React, { FC } from 'react'; import { PaginateResult } from 'mongoose'; import { useTranslation } from 'react-i18next'; import { IInAppNotification } from '../../interfaces/in-app-notification'; import InAppNotificationElm from './InAppNotificationElm'; type Props = { inAppNotificationData: PaginateResult | undefined; }; const InAppNotificationList: FC = (props: Props) => { const { t } = useTranslation(); const { inAppNotificationData } = props; if (inAppNotificationData == null) { return (
); } const notifications = inAppNotificationData.docs; const renderInAppNotificationList = () => { const inAppNotificationList = notifications.map((notification: IInAppNotification) => { return (
); }); return inAppNotificationList; }; return ( <> {notifications.length === 0 ? <>{t('in_app_notification.no_notification')} : renderInAppNotificationList()} ); }; export default InAppNotificationList;