Răsfoiți Sursa

reorganize modules

Yuki Takei 7 luni în urmă
părinte
comite
9b73efd12d

+ 5 - 6
apps/app/src/pages/[[...path]]/server-side-props.ts

@@ -1,16 +1,15 @@
 import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
 
-import { addActivity } from '~/pages/utils/activity';
-import { getServerSideI18nProps } from '~/pages/utils/i18n';
-
+import {
+  getServerSideI18nProps, getServerSideUserUISettingsProps, getServerSideCommonInitialProps, getServerSideCommonEachProps,
+} from '../common-props';
 import type { InitialProps, SameRouteEachProps } from '../general-page';
 import {
   getServerSideConfigurationProps, getServerSideRendererConfigProps, getServerSideSidebarConfigProps,
   getActivityAction, isValidInitialAndSameRouteProps, isValidSameRouteProps,
 } from '../general-page';
-import { getServerSideCommonInitialProps, getServerSideCommonEachProps } from '../utils/commons';
-import { mergeGetServerSidePropsResults } from '../utils/get-server-side-props';
-import { getServerSideUserUISettingsProps } from '../utils/user-ui-settings';
+import { addActivity } from '../utils/activity';
+import { mergeGetServerSidePropsResults } from '../utils/server-side-props';
 
 import { NEXT_JS_ROUTING_PAGE } from './consts';
 import { getPageDataForInitial, getPageDataForSameRoute } from './page-data-props';

+ 1 - 1
apps/app/src/pages/_app.page.tsx

@@ -18,7 +18,7 @@ import { useAutoUpdateGlobalAtoms } from '~/states/global/auto-update';
 import { useHydrateGlobalInitialAtoms } from '~/states/global/hydrate';
 import { swrGlobalConfiguration } from '~/utils/swr-utils';
 
-import type { CommonEachProps, CommonInitialProps } from './utils/commons';
+import type { CommonEachProps, CommonInitialProps } from './common-props';
 import { getLocaleAtServerSide } from './utils/locale';
 import { useNextjsRoutingPageRegister } from './utils/nextjs-routing-utils';
 import { registerTransformerForObjectId } from './utils/objectid-transformer';

+ 2 - 2
apps/app/src/pages/_private-legacy-pages.page.tsx

@@ -18,10 +18,10 @@ import {
   useIsSearchServiceConfigured, useIsSearchServiceReachable, useRendererConfig, useGrowiCloudUri, useIsEnabledMarp, useCurrentPathname,
 } from '~/stores-universal/context';
 
-import type { CommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
 import {
   getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
-} from './utils/commons';
+} from './common-props';
 
 const SearchResultLayout = dynamic(() => import('~/components/Layout/SearchResultLayout'), { ssr: false });
 

+ 2 - 2
apps/app/src/pages/_search.page.tsx

@@ -20,10 +20,10 @@ import {
 } from '~/stores-universal/context';
 
 import type { NextPageWithLayout } from './_app.page';
-import type { CommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
 import {
   getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
-} from './utils/commons';
+} from './common-props';
 
 
 const SearchPage = dynamic(() => import('~/client/components/SearchPage').then(mod => mod.SearchPage), { ssr: false });

+ 0 - 0
apps/app/src/pages/utils/commons.ts → apps/app/src/pages/common-props/commons.ts


+ 0 - 0
apps/app/src/pages/utils/i18n.ts → apps/app/src/pages/common-props/i18n.ts


+ 6 - 0
apps/app/src/pages/common-props/index.ts

@@ -0,0 +1,6 @@
+export {
+  type CommonInitialProps, getServerSideCommonInitialProps,
+  type CommonEachProps, getServerSideCommonEachProps,
+} from './commons';
+export { getServerSideI18nProps } from './i18n';
+export { getServerSideUserUISettingsProps } from './user-ui-settings';

+ 0 - 0
apps/app/src/pages/utils/user-ui-settings.ts → apps/app/src/pages/common-props/user-ui-settings.ts


+ 2 - 2
apps/app/src/pages/forgot-password-errors.page.tsx

@@ -7,8 +7,8 @@ import Link from 'next/link';
 
 import { forgotPasswordErrorCode } from '~/interfaces/errors/forgot-password';
 
-import type { CommonProps } from './utils/commons';
-import { getNextI18NextConfig, getServerSideCommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getNextI18NextConfig, getServerSideCommonProps } from './common-props';
 
 type Props = CommonProps & {
   errorCode?: forgotPasswordErrorCode

+ 2 - 2
apps/app/src/pages/forgot-password.page.tsx

@@ -8,8 +8,8 @@ import { RawLayout } from '~/components/Layout/RawLayout';
 import type { CrowiRequest } from '~/interfaces/crowi-request';
 import { useIsMailerSetup } from '~/stores-universal/context';
 
-import type { CommonProps } from './utils/commons';
-import { getNextI18NextConfig, getServerSideCommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getNextI18NextConfig, getServerSideCommonProps } from './common-props';
 
 const PasswordResetRequestForm = dynamic(() => import('~/client/components/PasswordResetRequestForm'), { ssr: false });
 

+ 2 - 2
apps/app/src/pages/installer.page.tsx

@@ -14,8 +14,8 @@ import {
   useCsrfToken, useAppTitle, useSiteUrl, useConfidential, useGrowiCloudUri,
 } from '~/stores-universal/context';
 
-import type { CommonProps } from './utils/commons';
-import { getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle } from './common-props';
 
 
 const InstallerForm = dynamic(() => import('~/client/components/InstallerForm'), { ssr: false });

+ 2 - 2
apps/app/src/pages/invited.page.tsx

@@ -12,8 +12,8 @@ import { NoLoginLayout } from '~/components/Layout/NoLoginLayout';
 import type { CrowiRequest } from '~/interfaces/crowi-request';
 import { useCsrfToken, useCurrentPathname, useCurrentUser } from '~/stores-universal/context';
 
-import type { CommonProps } from './utils/commons';
-import { getServerSideCommonProps, generateCustomTitle, getNextI18NextConfig } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getServerSideCommonProps, generateCustomTitle, getNextI18NextConfig } from './common-props';
 
 const InvitedForm = dynamic(() => import('~/client/components/InvitedForm').then(mod => mod.InvitedForm), { ssr: false });
 

+ 2 - 2
apps/app/src/pages/maintenance.page.tsx

@@ -6,8 +6,8 @@ import dynamic from 'next/dynamic';
 import type { CrowiRequest } from '~/interfaces/crowi-request';
 import { useCurrentUser } from '~/stores-universal/context';
 
-import type { CommonProps } from './utils/commons';
-import { getServerSideCommonProps, getNextI18NextConfig } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getServerSideCommonProps, getNextI18NextConfig } from './common-props';
 
 
 const Maintenance = dynamic(() => import('~/client/components/Maintenance').then(mod => mod.Maintenance), { ssr: false });

+ 2 - 2
apps/app/src/pages/me/[[...path]]/index.page.tsx

@@ -25,10 +25,10 @@ import {
 import loggerFactory from '~/utils/logger';
 
 import type { NextPageWithLayout } from '../../_app.page';
-import type { CommonProps } from '../../utils/commons';
+import type { CommonProps } from '../../common-props';
 import {
   getNextI18NextConfig, getServerSideCommonProps, generateCustomTitle,
-} from '../../utils/commons';
+} from '../../common-props';
 
 
 const logger = loggerFactory('growi:pages:me');

+ 2 - 2
apps/app/src/pages/reset-password.page.tsx

@@ -7,8 +7,8 @@ import dynamic from 'next/dynamic';
 
 import { RawLayout } from '~/components/Layout/RawLayout';
 
-import type { CommonProps } from './utils/commons';
-import { getNextI18NextConfig, getServerSideCommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
+import { getNextI18NextConfig, getServerSideCommonProps } from './common-props';
 
 
 type Props = CommonProps & {

+ 2 - 2
apps/app/src/pages/share/[[...path]]/index.page.tsx

@@ -30,10 +30,10 @@ import {
 import loggerFactory from '~/utils/logger';
 
 import type { NextPageWithLayout } from '../../_app.page';
-import type { CommonProps } from '../../utils/commons';
+import type { CommonProps } from '../../common-props';
 import {
   getServerSideCommonProps, generateCustomTitleForPage, getNextI18NextConfig, skipSSR, addActivity,
-} from '../../utils/commons';
+} from '../../common-props';
 
 
 const GrowiContextualSubNavigationSubstance = dynamic(() => import('~/client/components/Navbar/GrowiContextualSubNavigation'), { ssr: false });

+ 2 - 2
apps/app/src/pages/tags.page.tsx

@@ -26,10 +26,10 @@ import { useSWRxTagsList } from '~/stores/tag';
 
 
 import type { NextPageWithLayout } from './_app.page';
-import type { CommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
 import {
   getServerSideCommonProps, getNextI18NextConfig, generateCustomTitle,
-} from './utils/commons';
+} from './common-props';
 
 const PAGING_LIMIT = 10;
 

+ 2 - 2
apps/app/src/pages/trash.page.tsx

@@ -22,10 +22,10 @@ import {
 
 
 import type { NextPageWithLayout } from './_app.page';
-import type { CommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
 import {
   getServerSideCommonProps, getNextI18NextConfig, generateCustomTitleForPage,
-} from './utils/commons';
+} from './common-props';
 
 
 const TrashPageList = dynamic(() => import('~/client/components/TrashPageList').then(mod => mod.TrashPageList), { ssr: false });

+ 2 - 2
apps/app/src/pages/user-activation.page.tsx

@@ -11,10 +11,10 @@ import type { RegistrationMode } from '~/interfaces/registration-mode';
 import type { ReqWithUserRegistrationOrder } from '~/server/middlewares/inject-user-registration-order-by-token-middleware';
 
 
-import type { CommonProps } from './utils/commons';
+import type { CommonProps } from './common-props';
 import {
   getServerSideCommonProps, getNextI18NextConfig, generateCustomTitle,
-} from './utils/commons';
+} from './common-props';
 
 
 const CompleteUserRegistrationForm = dynamic(() => import('~/client/components/CompleteUserRegistrationForm')

+ 0 - 0
apps/app/src/pages/utils/get-server-side-props.ts → apps/app/src/pages/utils/server-side-props.ts


+ 2 - 7
apps/app/src/states/global/auto-update.ts

@@ -1,12 +1,8 @@
 import { useIsomorphicLayoutEffect } from 'usehooks-ts';
 
-import type { CommonEachProps } from '../../pages/utils/commons';
+import type { CommonEachProps } from '~/pages/common-props';
 
-import {
-  useCurrentPathname,
-  useCurrentUser,
-  useCsrfToken,
-} from './global';
+import { useCsrfToken, useCurrentPathname, useCurrentUser } from './global';
 
 /**
  * Hook for auto-updating global UI state atoms with server-side data
@@ -31,5 +27,4 @@ export const useAutoUpdateGlobalAtoms = (props: CommonEachProps): void => {
   useIsomorphicLayoutEffect(() => {
     setCsrfToken(props.csrfToken);
   }, [setCsrfToken, props.csrfToken]);
-
 };