import React, { FC } from 'react'; import { IInAppNotification } from '../../interfaces/in-app-notification'; import { InAppNotification } from './InAppNotification'; type Props = { notifications: Array; isLoaded: boolean; }; const InAppNotificationList: FC = (props: Props) => { const { notifications } = props; const notificationClickHandler = async(notification: Notification) => { try { // await this.props.crowi.apiPost('/notification.open', { id: notification._id }); // jump to target page // window.location.href = notification.target.path; } catch (err) { // logger.error(err); } }; // TODO: improve view of loading icon by #80669 const RenderUnLoadedInAppNotification = (): JSX.Element => { return ( ); }; const RenderEmptyInAppNotification = (): JSX.Element => { return ( // TODO: apply i18n by #78569 <>You had no notifications, yet. ); }; const RenderInAppNotificationList = () => { if (notifications.length === 0) { return ; } const notificationList = notifications.map((notification: IInAppNotification) => { return (
); }); return <>{notificationList}; }; if (!props.isLoaded) { return ; } return ; }; export default InAppNotificationList;