|
@@ -12,22 +12,18 @@ import { BasicLayout } from '~/components/Layout/BasicLayout';
|
|
|
import { GroundGlassBar } from '~/components/Navbar/GroundGlassBar';
|
|
import { GroundGlassBar } from '~/components/Navbar/GroundGlassBar';
|
|
|
import type { CrowiRequest } from '~/interfaces/crowi-request';
|
|
import type { CrowiRequest } from '~/interfaces/crowi-request';
|
|
|
import type { IDataTagCount } from '~/interfaces/tag';
|
|
import type { IDataTagCount } from '~/interfaces/tag';
|
|
|
-import { useHydrateSidebarAtoms } from '~/states/ui/sidebar/hydrate';
|
|
|
|
|
import { useSWRxTagsList } from '~/stores/tag';
|
|
import { useSWRxTagsList } from '~/stores/tag';
|
|
|
|
|
|
|
|
|
|
|
|
|
import type { NextPageWithLayout } from '../_app.page';
|
|
import type { NextPageWithLayout } from '../_app.page';
|
|
|
-import type { CommonEachProps, CommonInitialProps, UserUISettingsProps } from '../common-props';
|
|
|
|
|
-import {
|
|
|
|
|
- getServerSideCommonEachProps, getServerSideCommonInitialProps, getServerSideI18nProps, getServerSideUserUISettingsProps,
|
|
|
|
|
-} from '../common-props';
|
|
|
|
|
-import type { RendererConfigProps, SidebarConfigProps } from '../general-page';
|
|
|
|
|
-import { getServerSideSidebarConfigProps } from '../general-page';
|
|
|
|
|
|
|
+import type { BasicLayoutConfigurationProps } from '../basic-layout-page';
|
|
|
|
|
+import { getServerSideBasicLayoutProps } from '../basic-layout-page';
|
|
|
|
|
+import { useHydrateBasicLayoutConfigurationAtoms } from '../basic-layout-page/hydrate';
|
|
|
|
|
+import type { CommonEachProps, CommonInitialProps } from '../common-props';
|
|
|
|
|
+import { getServerSideCommonEachProps, getServerSideCommonInitialProps, getServerSideI18nProps } from '../common-props';
|
|
|
import { useCustomTitle } from '../utils/page-title-customization';
|
|
import { useCustomTitle } from '../utils/page-title-customization';
|
|
|
import { mergeGetServerSidePropsResults } from '../utils/server-side-props';
|
|
import { mergeGetServerSidePropsResults } from '../utils/server-side-props';
|
|
|
|
|
|
|
|
-import type { ServerConfigurationProps } from './types';
|
|
|
|
|
-import { useHydrateServerConfigurationAtoms } from './use-hydrate-server-configurations';
|
|
|
|
|
|
|
|
|
|
const PAGING_LIMIT = 10;
|
|
const PAGING_LIMIT = 10;
|
|
|
|
|
|
|
@@ -36,7 +32,7 @@ const TagList = dynamic(() => import('~/client/components/TagList'), { ssr: fals
|
|
|
const TagCloudBox = dynamic(() => import('~/client/components/TagCloudBox'), { ssr: false });
|
|
const TagCloudBox = dynamic(() => import('~/client/components/TagCloudBox'), { ssr: false });
|
|
|
|
|
|
|
|
|
|
|
|
|
-type Props = CommonInitialProps & CommonEachProps & ServerConfigurationProps & RendererConfigProps & UserUISettingsProps & SidebarConfigProps;
|
|
|
|
|
|
|
+type Props = CommonInitialProps & CommonEachProps & BasicLayoutConfigurationProps;
|
|
|
|
|
|
|
|
const TagPage: NextPageWithLayout<Props> = (props: Props) => {
|
|
const TagPage: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
@@ -46,10 +42,6 @@ const TagPage: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
// useHydratePageAtoms(undefined);
|
|
// useHydratePageAtoms(undefined);
|
|
|
// useCurrentPathname('/tags');
|
|
// useCurrentPathname('/tags');
|
|
|
|
|
|
|
|
- // Hydrate server-side data
|
|
|
|
|
- useHydrateServerConfigurationAtoms(props.serverConfig);
|
|
|
|
|
- useHydrateSidebarAtoms(props.sidebarConfig, props.userUISettings);
|
|
|
|
|
-
|
|
|
|
|
const [activePage, setActivePage] = useState<number>(1);
|
|
const [activePage, setActivePage] = useState<number>(1);
|
|
|
const [offset, setOffset] = useState<number>(0);
|
|
const [offset, setOffset] = useState<number>(0);
|
|
|
|
|
|
|
@@ -113,7 +105,7 @@ type LayoutProps = Props & {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const Layout = ({ children, ...props }: LayoutProps): JSX.Element => {
|
|
const Layout = ({ children, ...props }: LayoutProps): JSX.Element => {
|
|
|
- useHydrateSidebarAtoms(props.sidebarConfig, props.userUISettings);
|
|
|
|
|
|
|
+ useHydrateBasicLayoutConfigurationAtoms(props.searchConfig, props.sidebarConfig, props.userUISettings);
|
|
|
|
|
|
|
|
return <BasicLayout>{children}</BasicLayout>;
|
|
return <BasicLayout>{children}</BasicLayout>;
|
|
|
};
|
|
};
|
|
@@ -126,25 +118,6 @@ TagPage.getLayout = function getLayout(page) {
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-const getServerSideConfigurationProps: GetServerSideProps<ServerConfigurationProps> = async(context: GetServerSidePropsContext) => {
|
|
|
|
|
- const req: CrowiRequest = context.req as CrowiRequest;
|
|
|
|
|
- const { crowi } = req;
|
|
|
|
|
- const {
|
|
|
|
|
- configManager, searchService,
|
|
|
|
|
- } = crowi;
|
|
|
|
|
-
|
|
|
|
|
- return {
|
|
|
|
|
- props: {
|
|
|
|
|
- serverConfig: {
|
|
|
|
|
- isSearchServiceConfigured: searchService.isConfigured,
|
|
|
|
|
- isSearchServiceReachable: searchService.isReachable,
|
|
|
|
|
- isSearchScopeChildrenAsDefault: configManager.getConfig('customize:isSearchScopeChildrenAsDefault'),
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- };
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
|
const req: CrowiRequest = context.req as CrowiRequest;
|
|
const req: CrowiRequest = context.req as CrowiRequest;
|
|
|
|
|
|
|
@@ -159,24 +132,18 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
|
|
|
const [
|
|
const [
|
|
|
commonInitialResult,
|
|
commonInitialResult,
|
|
|
commonEachResult,
|
|
commonEachResult,
|
|
|
- userUIResult,
|
|
|
|
|
- sidebarConfigResult,
|
|
|
|
|
- serverConfigResult,
|
|
|
|
|
|
|
+ basicLayoutResult,
|
|
|
i18nPropsResult,
|
|
i18nPropsResult,
|
|
|
] = await Promise.all([
|
|
] = await Promise.all([
|
|
|
getServerSideCommonInitialProps(context),
|
|
getServerSideCommonInitialProps(context),
|
|
|
getServerSideCommonEachProps(context),
|
|
getServerSideCommonEachProps(context),
|
|
|
- getServerSideUserUISettingsProps(context),
|
|
|
|
|
- getServerSideSidebarConfigProps(context),
|
|
|
|
|
- getServerSideConfigurationProps(context),
|
|
|
|
|
|
|
+ getServerSideBasicLayoutProps(context),
|
|
|
getServerSideI18nProps(context, ['translation']),
|
|
getServerSideI18nProps(context, ['translation']),
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
return mergeGetServerSidePropsResults(commonInitialResult,
|
|
return mergeGetServerSidePropsResults(commonInitialResult,
|
|
|
mergeGetServerSidePropsResults(commonEachResult,
|
|
mergeGetServerSidePropsResults(commonEachResult,
|
|
|
- mergeGetServerSidePropsResults(userUIResult,
|
|
|
|
|
- mergeGetServerSidePropsResults(sidebarConfigResult,
|
|
|
|
|
- mergeGetServerSidePropsResults(serverConfigResult, i18nPropsResult)))));
|
|
|
|
|
|
|
+ mergeGetServerSidePropsResults(basicLayoutResult, i18nPropsResult)));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default TagPage;
|
|
export default TagPage;
|