|
@@ -7,7 +7,6 @@ import dynamic from 'next/dynamic';
|
|
|
import { useHackmdDraftUpdatedEffect } from '~/client/services/side-effects/hackmd-draft-updated';
|
|
import { useHackmdDraftUpdatedEffect } from '~/client/services/side-effects/hackmd-draft-updated';
|
|
|
import { useHashChangedEffect } from '~/client/services/side-effects/hash-changed';
|
|
import { useHashChangedEffect } from '~/client/services/side-effects/hash-changed';
|
|
|
import { usePageUpdatedEffect } from '~/client/services/side-effects/page-updated';
|
|
import { usePageUpdatedEffect } from '~/client/services/side-effects/page-updated';
|
|
|
-import type { RendererConfig } from '~/interfaces/services/renderer';
|
|
|
|
|
import { useIsEditable } from '~/stores/context';
|
|
import { useIsEditable } from '~/stores/context';
|
|
|
import { EditorMode, useEditorMode } from '~/stores/ui';
|
|
import { EditorMode, useEditorMode } from '~/stores/ui';
|
|
|
|
|
|
|
@@ -19,8 +18,6 @@ import type { PageSideContentsProps } from '../PageSideContents';
|
|
|
import { UserInfo } from '../User/UserInfo';
|
|
import { UserInfo } from '../User/UserInfo';
|
|
|
import type { UsersHomePageFooterProps } from '../UsersHomePageFooter';
|
|
import type { UsersHomePageFooterProps } from '../UsersHomePageFooter';
|
|
|
|
|
|
|
|
-import { Page2 } from './Page2';
|
|
|
|
|
-
|
|
|
|
|
const { isUsersHomePage } = pagePathUtils;
|
|
const { isUsersHomePage } = pagePathUtils;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -44,20 +41,20 @@ const IdenticalPathPage = (): JSX.Element => {
|
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
- rendererConfig: RendererConfig,
|
|
|
|
|
pagePath: string,
|
|
pagePath: string,
|
|
|
page?: IPagePopulatedToShowRevision,
|
|
page?: IPagePopulatedToShowRevision,
|
|
|
isIdenticalPathPage?: boolean,
|
|
isIdenticalPathPage?: boolean,
|
|
|
isNotFound?: boolean,
|
|
isNotFound?: boolean,
|
|
|
isForbidden?: boolean,
|
|
isForbidden?: boolean,
|
|
|
isNotCreatable?: boolean,
|
|
isNotCreatable?: boolean,
|
|
|
|
|
+ ssrBody?: JSX.Element,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const View = (props: Props): JSX.Element => {
|
|
const View = (props: Props): JSX.Element => {
|
|
|
const {
|
|
const {
|
|
|
- rendererConfig,
|
|
|
|
|
pagePath, page,
|
|
pagePath, page,
|
|
|
isIdenticalPathPage, isNotFound, isForbidden, isNotCreatable,
|
|
isIdenticalPathPage, isNotFound, isForbidden, isNotCreatable,
|
|
|
|
|
+ ssrBody,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
const pageId = page?._id;
|
|
const pageId = page?._id;
|
|
@@ -99,6 +96,16 @@ const View = (props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
const isUsersHomePagePath = isUsersHomePage(pagePath);
|
|
const isUsersHomePagePath = isUsersHomePage(pagePath);
|
|
|
|
|
|
|
|
|
|
+ const contents = specialContents != null
|
|
|
|
|
+ ? <></>
|
|
|
|
|
+ : (() => {
|
|
|
|
|
+ const Page = dynamic(() => import('./Page').then(mod => mod.Page), {
|
|
|
|
|
+ ssr: false,
|
|
|
|
|
+ loading: () => ssrBody ?? <></>,
|
|
|
|
|
+ });
|
|
|
|
|
+ return <Page />;
|
|
|
|
|
+ })();
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<MainPane
|
|
<MainPane
|
|
|
sideContents={sideContents}
|
|
sideContents={sideContents}
|
|
@@ -110,7 +117,7 @@ const View = (props: Props): JSX.Element => {
|
|
|
{ specialContents == null && (
|
|
{ specialContents == null && (
|
|
|
<>
|
|
<>
|
|
|
{ isUsersHomePagePath && <UserInfo author={page?.creator} /> }
|
|
{ isUsersHomePagePath && <UserInfo author={page?.creator} /> }
|
|
|
- <Page2 rendererConfig={rendererConfig} pagePath={pagePath} markdownForSSR={page?.revision.body} />
|
|
|
|
|
|
|
+ { contents }
|
|
|
</>
|
|
</>
|
|
|
) }
|
|
) }
|
|
|
|
|
|