Explorar el Código

disable contents if isSharedUser is true

Yuki Takei hace 4 años
padre
commit
c9383efb17
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      packages/app/src/components/DescendantsPageListModal.tsx

+ 9 - 2
packages/app/src/components/DescendantsPageListModal.tsx

@@ -5,13 +5,16 @@ import { useTranslation } from 'react-i18next';
 import {
   Modal, ModalHeader, ModalBody,
 } from 'reactstrap';
+
+import { useDescendantsPageListModal } from '~/stores/ui';
+import { useIsSharedUser } from '~/stores/context';
+
 import DescendantsPageList from './DescendantsPageList';
 import ExpandOrContractButton from './ExpandOrContractButton';
 import { CustomNavTab } from './CustomNavigation/CustomNav';
 import PageListIcon from './Icons/PageListIcon';
 import TimeLineIcon from './Icons/TimeLineIcon';
 import CustomTabContent from './CustomNavigation/CustomTabContent';
-import { useDescendantsPageListModal } from '~/stores/ui';
 import PageTimeline from './PageTimeline';
 
 
@@ -24,6 +27,8 @@ export const DescendantsPageListModal = (props: Props): JSX.Element => {
   const [activeTab, setActiveTab] = useState('pagelist');
   const [isWindowExpanded, setIsWindowExpanded] = useState(false);
 
+  const { data: isSharedUser } = useIsSharedUser();
+
   const { data: status, close } = useDescendantsPageListModal();
 
   const navTabMapping = useMemo(() => {
@@ -38,15 +43,17 @@ export const DescendantsPageListModal = (props: Props): JSX.Element => {
         },
         i18n: t('page_list'),
         index: 0,
+        isLinkEnabled: () => !isSharedUser,
       },
       timeline: {
         Icon: TimeLineIcon,
         Content: () => <PageTimeline />,
         i18n: t('Timeline View'),
         index: 1,
+        isLinkEnabled: () => !isSharedUser,
       },
     };
-  }, [status, t]);
+  }, [isSharedUser, status, t]);
 
   const buttons = useMemo(() => (
     <div className="d-flex flex-nowrap">