|
@@ -1,7 +1,7 @@
|
|
|
import React, { useMemo, useState } from 'react';
|
|
import React, { useMemo, useState } from 'react';
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
- Modal, ModalBody, ModalHeader, TabContent, TabPane,
|
|
|
|
|
|
|
+ Modal, ModalBody, ModalHeader,
|
|
|
} from 'reactstrap';
|
|
} from 'reactstrap';
|
|
|
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
@@ -19,6 +19,7 @@ import PageHistory from './PageHistory';
|
|
|
import ShareLink from './ShareLink/ShareLink';
|
|
import ShareLink from './ShareLink/ShareLink';
|
|
|
import { CustomNavTab } from './CustomNavigation/CustomNav';
|
|
import { CustomNavTab } from './CustomNavigation/CustomNav';
|
|
|
import ExpandOrContractButton from './ExpandOrContractButton';
|
|
import ExpandOrContractButton from './ExpandOrContractButton';
|
|
|
|
|
+import CustomTabContent from './CustomNavigation/CustomTabContent';
|
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
@@ -35,29 +36,38 @@ const PageAccessoriesModal = (props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
- const [activeTab, setActiveTab] = useState(PageAccessoriesModalContents.PageHistory);
|
|
|
|
|
|
|
+ const [activeTab, setActiveTab] = useState<PageAccessoriesModalContents>(PageAccessoriesModalContents.PageHistory);
|
|
|
const [isWindowExpanded, setIsWindowExpanded] = useState(false);
|
|
const [isWindowExpanded, setIsWindowExpanded] = useState(false);
|
|
|
|
|
|
|
|
const { data: isSharedUser } = useIsSharedUser();
|
|
const { data: isSharedUser } = useIsSharedUser();
|
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
|
|
|
|
|
|
- const { data: status, open, close } = usePageAccessoriesModal();
|
|
|
|
|
|
|
+ // const { data: status, close } = usePageAccessoriesModal({
|
|
|
|
|
+ // isOpened: false,
|
|
|
|
|
+ // onOpened: (activatedContents) => {
|
|
|
|
|
+ // setActiveTab(activatedContents);
|
|
|
|
|
+ // },
|
|
|
|
|
+ // });
|
|
|
|
|
+ const { data: status, close } = usePageAccessoriesModal();
|
|
|
|
|
|
|
|
const navTabMapping = useMemo(() => {
|
|
const navTabMapping = useMemo(() => {
|
|
|
return {
|
|
return {
|
|
|
[PageAccessoriesModalContents.PageHistory]: {
|
|
[PageAccessoriesModalContents.PageHistory]: {
|
|
|
Icon: HistoryIcon,
|
|
Icon: HistoryIcon,
|
|
|
|
|
+ Content: () => <PageHistory />,
|
|
|
i18n: t('History'),
|
|
i18n: t('History'),
|
|
|
index: 0,
|
|
index: 0,
|
|
|
isLinkEnabled: () => !isGuestUser && !isSharedUser,
|
|
isLinkEnabled: () => !isGuestUser && !isSharedUser,
|
|
|
},
|
|
},
|
|
|
[PageAccessoriesModalContents.Attachment]: {
|
|
[PageAccessoriesModalContents.Attachment]: {
|
|
|
Icon: AttachmentIcon,
|
|
Icon: AttachmentIcon,
|
|
|
|
|
+ Content: () => <PageAttachment />,
|
|
|
i18n: t('attachment_data'),
|
|
i18n: t('attachment_data'),
|
|
|
index: 1,
|
|
index: 1,
|
|
|
},
|
|
},
|
|
|
[PageAccessoriesModalContents.ShareLink]: {
|
|
[PageAccessoriesModalContents.ShareLink]: {
|
|
|
Icon: ShareLinkIcon,
|
|
Icon: ShareLinkIcon,
|
|
|
|
|
+ Content: () => <ShareLink />,
|
|
|
i18n: t('share_links.share_link_management'),
|
|
i18n: t('share_links.share_link_management'),
|
|
|
index: 2,
|
|
index: 2,
|
|
|
isLinkEnabled: () => !isGuestUser && !isSharedUser && !isLinkSharingDisabled,
|
|
isLinkEnabled: () => !isGuestUser && !isSharedUser && !isLinkSharingDisabled,
|
|
@@ -82,7 +92,7 @@ const PageAccessoriesModal = (props: Props): JSX.Element => {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const { isOpened, activatedContents } = status;
|
|
|
|
|
|
|
+ const { isOpened } = status;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Modal
|
|
<Modal
|
|
@@ -98,29 +108,12 @@ const PageAccessoriesModal = (props: Props): JSX.Element => {
|
|
|
breakpointToHideInactiveTabsDown="md"
|
|
breakpointToHideInactiveTabsDown="md"
|
|
|
onNavSelected={(v) => {
|
|
onNavSelected={(v) => {
|
|
|
setActiveTab(v);
|
|
setActiveTab(v);
|
|
|
- open(v);
|
|
|
|
|
}}
|
|
}}
|
|
|
hideBorderBottom
|
|
hideBorderBottom
|
|
|
/>
|
|
/>
|
|
|
</ModalHeader>
|
|
</ModalHeader>
|
|
|
<ModalBody className="overflow-auto grw-modal-body-style">
|
|
<ModalBody className="overflow-auto grw-modal-body-style">
|
|
|
- {/* Do not use CustomTabContent because of performance problem:
|
|
|
|
|
- the 'navTabMapping[tabId].Content' for PageAccessoriesModal depends on activatedContents */}
|
|
|
|
|
- <TabContent activeTab={activeTab}>
|
|
|
|
|
- {!isGuestUser && (
|
|
|
|
|
- <TabPane tabId={PageAccessoriesModalContents.PageHistory}>
|
|
|
|
|
- {activatedContents.has(PageAccessoriesModalContents.PageHistory) && <PageHistory /> }
|
|
|
|
|
- </TabPane>
|
|
|
|
|
- )}
|
|
|
|
|
- <TabPane tabId={PageAccessoriesModalContents.Attachment}>
|
|
|
|
|
- {activatedContents.has(PageAccessoriesModalContents.Attachment) && <PageAttachment />}
|
|
|
|
|
- </TabPane>
|
|
|
|
|
- {!isGuestUser && (
|
|
|
|
|
- <TabPane tabId={PageAccessoriesModalContents.ShareLink}>
|
|
|
|
|
- {activatedContents.has(PageAccessoriesModalContents.ShareLink) && <ShareLink />}
|
|
|
|
|
- </TabPane>
|
|
|
|
|
- )}
|
|
|
|
|
- </TabContent>
|
|
|
|
|
|
|
+ <CustomTabContent activeTab={activeTab} navTabMapping={navTabMapping} />
|
|
|
</ModalBody>
|
|
</ModalBody>
|
|
|
</Modal>
|
|
</Modal>
|
|
|
);
|
|
);
|