import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiNotification } from '../../api/types'; import { selectTabState } from '../../global/selectors'; import { pick } from '../../util/iteratees'; import renderText from '../common/helpers/renderText'; import Notification from '../ui/Notification'; type StateProps = { notifications: ApiNotification[]; }; const Notifications: FC = ({ notifications }) => { const { dismissNotification } = getActions(); if (!notifications.length) { return undefined; } return (
{notifications.map(({ message, className, localId, action, actionText, title, duration, }) => ( dismissNotification({ localId })} /> ))}
); }; export default memo(withGlobal( (global): StateProps => pick(selectTabState(global), ['notifications']), )(Notifications));