import React, { FC } from 'react'; import { useTranslation } from 'next-i18next'; import { IRevision } from '~/interfaces/revision'; import { useSWRxPageByPath } from '~/stores/page'; import { useCustomSidebarOptions } from '~/stores/renderer'; import loggerFactory from '~/utils/logger'; import RevisionRenderer from '../Page/RevisionRenderer'; const logger = loggerFactory('growi:cli:CustomSidebar'); const SidebarNotFound = () => { return (
Create /Sidebar page
); }; 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')}

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