|
|
@@ -1,32 +1,33 @@
|
|
|
import React, {
|
|
|
useCallback, useState, FC, useEffect,
|
|
|
} from 'react';
|
|
|
-import { DropdownToggle } from 'reactstrap';
|
|
|
-import { useTranslation } from 'react-i18next';
|
|
|
-
|
|
|
-import { useDrag, useDrop } from 'react-dnd';
|
|
|
|
|
|
import nodePath from 'path';
|
|
|
|
|
|
import { pathUtils, pagePathUtils } from '@growi/core';
|
|
|
+import { useDrag, useDrop } from 'react-dnd';
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
+import { DropdownToggle } from 'reactstrap';
|
|
|
|
|
|
-import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
+import { bookmark, unbookmark } from '~/client/services/page-operation';
|
|
|
import { toastWarning, toastError, toastSuccess } from '~/client/util/apiNotification';
|
|
|
-
|
|
|
-import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
|
import { apiv3Put, apiv3Post } from '~/client/util/apiv3-client';
|
|
|
+import TriangleIcon from '~/components/Icons/TriangleIcon';
|
|
|
+import {
|
|
|
+ IPageHasId, IPageInfoAll, IPageToDeleteWithMeta,
|
|
|
+} from '~/interfaces/page';
|
|
|
import { IPageForPageDuplicateModal } from '~/stores/modal';
|
|
|
+import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
|
+import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
|
+import loggerFactory from '~/utils/logger';
|
|
|
+
|
|
|
|
|
|
-import TriangleIcon from '~/components/Icons/TriangleIcon';
|
|
|
-import { bookmark, unbookmark } from '~/client/services/page-operation';
|
|
|
import ClosableTextInput, { AlertInfo, AlertType } from '../../Common/ClosableTextInput';
|
|
|
+import CountBadge from '../../Common/CountBadge';
|
|
|
import { PageItemControl } from '../../Common/Dropdown/PageItemControl';
|
|
|
+
|
|
|
import { ItemNode } from './ItemNode';
|
|
|
-import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
|
-import {
|
|
|
- IPageHasId, IPageInfoAll, IPageToDeleteWithMeta,
|
|
|
-} from '~/interfaces/page';
|
|
|
|
|
|
|
|
|
const logger = loggerFactory('growi:cli:Item');
|
|
|
@@ -94,20 +95,6 @@ const isDroppable = (fromPage?: Partial<IPageHasId>, newParentPage?: Partial<IPa
|
|
|
};
|
|
|
|
|
|
|
|
|
-type ItemCountProps = {
|
|
|
- descendantCount: number
|
|
|
-}
|
|
|
-
|
|
|
-const ItemCount: FC<ItemCountProps> = (props:ItemCountProps) => {
|
|
|
- return (
|
|
|
- <>
|
|
|
- <span className="grw-pagetree-count badge badge-pill badge-light">
|
|
|
- {props.descendantCount}
|
|
|
- </span>
|
|
|
- </>
|
|
|
- );
|
|
|
-};
|
|
|
-
|
|
|
const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
const { t } = useTranslation();
|
|
|
const {
|
|
|
@@ -465,7 +452,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
)}
|
|
|
{descendantCount > 0 && !isRenameInputShown && (
|
|
|
<div className="grw-pagetree-count-wrapper">
|
|
|
- <ItemCount descendantCount={descendantCount} />
|
|
|
+ <CountBadge count={descendantCount} />
|
|
|
</div>
|
|
|
)}
|
|
|
<div className="grw-pagetree-control d-flex">
|