Sfoglia il codice sorgente

fix the condition to show UserInfo

Yuki Takei 3 anni fa
parent
commit
0415d9f05b
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      packages/app/src/components/Page/DisplaySwitcher.tsx

+ 4 - 4
packages/app/src/components/Page/DisplaySwitcher.tsx

@@ -6,7 +6,7 @@ import dynamic from 'next/dynamic';
 
 
 // import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
 // import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
 import {
 import {
-  useCurrentPagePath, useIsSharedUser, useIsEditable, useIsUserPage, usePageUser, useShareLinkId, useIsNotFound,
+  useCurrentPagePath, useIsSharedUser, useIsEditable, usePageUser, useShareLinkId, useIsNotFound,
 } from '~/stores/context';
 } from '~/stores/context';
 import { useDescendantsPageListModal } from '~/stores/modal';
 import { useDescendantsPageListModal } from '~/stores/modal';
 import { useSWRxCurrentPage } from '~/stores/page';
 import { useSWRxCurrentPage } from '~/stores/page';
@@ -23,7 +23,7 @@ import { UserInfoProps } from '../User/UserInfo';
 import styles from './DisplaySwitcher.module.scss';
 import styles from './DisplaySwitcher.module.scss';
 
 
 
 
-const { isTopPage } = pagePathUtils;
+const { isTopPage, isUsersTopPage } = pagePathUtils;
 
 
 
 
 const PageEditor = dynamic(() => import('../PageEditor'), { ssr: false });
 const PageEditor = dynamic(() => import('../PageEditor'), { ssr: false });
@@ -41,19 +41,19 @@ const PageView = React.memo((): JSX.Element => {
   const { data: currentPagePath } = useCurrentPagePath();
   const { data: currentPagePath } = useCurrentPagePath();
   const { data: isSharedUser } = useIsSharedUser();
   const { data: isSharedUser } = useIsSharedUser();
   const { data: shareLinkId } = useShareLinkId();
   const { data: shareLinkId } = useShareLinkId();
-  const { data: isUserPage } = useIsUserPage();
   const { data: pageUser } = usePageUser();
   const { data: pageUser } = usePageUser();
   const { data: isNotFound } = useIsNotFound();
   const { data: isNotFound } = useIsNotFound();
   const { data: currentPage } = useSWRxCurrentPage(shareLinkId ?? undefined);
   const { data: currentPage } = useSWRxCurrentPage(shareLinkId ?? undefined);
   const { open: openDescendantPageListModal } = useDescendantsPageListModal();
   const { open: openDescendantPageListModal } = useDescendantsPageListModal();
 
 
   const isTopPagePath = isTopPage(currentPagePath ?? '');
   const isTopPagePath = isTopPage(currentPagePath ?? '');
+  const isUsersTopPagePath = isUsersTopPage(currentPagePath ?? '');
 
 
   return (
   return (
     <div className="d-flex flex-column flex-lg-row">
     <div className="d-flex flex-column flex-lg-row">
 
 
       <div className="flex-grow-1 flex-basis-0 mw-0">
       <div className="flex-grow-1 flex-basis-0 mw-0">
-        { isUserPage && pageUser != null && <UserInfo pageUser={pageUser} />}
+        { pageUser != null && isUsersTopPagePath && <UserInfo pageUser={pageUser} />}
         { !isNotFound && <Page /> }
         { !isNotFound && <Page /> }
         { isNotFound && <NotFoundPage /> }
         { isNotFound && <NotFoundPage /> }
       </div>
       </div>