2023-02-13 03:55:52 +03:00
|
|
|
import React, { ComponentType, FC } from 'react';
|
|
|
|
import dynamic from 'next/dynamic';
|
|
|
|
import { 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';
|
|
|
|
|
|
|
|
export type DesktopContentProps = {
|
|
|
|
name: string;
|
|
|
|
summary: string;
|
|
|
|
tags: string[];
|
|
|
|
socialHandles: SocialLink[];
|
|
|
|
extraPageContent: string;
|
|
|
|
setShowFollowModal: (show: boolean) => void;
|
|
|
|
supportFediverseFeatures: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
// lazy loaded components
|
|
|
|
|
|
|
|
const Tabs: ComponentType<TabsProps> = dynamic(() => import('antd').then(mod => mod.Tabs), {
|
|
|
|
ssr: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
const FollowerCollection = dynamic(
|
|
|
|
() =>
|
|
|
|
import('../followers/FollowerCollection/FollowerCollection').then(
|
|
|
|
mod => mod.FollowerCollection,
|
|
|
|
),
|
|
|
|
{
|
|
|
|
ssr: false,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
export const DesktopContent: FC<DesktopContentProps> = ({
|
|
|
|
name,
|
|
|
|
summary,
|
|
|
|
tags,
|
|
|
|
socialHandles,
|
|
|
|
extraPageContent,
|
|
|
|
setShowFollowModal,
|
|
|
|
supportFediverseFeatures,
|
|
|
|
}) => {
|
2023-02-22 03:15:09 +03:00
|
|
|
const aboutTabContent = (
|
|
|
|
<div className={styles.bottomPageContentContainer}>
|
|
|
|
<CustomPageContent content={extraPageContent} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
2023-02-13 03:55:52 +03:00
|
|
|
const followersTabContent = (
|
2023-02-22 03:15:09 +03:00
|
|
|
<div className={styles.bottomPageContentContainer}>
|
2023-02-13 03:55:52 +03:00
|
|
|
<FollowerCollection name={name} onFollowButtonClick={() => setShowFollowModal(true)} />
|
|
|
|
</div>
|
|
|
|
);
|
2023-02-28 04:39:45 +03:00
|
|
|
const items = [!!extraPageContent && { label: 'About', key: '2', children: aboutTabContent }];
|
2023-02-13 03:55:52 +03:00
|
|
|
if (supportFediverseFeatures) {
|
|
|
|
items.push({ label: 'Followers', key: '3', children: followersTabContent });
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className={styles.lowerHalf} id="skip-to-content">
|
|
|
|
<ContentHeader
|
|
|
|
name={name}
|
|
|
|
summary={summary}
|
|
|
|
tags={tags}
|
|
|
|
links={socialHandles}
|
|
|
|
logo="/logo"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.lowerSection}>
|
2023-02-28 04:39:45 +03:00
|
|
|
{items.length > 1 ? (
|
|
|
|
<Tabs defaultActiveKey="0" items={items} />
|
|
|
|
) : (
|
|
|
|
!!extraPageContent && aboutTabContent
|
|
|
|
)}
|
2023-02-13 03:55:52 +03:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|