import React, { memo, useCallback } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; import { REM } from '../../common/helpers/mediaDimensions'; import { selectAnimatedEmoji, selectChat } from '../../../global/selectors'; import { getHasAdminRight } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; import Button from '../../ui/Button'; import AnimatedIconFromSticker from '../../common/AnimatedIconFromSticker'; import styles from './EmptyForum.module.scss'; type OwnProps = { chatId: string; }; type StateProps = { animatedEmoji?: ApiSticker; canManageTopics?: boolean; }; const ICON_SIZE = 7 * REM; const EmptyForum: FC = ({ chatId, animatedEmoji, canManageTopics, }) => { const { openCreateTopicPanel } = getActions(); const lang = useLang(); const { isMobile } = useAppLayout(); const handleCreateTopic = useCallback(() => { openCreateTopicPanel({ chatId }); }, [chatId, openCreateTopicPanel]); return (
{animatedEmoji && }

{lang('ChatList.EmptyTopicsTitle')}

{lang('ChatList.EmptyTopicsDescription')}

{canManageTopics && ( )}
); }; export default memo(withGlobal((global, { chatId }): StateProps => { const chat = selectChat(global, chatId); const canManageTopics = chat && (chat.isCreator || getHasAdminRight(chat, 'manageTopics')); return { animatedEmoji: selectAnimatedEmoji(global, '🐣'), canManageTopics, }; })(EmptyForum));