diff --git a/src/components/Navigations/PathNode.js b/src/components/Navigations/PathNode.js index 7b06993..6586020 100644 --- a/src/components/Navigations/PathNode.js +++ b/src/components/Navigations/PathNode.js @@ -2,7 +2,7 @@ import React, {useState} from "react"; import { Link } from "react-router-dom"; import PermissionGuard from "../PermissionGuard"; import "./PathNode.css"; -import {useDeletePath, useMovePath, usePaths, useUpdatePath} from "../../utils/path-queries"; +import {useDeletePath, useMovePath, usePath, usePaths, useUpdatePath} from "../../utils/path-queries"; import {useIndexMarkdown, useMarkdownsByPath, useMoveMarkdown} from "../../utils/markdown-queries"; import MarkdownNode from "./MarkdownNode"; @@ -11,8 +11,8 @@ const PathNode = ({ path, isRoot = false }) => { const [isEditing, setIsEditing] = useState(false); const [newName, setNewName] = useState(path.name); - const { data: childPaths, isLoading: isChildLoading, error: childError } = usePaths(path.id); - const { data: markdowns, isLoading: isMarkdownLoading, error: markdownError } = useMarkdownsByPath(path.id); +// const { data: childPaths, isLoading: isChildLoading, error: childError } = usePaths(path.id); +// const { data: markdowns, isLoading: isMarkdownLoading, error: markdownError } = useMarkdownsByPath(path.id); const deletePath = useDeletePath(); const updatePath = useUpdatePath(); @@ -60,18 +60,40 @@ const PathNode = ({ path, isRoot = false }) => { }) }; + const childPaths = path.children.filter(x => x.type==="path"); const sortedPaths = childPaths ? childPaths.slice().sort((a, b) => a.order.localeCompare(b.order)) : []; + const markdowns = path.children.filter(x => x.type==="markdown"); const sortedMarkdowns = markdowns ? markdowns.filter(md => md.title !== "index").sort((a, b) => a.order.localeCompare(b.order)) : []; - if(childError || markdownError){ +/* if(childError || markdownError){ return
  • Error...
  • ; - } + }*/ + if(isRoot) + return ( + + ); return (
  • @@ -167,7 +189,6 @@ const PathNode = ({ path, isRoot = false }) => { {isExpanded && (