Просмотр исходного кода

revert growi contextual sub navigation

ryoji-s 2 лет назад
Родитель
Сommit
f3585f9663
1 измененных файлов с 1 добавлено и 72 удалено
  1. 1 72
      apps/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

+ 1 - 72
apps/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -12,9 +12,8 @@ import { useRouter } from 'next/router';
 import { DropdownItem } from 'reactstrap';
 
 import {
-  createPage, exist, exportAsMarkdown, updateContentWidth,
+  exportAsMarkdown, updateContentWidth,
 } from '~/client/services/page-operation';
-import { toastError } from '~/client/util/toastr';
 import type { OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction } from '~/interfaces/ui';
 import {
   useCurrentPathname,
@@ -33,7 +32,6 @@ import {
   useIsAbleToChangeEditorMode,
   useSelectedGrant,
 } from '~/stores/ui';
-import loggerFactory from '~/utils/logger';
 
 import CreateTemplateModal from '../CreateTemplateModal';
 import AttachmentIcon from '../Icons/AttachmentIcon';
@@ -179,16 +177,12 @@ type GrowiContextualSubNavigationProps = {
   isLinkSharingDisabled?: boolean,
 };
 
-const logger = loggerFactory('growi:cli:GrowiContextualSubNavigation');
-
 const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps): JSX.Element => {
 
   const { currentPage } = props;
 
   const router = useRouter();
 
-  const [isCreating, setIsCreating] = useState<boolean>(false);
-
   const { data: shareLinkId } = useShareLinkId();
   const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
 
@@ -269,68 +263,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
     }
   }, [isSharedPage, mutateCurrentPage]);
 
-  const onClickTemplateForChildrenButtonHandler = useCallback(async() => {
-    try {
-      setIsCreating(true);
-
-      const path = currentPage == null || currentPage.path === '/'
-        ? '/_template'
-        : `${currentPage.path}/_template`;
-
-      const params = {
-        isSlackEnabled: false,
-        slackChannels: '',
-        grant: currentPage?.grant || 1,
-        grantUserGroupId: currentPage?.grantedGroup?._id,
-      };
-
-      const res = await exist(JSON.stringify([path]));
-      if (!res.pages[path]) {
-        await createPage(path, '', params);
-      }
-
-      router.push(`${path}#edit`);
-    }
-    catch (err) {
-      logger.warn(err);
-      toastError(err);
-    }
-    finally {
-      setIsCreating(false);
-    }
-  }, [currentPage, router]);
-
-  const onClickTemplateForDescendantsButtonHandler = useCallback(async() => {
-    try {
-      setIsCreating(true);
-
-      const path = currentPage == null || currentPage.path === '/'
-        ? '/__template'
-        : `${currentPage.path}/__template`;
-
-      const params = {
-        isSlackEnabled: false,
-        slackChannels: '',
-        grant: currentPage?.grant || 1,
-        grantUserGroupId: currentPage?.grantedGroup?._id,
-      };
-
-      const res = await exist(JSON.stringify([path]));
-      if (!res.pages[path]) {
-        await createPage(path, '', params);
-      }
-
-      router.push(`${path}#edit`);
-    }
-    catch (err) {
-      logger.warn(err);
-      toastError(err);
-    }
-    finally {
-      setIsCreating(false);
-    }
-  }, [currentPage, router]);
-
   const additionalMenuItemsRenderer = useCallback(() => {
     if (revisionId == null || pageId == null) {
       return (
@@ -406,9 +338,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
           path={path}
           isOpen={isPageTemplateModalShown}
           onClose={() => setIsPageTempleteModalShown(false)}
-          isCreating={isCreating}
-          onClickTemplateForChildrenButtonHandler={onClickTemplateForChildrenButtonHandler}
-          onClickTemplateForDescendantsButtonHandler={onClickTemplateForDescendantsButtonHandler}
         />
       )}
     </>