|
|
@@ -13,8 +13,6 @@ import {
|
|
|
} from '~/stores/ui';
|
|
|
import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
|
|
|
|
|
|
-import AppContainer from '~/client/services/AppContainer';
|
|
|
-
|
|
|
/*
|
|
|
* Utility to generate initial node
|
|
|
*/
|
|
|
@@ -32,8 +30,7 @@ const generateInitialNodeBeforeResponse = (targetAndAncestors: Partial<IPageHasI
|
|
|
return rootNode;
|
|
|
};
|
|
|
|
|
|
-const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Partial<IPageHasId>[]>, rootNode: ItemNode):
|
|
|
-ItemNode => {
|
|
|
+const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Partial<IPageHasId>[]>, rootNode: ItemNode): ItemNode => {
|
|
|
const paths = Object.keys(ancestorsChildren);
|
|
|
|
|
|
let currentNode = rootNode;
|
|
|
@@ -56,7 +53,6 @@ ItemNode => {
|
|
|
};
|
|
|
|
|
|
type ItemsTreeProps = {
|
|
|
- appContainer: AppContainer
|
|
|
isEnableActions: boolean
|
|
|
targetPath: string
|
|
|
targetPathOrId?: string
|
|
|
@@ -64,7 +60,6 @@ type ItemsTreeProps = {
|
|
|
}
|
|
|
|
|
|
const renderByInitialNode = (
|
|
|
- appContainer: AppContainer,
|
|
|
initialNode: ItemNode,
|
|
|
isEnableActions: boolean,
|
|
|
targetPathOrId?: string,
|
|
|
@@ -76,7 +71,6 @@ const renderByInitialNode = (
|
|
|
return (
|
|
|
<ul className="grw-pagetree list-group p-3">
|
|
|
<Item
|
|
|
- appContainer={appContainer}
|
|
|
key={initialNode.page.path}
|
|
|
targetPathOrId={targetPathOrId}
|
|
|
itemNode={initialNode}
|
|
|
@@ -165,9 +159,7 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
*/
|
|
|
if (ancestorsChildrenData != null && rootPageData != null) {
|
|
|
const initialNode = generateInitialNodeAfterResponse(ancestorsChildrenData.ancestorsChildren, new ItemNode(rootPageData.rootPage));
|
|
|
- return renderByInitialNode(
|
|
|
- props.appContainer, initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
|
|
|
- );
|
|
|
+ return renderByInitialNode(initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -175,9 +167,7 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
*/
|
|
|
if (targetAndAncestorsData != null) {
|
|
|
const initialNode = generateInitialNodeBeforeResponse(targetAndAncestorsData.targetAndAncestors);
|
|
|
- return renderByInitialNode(
|
|
|
- props.appContainer, initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
|
|
|
- );
|
|
|
+ return renderByInitialNode(initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem);
|
|
|
}
|
|
|
|
|
|
return null;
|