import React, { ComponentType, FC } from 'react'; import dynamic from 'next/dynamic'; import { Skeleton, TabsProps } from 'antd'; import { SocialLink } from '../../../interfaces/social-link.model'; import styles from './Content.module.scss'; import { CustomPageContent } from '../CustomPageContent/CustomPageContent'; import { ContentHeader } from '../../common/ContentHeader/ContentHeader'; import { ChatMessage } from '../../../interfaces/chat-message.model'; import { CurrentUser } from '../../../interfaces/current-user'; import { ActionButtonMenu } from '../../action-buttons/ActionButtonMenu/ActionButtonMenu'; import { ExternalAction } from '../../../interfaces/external-action'; export type MobileContentProps = { name: string; streamTitle: string; summary: string; tags: string[]; socialHandles: SocialLink[]; extraPageContent: string; notifyItemSelected: () => void; followItemSelected: () => void; setExternalActionToDisplay: (action: ExternalAction) => void; setShowNotifyPopup: (show: boolean) => void; setShowFollowModal: (show: boolean) => void; supportFediverseFeatures: boolean; messages: ChatMessage[]; currentUser: CurrentUser; showChat: boolean; actions: ExternalAction[]; externalActionSelected: (action: ExternalAction) => void; supportsBrowserNotifications: boolean; }; // lazy loaded components const Tabs: ComponentType = dynamic(() => import('antd').then(mod => mod.Tabs), { ssr: false, }); const FollowerCollection = dynamic( () => import('../followers/FollowerCollection/FollowerCollection').then( mod => mod.FollowerCollection, ), { ssr: false, }, ); const ChatContainer = dynamic( () => import('../../chat/ChatContainer/ChatContainer').then(mod => mod.ChatContainer), { ssr: false, }, ); export const MobileContent: FC = ({ name, streamTitle, summary, tags, socialHandles, extraPageContent, messages, currentUser, showChat, actions, setExternalActionToDisplay, setShowNotifyPopup, setShowFollowModal, supportFediverseFeatures, supportsBrowserNotifications, }) => { if (!currentUser) { return ; } const { id, displayName } = currentUser; const chatContent = showChat && ( ); const aboutTabContent = ( <>
); const followersTabContent = (
setShowFollowModal(true)} />
); const items = []; if (showChat) { items.push({ label: 'Chat', key: '0', children: chatContent }); } items.push({ label: 'About', key: '2', children: aboutTabContent }); if (supportFediverseFeatures) { items.push({ label: 'Followers', key: '3', children: followersTabContent }); } const replacementTabBar = (props, DefaultTabBar) => (
setShowNotifyPopup(true)} followItemSelected={() => setShowFollowModal(true)} />
); return (
{items.length > 1 ? ( ) : ( aboutTabContent )}
); };