import React, { useState, useMemo } from 'react'; import { useTranslation } from 'next-i18next'; import { Modal, ModalHeader, ModalBody, } from 'reactstrap'; import { useIsSharedUser } from '~/stores/context'; import { useDescendantsPageListModal } from '~/stores/modal'; import { CustomNavTab } from './CustomNavigation/CustomNav'; import CustomTabContent from './CustomNavigation/CustomTabContent'; import { DescendantsPageList } from './DescendantsPageList'; import ExpandOrContractButton from './ExpandOrContractButton'; import PageListIcon from './Icons/PageListIcon'; import TimeLineIcon from './Icons/TimeLineIcon'; import PageTimeline from './PageTimeline'; export const DescendantsPageListModal = (): JSX.Element => { const { t } = useTranslation(); const [activeTab, setActiveTab] = useState('pagelist'); const [isWindowExpanded, setIsWindowExpanded] = useState(false); const { data: isSharedUser } = useIsSharedUser(); const { data: status, close } = useDescendantsPageListModal(); const navTabMapping = useMemo(() => { return { pagelist: { Icon: PageListIcon, Content: () => { if (status == null || status.path == null || !status.isOpened) { return <>; } return ; }, i18n: t('page_list'), index: 0, isLinkEnabled: () => !isSharedUser, }, timeline: { Icon: TimeLineIcon, Content: () => , i18n: t('Timeline View'), index: 1, isLinkEnabled: () => !isSharedUser, }, }; }, [isSharedUser, status, t]); const buttons = useMemo(() => (
setIsWindowExpanded(true)} contractWindow={() => setIsWindowExpanded(false)} />
), [close, isWindowExpanded]); if (status == null) { return <>; } const { isOpened } = status; return ( setActiveTab(v)} hideBorderBottom /> ); };