import React from 'react'; import { IPageHasId, pagePathUtils } from '@growi/core'; import { useTranslation } from 'next-i18next'; import { Link } from 'react-scroll'; import { useDescendantsPageListModal } from '~/stores/modal'; import CountBadge from './Common/CountBadge'; import { ContentLinkButtons } from './ContentLinkButtons'; import PageListIcon from './Icons/PageListIcon'; import TableOfContents from './TableOfContents'; import styles from './PageSideContents.module.scss'; const { isTopPage, isUsersHomePage } = pagePathUtils; export type PageSideContentsProps = { page: IPageHasId, isSharedUser?: boolean, } export const PageSideContents = (props: PageSideContentsProps): JSX.Element => { const { t } = useTranslation(); const { open: openDescendantPageListModal } = useDescendantsPageListModal(); const { page, isSharedUser } = props; const pagePath = page.path; const isTopPagePath = isTopPage(pagePath); const isUsersHomePagePath = isUsersHomePage(pagePath); return ( <> {/* Page list */}
{!isSharedUser && ( )}
{/* Comments */} {!isTopPagePath && (
)}
{isUsersHomePagePath && }
); };