UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

20 lines (19 loc) 1.68 kB
import React from 'react'; import { ConnectionStatus } from './ConnectionStatus'; import { CustomNotification } from './CustomNotification'; import { useTranslationContext } from '../../context/TranslationContext'; import { useNotifications } from '../Notifications/hooks/useNotifications'; const ClientNotifications = () => { const clientNotifications = useNotifications(); const { t } = useTranslationContext(); return (React.createElement(React.Fragment, null, clientNotifications.map((notification) => (React.createElement(CustomNotification, { active: true, key: notification.id, type: notification.severity }, t('translationBuilderTopic/notification', { notification })))))); }; export const MessageListNotifications = (props) => { const { hasNewMessages, isMessageListScrolledToBottom, isNotAtLatestMessageSet, MessageNotification, notifications, scrollToBottom, threadList, unreadCount, } = props; const { t } = useTranslationContext('MessageListNotifications'); return (React.createElement("div", { className: 'str-chat__list-notifications' }, notifications.map((notification) => (React.createElement(CustomNotification, { active: true, key: notification.id, type: notification.type }, notification.text))), React.createElement(ClientNotifications, null), React.createElement(ConnectionStatus, null), React.createElement(MessageNotification, { isMessageListScrolledToBottom: isMessageListScrolledToBottom, onClick: scrollToBottom, showNotification: hasNewMessages || isNotAtLatestMessageSet, threadList: threadList, unreadCount: unreadCount }, isNotAtLatestMessageSet ? t('Latest Messages') : t('New Messages!')))); };