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

put back changes for DisplaySwitcher

yohei0125 3 лет назад
Родитель
Сommit
73dd57bfde

+ 1 - 5
packages/app/src/client/app.jsx

@@ -155,12 +155,8 @@ if (pageContainer.state.path != null) {
     'page': <Page />,
     'grw-subnav-container': <GrowiContextualSubNavigation isLinkSharingDisabled={appContainer.config.disableLinkSharing} />,
     'grw-subnav-switcher-container': <GrowiSubNavigationSwitcher isLinkSharingDisabled={appContainer.config.disableLinkSharing} />,
+    'display-switcher': <DisplaySwitcher />,
   });
-  if (!pageContainer.state.isEmpty) {
-    Object.assign(componentMappings, {
-      'display-switcher': <DisplaySwitcher />,
-    });
-  }
 }
 
 const renderMainComponents = () => {

+ 2 - 1
packages/app/src/components/Page/DisplaySwitcher.tsx

@@ -36,6 +36,7 @@ const DisplaySwitcher = (): JSX.Element => {
   // get element for smoothScroll
   const getCommentListDom = useMemo(() => { return document.getElementById('page-comments-list') }, []);
 
+  const { data: isEmptyPage } = useIsEmptyPageInNotFoundContent();
   const { data: currentPageId } = useCurrentPageId();
   const { data: currentPagePath } = useCurrentPagePath();
   const { data: isSharedUser } = useIsSharedUser();
@@ -59,7 +60,7 @@ const DisplaySwitcher = (): JSX.Element => {
         <TabPane tabId={EditorMode.View}>
           <div className="d-flex flex-column flex-lg-row-reverse">
 
-            { isPageExist && (
+            { isPageExist && !isEmptyPage && (
               <div className="grw-side-contents-container">
                 <div className="grw-side-contents-sticky-container">