Explorar o código

remove appContainer

yohei0125 %!s(int64=3) %!d(string=hai) anos
pai
achega
4fe9d4fd77

+ 1 - 11
packages/app/src/components/SearchPage.tsx

@@ -8,7 +8,6 @@ import { useTranslation } from 'next-i18next';
 
 
 
 
 import { ISelectableAll, ISelectableAndIndeterminatable } from '~/client/interfaces/selectable-all';
 import { ISelectableAll, ISelectableAndIndeterminatable } from '~/client/interfaces/selectable-all';
-import AppContainer from '~/client/services/AppContainer';
 import { IFormattedSearchResult } from '~/interfaces/search';
 import { IFormattedSearchResult } from '~/interfaces/search';
 import { useIsSearchServiceReachable } from '~/stores/context';
 import { useIsSearchServiceReachable } from '~/stores/context';
 import { ISearchConditions, ISearchConfigurations, useSWRxSearch } from '~/stores/search';
 import { ISearchConditions, ISearchConfigurations, useSWRxSearch } from '~/stores/search';
@@ -97,17 +96,9 @@ const getParsedUrlQuery = () => {
   return parseQuerystring(search.slice(1)); // remove heading '?' and parse
   return parseQuerystring(search.slice(1)); // remove heading '?' and parse
 };
 };
 
 
-type Props = {
-  appContainer: AppContainer,
-}
-
-export const SearchPage = (props: Props): JSX.Element => {
+export const SearchPage = (): JSX.Element => {
   const { t } = useTranslation();
   const { t } = useTranslation();
 
 
-  const {
-    appContainer,
-  } = props;
-
   // parse URL Query
   // parse URL Query
   const parsedQueries = getParsedUrlQuery().q;
   const parsedQueries = getParsedUrlQuery().q;
   const initQ = (Array.isArray(parsedQueries) ? parsedQueries.join(' ') : parsedQueries) ?? '';
   const initQ = (Array.isArray(parsedQueries) ? parsedQueries.join(' ') : parsedQueries) ?? '';
@@ -272,7 +263,6 @@ export const SearchPage = (props: Props): JSX.Element => {
   return (
   return (
     <SearchPageBase
     <SearchPageBase
       ref={searchPageBaseRef}
       ref={searchPageBaseRef}
-      appContainer={appContainer}
       pages={data?.data}
       pages={data?.data}
       searchingKeyword={keyword}
       searchingKeyword={keyword}
       onSelectedPagesByCheckboxesChanged={selectedPagesByCheckboxesChangedHandler}
       onSelectedPagesByCheckboxesChanged={selectedPagesByCheckboxesChangedHandler}

+ 0 - 3
packages/app/src/components/SearchPage/SearchResultContent.tsx

@@ -19,7 +19,6 @@ import { useSearchResultOptions } from '~/stores/renderer';
 import { useFullTextSearchTermManager } from '~/stores/search';
 import { useFullTextSearchTermManager } from '~/stores/search';
 
 
 
 
-import AppContainer from '../../client/services/AppContainer';
 import { AdditionalMenuItemsRendererProps, ForceHideMenuItems } from '../Common/Dropdown/PageItemControl';
 import { AdditionalMenuItemsRendererProps, ForceHideMenuItems } from '../Common/Dropdown/PageItemControl';
 import { GrowiSubNavigation } from '../Navbar/GrowiSubNavigation';
 import { GrowiSubNavigation } from '../Navbar/GrowiSubNavigation';
 import { SubNavButtons } from '../Navbar/SubNavButtons';
 import { SubNavButtons } from '../Navbar/SubNavButtons';
@@ -54,7 +53,6 @@ const SCROLL_OFFSET_TOP = 175; // approximate height of (navigation + subnavigat
 const MUTATION_OBSERVER_CONFIG = { childList: true, subtree: true };
 const MUTATION_OBSERVER_CONFIG = { childList: true, subtree: true };
 
 
 type Props ={
 type Props ={
-  appContainer: AppContainer,
   pageWithMeta : IPageWithSearchMeta,
   pageWithMeta : IPageWithSearchMeta,
   highlightKeywords?: string[],
   highlightKeywords?: string[],
   showPageControlDropdown?: boolean,
   showPageControlDropdown?: boolean,
@@ -106,7 +104,6 @@ export const SearchResultContent: FC<Props> = (props: Props) => {
   // *******************************  end  *******************************
   // *******************************  end  *******************************
 
 
   const {
   const {
-    appContainer,
     pageWithMeta,
     pageWithMeta,
     highlightKeywords,
     highlightKeywords,
     showPageControlDropdown,
     showPageControlDropdown,

+ 0 - 5
packages/app/src/components/SearchPage2/SearchPageBase.tsx

@@ -5,7 +5,6 @@ import React, {
 import { useTranslation } from 'next-i18next';
 import { useTranslation } from 'next-i18next';
 
 
 import { ISelectableAll } from '~/client/interfaces/selectable-all';
 import { ISelectableAll } from '~/client/interfaces/selectable-all';
-import AppContainer from '~/client/services/AppContainer';
 import { toastSuccess } from '~/client/util/apiNotification';
 import { toastSuccess } from '~/client/util/apiNotification';
 import { IFormattedSearchResult, IPageWithSearchMeta } from '~/interfaces/search';
 import { IFormattedSearchResult, IPageWithSearchMeta } from '~/interfaces/search';
 import { OnDeletedFunction } from '~/interfaces/ui';
 import { OnDeletedFunction } from '~/interfaces/ui';
@@ -28,8 +27,6 @@ export interface IReturnSelectedPageIds {
 
 
 
 
 type Props = {
 type Props = {
-  appContainer: AppContainer,
-
   pages?: IPageWithSearchMeta[],
   pages?: IPageWithSearchMeta[],
   searchingKeyword?: string,
   searchingKeyword?: string,
 
 
@@ -44,7 +41,6 @@ type Props = {
 
 
 const SearchPageBaseSubstance: ForwardRefRenderFunction<ISelectableAll & IReturnSelectedPageIds, Props> = (props:Props, ref) => {
 const SearchPageBaseSubstance: ForwardRefRenderFunction<ISelectableAll & IReturnSelectedPageIds, Props> = (props:Props, ref) => {
   const {
   const {
-    appContainer,
     pages,
     pages,
     searchingKeyword,
     searchingKeyword,
     forceHideMenuItems,
     forceHideMenuItems,
@@ -203,7 +199,6 @@ const SearchPageBaseSubstance: ForwardRefRenderFunction<ISelectableAll & IReturn
         <div className="mw-0 flex-grow-1 flex-basis-0 d-none d-lg-block search-result-content">
         <div className="mw-0 flex-grow-1 flex-basis-0 d-none d-lg-block search-result-content">
           { selectedPageWithMeta != null && (
           { selectedPageWithMeta != null && (
             <SearchResultContent
             <SearchResultContent
-              appContainer={appContainer}
               pageWithMeta={selectedPageWithMeta}
               pageWithMeta={selectedPageWithMeta}
               highlightKeywords={highlightKeywords}
               highlightKeywords={highlightKeywords}
               showPageControlDropdown={!isGuestUser}
               showPageControlDropdown={!isGuestUser}

+ 10 - 4
packages/app/src/pages/_search.page.tsx

@@ -23,6 +23,8 @@ import {
 } from '~/stores/ui';
 } from '~/stores/ui';
 import { useXss } from '~/stores/xss';
 import { useXss } from '~/stores/xss';
 
 
+// import { SearchPage } from '../components/SearchPage';
+
 import {
 import {
   CommonProps, getNextI18NextConfig, getServerSideCommonProps, useCustomTitle,
   CommonProps, getNextI18NextConfig, getServerSideCommonProps, useCustomTitle,
 } from './utils/commons';
 } from './utils/commons';
@@ -44,7 +46,7 @@ type Props = CommonProps & {
 
 
 };
 };
 
 
-const SearchPage: NextPage<Props> = (props: Props) => {
+const SearchResultPage: NextPage<Props> = (props: Props) => {
   const { userUISettings } = props;
   const { userUISettings } = props;
 
 
   // commons
   // commons
@@ -74,6 +76,11 @@ const SearchPage: NextPage<Props> = (props: Props) => {
     return <PutbackPageModal />;
     return <PutbackPageModal />;
   };
   };
 
 
+  const SearchPage = (): JSX.Element => {
+    const SearchPage = dynamic(() => import('../components/SearchPage').then(mod => mod.SearchPage), { ssr: false });
+    return <SearchPage />;
+  };
+
   const classNames: string[] = [];
   const classNames: string[] = [];
   // if (props.isContainerFluid) {
   // if (props.isContainerFluid) {
   //   classNames.push('growi-layout-fluid');
   //   classNames.push('growi-layout-fluid');
@@ -93,8 +100,7 @@ const SearchPage: NextPage<Props> = (props: Props) => {
         <div id="main" className="main search-page mt-0">
         <div id="main" className="main search-page mt-0">
 
 
           <div id="search-page">
           <div id="search-page">
-            Search Result Page
-            {/* render SearchPage component here */}
+            <SearchPage />
           </div>
           </div>
 
 
         </div>
         </div>
@@ -184,4 +190,4 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
   };
   };
 };
 };
 
 
-export default SearchPage;
+export default SearchResultPage;