import React, { FC } from 'react'; import type { IRevision } from '@growi/core'; import { useTranslation } from 'next-i18next'; import Link from 'next/link'; import { useSWRxPageByPath } from '~/stores/page'; import { useCustomSidebarOptions } from '~/stores/renderer'; import loggerFactory from '~/utils/logger'; import RevisionRenderer from '../Page/RevisionRenderer'; import { SidebarHeaderReloadButton } from './SidebarHeaderReloadButton'; import CustomSidebarContentSkeleton from './Skeleton/CustomSidebarContentSkeleton'; import styles from './CustomSidebar.module.scss'; const logger = loggerFactory('growi:cli:CustomSidebar'); const SidebarNotFound = () => { const { t } = useTranslation(); return (
); }; const CustomSidebar: FC = () => { const { t } = useTranslation(); const { data: rendererOptions } = useCustomSidebarOptions(); const { data: page, error, mutate } = useSWRxPageByPath('/Sidebar'); if (rendererOptions == null) { return <>; } const isLoading = page === undefined && error == null; const markdown = (page?.revision as IRevision | undefined)?.body; return (

{t('CustomSidebar')}

mutate()} />
{ isLoading && ( ) } { (!isLoading && markdown != null) && (
) } { (!isLoading && markdown === undefined) && ( ) }
); }; export default CustomSidebar;