|
|
@@ -1,4 +1,4 @@
|
|
|
-import React, { ReactElement, useEffect } from 'react';
|
|
|
+import React, { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
import EventEmitter from 'events';
|
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
} from '@growi/core';
|
|
|
import ExtensibleCustomError from 'extensible-custom-error';
|
|
|
import {
|
|
|
- NextPage, GetServerSideProps, GetServerSidePropsContext,
|
|
|
+ GetServerSideProps, GetServerSidePropsContext,
|
|
|
} from 'next';
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
|
|
import dynamic from 'next/dynamic';
|
|
|
@@ -19,6 +19,7 @@ import Head from 'next/head';
|
|
|
import { useRouter } from 'next/router';
|
|
|
import superjson from 'superjson';
|
|
|
|
|
|
+import { useCurrentGrowiLayoutFluidClassName } from '~/client/services/layout';
|
|
|
import { Comments } from '~/components/Comments';
|
|
|
import { PageAlerts } from '~/components/PageAlert/PageAlerts';
|
|
|
// import { useTranslation } from '~/i18n';
|
|
|
@@ -53,7 +54,7 @@ import loggerFactory from '~/utils/logger';
|
|
|
// import GrowiSubNavigation from '../client/js/components/Navbar/GrowiSubNavigation';
|
|
|
// import GrowiSubNavigationSwitcher from '../client/js/components/Navbar/GrowiSubNavigationSwitcher';
|
|
|
import { DescendantsPageListModal } from '../components/DescendantsPageListModal';
|
|
|
-import { BasicLayoutWithCurrentPage } from '../components/Layout/BasicLayout';
|
|
|
+import { BasicLayoutWithEditorMode } from '../components/Layout/BasicLayout';
|
|
|
import GrowiContextualSubNavigation from '../components/Navbar/GrowiContextualSubNavigation';
|
|
|
import DisplaySwitcher from '../components/Page/DisplaySwitcher';
|
|
|
// import { serializeUserSecurely } from '../server/models/serializers/user-serializer';
|
|
|
@@ -71,6 +72,7 @@ import {
|
|
|
useEditorConfig, useIsAllReplyShown, useIsUploadableFile, useIsUploadableImage, useCustomizedLogoSrc, useIsContainerFluid,
|
|
|
} from '../stores/context';
|
|
|
|
|
|
+import { NextPageWithLayout } from './_app.page';
|
|
|
import {
|
|
|
CommonProps, getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
|
|
|
} from './utils/commons';
|
|
|
@@ -187,7 +189,7 @@ type Props = CommonProps & {
|
|
|
sidebarConfig: ISidebarConfig,
|
|
|
};
|
|
|
|
|
|
-const Page: NextPage<Props> = (props: Props) => {
|
|
|
+const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
// const { t } = useTranslation();
|
|
|
const router = useRouter();
|
|
|
|
|
|
@@ -275,6 +277,8 @@ const Page: NextPage<Props> = (props: Props) => {
|
|
|
useSetupGlobalSocket();
|
|
|
useSetupGlobalSocketForPage(pageId);
|
|
|
|
|
|
+ const growiLayoutFluidClass = useCurrentGrowiLayoutFluidClassName();
|
|
|
+
|
|
|
const shouldRenderPutbackPageModal = pageWithMeta != null
|
|
|
? _isTrashPage(pageWithMeta.data.path)
|
|
|
: false;
|
|
|
@@ -301,68 +305,73 @@ const Page: NextPage<Props> = (props: Props) => {
|
|
|
<Head>
|
|
|
<title>{title}</title>
|
|
|
</Head>
|
|
|
- <DrawioViewerScript />
|
|
|
-
|
|
|
- <BasicLayoutWithCurrentPage>
|
|
|
-
|
|
|
- <div className="h-100 d-flex flex-column justify-content-between">
|
|
|
- <header className="py-0 position-relative">
|
|
|
- <div id="grw-subnav-container">
|
|
|
- <GrowiContextualSubNavigation isLinkSharingDisabled={props.disableLinkSharing} />
|
|
|
- </div>
|
|
|
- </header>
|
|
|
- <div className="d-edit-none">
|
|
|
- <GrowiSubNavigationSwitcher />
|
|
|
+ <div className={`dynamic-layout-root ${growiLayoutFluidClass} h-100 d-flex flex-column justify-content-between`}>
|
|
|
+ <header className="py-0 position-relative">
|
|
|
+ <div id="grw-subnav-container">
|
|
|
+ <GrowiContextualSubNavigation isLinkSharingDisabled={props.disableLinkSharing} />
|
|
|
</div>
|
|
|
+ </header>
|
|
|
+ <div className="d-edit-none">
|
|
|
+ <GrowiSubNavigationSwitcher />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div id="grw-subnav-sticky-trigger" className="sticky-top"></div>
|
|
|
+ <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
|
|
|
+
|
|
|
+ <div className="flex-grow-1">
|
|
|
+ <div id="main" className={`main ${isUsersHomePage(props.currentPathname) && 'user-page'}`}>
|
|
|
+ <div id="content-main" className="content-main grw-container-convertible">
|
|
|
+ { props.isIdenticalPathPage && <IdenticalPathPage /> }
|
|
|
+
|
|
|
+ { !props.isIdenticalPathPage && (
|
|
|
+ <>
|
|
|
+ <PageAlerts />
|
|
|
+ { props.isForbidden && <ForbiddenPage /> }
|
|
|
+ { props.isNotCreatablePage && <NotCreatablePage />}
|
|
|
+ { !props.isForbidden && !props.isNotCreatablePage && <DisplaySwitcher />}
|
|
|
+ {/* <DisplaySwitcher /> */}
|
|
|
+ <PageStatusAlert />
|
|
|
+ </>
|
|
|
+ ) }
|
|
|
|
|
|
- <div id="grw-subnav-sticky-trigger" className="sticky-top"></div>
|
|
|
- <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
|
|
|
-
|
|
|
- <div className="flex-grow-1">
|
|
|
- <div id="main" className={`main ${isUsersHomePage(props.currentPathname) && 'user-page'}`}>
|
|
|
- <div id="content-main" className="content-main grw-container-convertible">
|
|
|
- { props.isIdenticalPathPage && <IdenticalPathPage /> }
|
|
|
-
|
|
|
- { !props.isIdenticalPathPage && (
|
|
|
- <>
|
|
|
- <PageAlerts />
|
|
|
- { props.isForbidden && <ForbiddenPage /> }
|
|
|
- { props.isNotCreatablePage && <NotCreatablePage />}
|
|
|
- { !props.isForbidden && !props.isNotCreatablePage && <DisplaySwitcher />}
|
|
|
- {/* <DisplaySwitcher /> */}
|
|
|
- <PageStatusAlert />
|
|
|
- </>
|
|
|
- ) }
|
|
|
-
|
|
|
- {/* <div className="col-xl-2 col-lg-3 d-none d-lg-block revision-toc-container">
|
|
|
- <div id="revision-toc" className="revision-toc mt-3 sps sps--abv" data-sps-offset="123">
|
|
|
- <div id="revision-toc-content" className="revision-toc-content"></div>
|
|
|
- </div>
|
|
|
- </div> */}
|
|
|
- </div>
|
|
|
+ {/* <div className="col-xl-2 col-lg-3 d-none d-lg-block revision-toc-container">
|
|
|
+ <div id="revision-toc" className="revision-toc mt-3 sps sps--abv" data-sps-offset="123">
|
|
|
+ <div id="revision-toc-content" className="revision-toc-content"></div>
|
|
|
+ </div>
|
|
|
+ </div> */}
|
|
|
</div>
|
|
|
</div>
|
|
|
- { !props.isIdenticalPathPage && !props.isNotFound && (
|
|
|
- <footer className="footer d-edit-none">
|
|
|
- { pageWithMeta != null && pagePath != null && !isTopPagePath && (
|
|
|
- <Comments pageId={pageId} pagePath={pagePath} revision={pageWithMeta.data.revision} />
|
|
|
- ) }
|
|
|
- { pageWithMeta != null && isUsersHomePage(pageWithMeta.data.path) && (
|
|
|
- <UsersHomePageFooter creatorId={pageWithMeta.data.creator._id}/>
|
|
|
- ) }
|
|
|
- <CurrentPageContentFooter />
|
|
|
- </footer>
|
|
|
- )}
|
|
|
+ </div>
|
|
|
+ { !props.isIdenticalPathPage && !props.isNotFound && (
|
|
|
+ <footer className="footer d-edit-none">
|
|
|
+ { pageWithMeta != null && pagePath != null && !isTopPagePath && (
|
|
|
+ <Comments pageId={pageId} pagePath={pagePath} revision={pageWithMeta.data.revision} />
|
|
|
+ ) }
|
|
|
+ { pageWithMeta != null && isUsersHomePage(pageWithMeta.data.path) && (
|
|
|
+ <UsersHomePageFooter creatorId={pageWithMeta.data.creator._id}/>
|
|
|
+ ) }
|
|
|
+ <CurrentPageContentFooter />
|
|
|
+ </footer>
|
|
|
+ )}
|
|
|
+
|
|
|
+ {shouldRenderPutbackPageModal && <PutbackPageModal />}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+};
|
|
|
|
|
|
- {/* TODO: move these components outside of BasicLayoutWithCurrentPage */}
|
|
|
- <UnsavedAlertDialog />
|
|
|
- <DescendantsPageListModal />
|
|
|
- <DrawioModal />
|
|
|
- <HandsontableModal />
|
|
|
+Page.getLayout = function getLayout(page) {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <DrawioViewerScript />
|
|
|
|
|
|
- {shouldRenderPutbackPageModal && <PutbackPageModal />}
|
|
|
- </div>
|
|
|
- </BasicLayoutWithCurrentPage>
|
|
|
+ <BasicLayoutWithEditorMode>
|
|
|
+ {page}
|
|
|
+ </BasicLayoutWithEditorMode>
|
|
|
+ <UnsavedAlertDialog />
|
|
|
+ <DescendantsPageListModal />
|
|
|
+ <DrawioModal />
|
|
|
+ <HandsontableModal />
|
|
|
</>
|
|
|
);
|
|
|
};
|