|
@@ -1,15 +1,15 @@
|
|
|
-import React, {
|
|
|
|
|
- FC,
|
|
|
|
|
-} from 'react';
|
|
|
|
|
|
|
+import React, { FC } from 'react';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
import { DevidedPagePath } from '@growi/core';
|
|
import { DevidedPagePath } from '@growi/core';
|
|
|
|
|
|
|
|
|
|
+import { IPageHasId, IPageWithMeta } from '~/interfaces/page';
|
|
|
import { useCurrentPagePath } from '~/stores/context';
|
|
import { useCurrentPagePath } from '~/stores/context';
|
|
|
|
|
+import { useSWRxPageInfoForList } from '~/stores/page';
|
|
|
|
|
|
|
|
|
|
+import PageListIcon from './Icons/PageListIcon';
|
|
|
import { PageListItemL } from './PageList/PageListItemL';
|
|
import { PageListItemL } from './PageList/PageListItemL';
|
|
|
-import { useSWRxPageInfoForList } from '~/stores/page';
|
|
|
|
|
-import { IPageHasId, IPageWithMeta } from '~/interfaces/page';
|
|
|
|
|
|
|
+import { useDescendantsPageListModal } from '~/stores/ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
type IdenticalPathAlertProps = {
|
|
type IdenticalPathAlertProps = {
|
|
@@ -55,24 +55,36 @@ type IdenticalPathPageProps= {
|
|
|
const jsonNull = 'null';
|
|
const jsonNull = 'null';
|
|
|
|
|
|
|
|
const IdenticalPathPage:FC<IdenticalPathPageProps> = (props: IdenticalPathPageProps) => {
|
|
const IdenticalPathPage:FC<IdenticalPathPageProps> = (props: IdenticalPathPageProps) => {
|
|
|
|
|
+ const { t } = useTranslation();
|
|
|
|
|
|
|
|
const identicalPageDocument = document.getElementById('identical-path-page');
|
|
const identicalPageDocument = document.getElementById('identical-path-page');
|
|
|
const pages = JSON.parse(identicalPageDocument?.getAttribute('data-identical-path-pages') || jsonNull) as IPageHasId[];
|
|
const pages = JSON.parse(identicalPageDocument?.getAttribute('data-identical-path-pages') || jsonNull) as IPageHasId[];
|
|
|
|
|
|
|
|
const pageIds = pages.map(page => page._id) as string[];
|
|
const pageIds = pages.map(page => page._id) as string[];
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const { data: idToPageInfoMap } = useSWRxPageInfoForList(pageIds);
|
|
const { data: idToPageInfoMap } = useSWRxPageInfoForList(pageIds);
|
|
|
|
|
|
|
|
const { data: currentPath } = useCurrentPagePath();
|
|
const { data: currentPath } = useCurrentPagePath();
|
|
|
|
|
|
|
|
|
|
+ const { open: openDescendantPageListModal } = useDescendantsPageListModal();
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="d-flex flex-column flex-lg-row-reverse">
|
|
<div className="d-flex flex-column flex-lg-row-reverse">
|
|
|
|
|
|
|
|
<div className="grw-side-contents-container">
|
|
<div className="grw-side-contents-container">
|
|
|
- <div className="grw-side-contents-sticky-container">
|
|
|
|
|
- <div className="border-bottom pb-1">
|
|
|
|
|
- {/* <PageAccessories isNotFoundPage={!isPageExist} /> */}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div className="grw-page-accessories-control border-bottom pb-1">
|
|
|
|
|
+ { currentPath != null && (
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ className="btn btn-block btn-outline-secondary grw-btn-page-accessories rounded-pill d-flex justify-content-between px-3"
|
|
|
|
|
+ onClick={() => openDescendantPageListModal(currentPath)}
|
|
|
|
|
+ >
|
|
|
|
|
+ <PageListIcon />
|
|
|
|
|
+ {t('page_list')}
|
|
|
|
|
+ <span></span> {/* for a count badge */}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ) }
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|