|
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
} from 'react';
|
|
|
import nodePath from 'path';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
+import { pagePathUtils } from '@growi/core';
|
|
|
|
|
|
import { ItemNode } from './ItemNode';
|
|
|
import { IPageHasId } from '~/interfaces/page';
|
|
|
@@ -13,6 +14,8 @@ import { IPageForPageDeleteModal } from '~/components/PageDeleteModal';
|
|
|
|
|
|
import TriangleIcon from '~/components/Icons/TriangleIcon';
|
|
|
|
|
|
+const { isTopPage } = pagePathUtils;
|
|
|
+
|
|
|
|
|
|
interface ItemProps {
|
|
|
isEnableActions: boolean
|
|
|
@@ -39,6 +42,7 @@ const markTarget = (children: ItemNode[], targetId?: string): void => {
|
|
|
type ItemControlProps = {
|
|
|
page: Partial<IPageHasId>
|
|
|
isEnableActions: boolean
|
|
|
+ isDeletable: boolean
|
|
|
onClickDeleteButtonHandler?(): void
|
|
|
onClickPlusButtonHandler?(): void
|
|
|
}
|
|
|
@@ -66,7 +70,7 @@ const ItemControl: FC<ItemControlProps> = memo((props: ItemControlProps) => {
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <PageItemControl page={props.page} onClickDeleteButton={onClickDeleteButton} isEnableActions={props.isEnableActions} />
|
|
|
+ <PageItemControl page={props.page} onClickDeleteButton={onClickDeleteButton} isEnableActions={props.isEnableActions} isDeletable={props.isDeletable} />
|
|
|
<button
|
|
|
type="button"
|
|
|
className="btn-link nav-link border-0 rounded grw-btn-page-management py-0"
|
|
|
@@ -197,6 +201,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
onClickDeleteButtonHandler={onClickDeleteButtonHandler}
|
|
|
onClickPlusButtonHandler={() => { setNewPageInputShown(true) }}
|
|
|
isEnableActions={isEnableActions}
|
|
|
+ isDeletable={!page.isEmpty && !isTopPage(page.path as string)}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|