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

have app.jsx decide to show DisplaySwitcher

yohei0125 3 лет назад
Родитель
Сommit
85f765e660

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

@@ -155,8 +155,12 @@ 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 = () => {

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

@@ -36,7 +36,6 @@ 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();
@@ -60,7 +59,7 @@ const DisplaySwitcher = (): JSX.Element => {
         <TabPane tabId={EditorMode.View}>
           <div className="d-flex flex-column flex-lg-row-reverse">
 
-            { isPageExist && !isEmptyPage && (
+            { isPageExist && (
               <div className="grw-side-contents-container">
                 <div className="grw-side-contents-sticky-container">