import React, { FC } from 'react';
import AppContainer from '~/client/services/AppContainer';
import loggerFactory from '~/utils/logger';
import { useSWRxPageByPath } from '~/stores/page';
import { withUnstatedContainers } from '../UnstatedUtils';
import RevisionRenderer from '../Page/RevisionRenderer';
import { IRevision } from '~/interfaces/revision';
const logger = loggerFactory('growi:cli:CustomSidebar');
const SidebarNotFound = () => {
return (
);
};
type Props = {
appContainer: AppContainer,
};
const CustomSidebar: FC = (props: Props) => {
const { appContainer } = props;
const renderer = appContainer.getRenderer('sidebar');
const { data: page, mutate } = useSWRxPageByPath('/Sidebar');
const isLoading = page === undefined;
const markdown = (page?.revision as IRevision | undefined)?.body;
return (
<>
Custom Sidebar
{ !isLoading && markdown == null && }
{/* eslint-disable-next-line react/no-danger */}
{ markdown != null && (
) }
>
);
};
/**
* Wrapper component for using unstated
*/
const CustomSidebarWrapper = withUnstatedContainers(CustomSidebar, [AppContainer]);
export default CustomSidebarWrapper;