-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a86046
commit 11ad395
Showing
40 changed files
with
338 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
import { WorkspaceResource } from '@notespace/shared/src/workspace/types/resource'; | ||
import { Resource } from '@notespace/shared/src/workspace/types/resource'; | ||
|
||
export type TreeNode = { | ||
node: WorkspaceTreeNode; | ||
node: Resource; | ||
children: TreeNode[]; | ||
}; | ||
|
||
export type WorkspaceTreeNode = WorkspaceResource; | ||
|
||
export type WorkspaceTreeNodes = Record<string, WorkspaceTreeNode>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
import { ResourceType } from '@notespace/shared/src/workspace/types/resource'; | ||
import { TreeNode, WorkspaceTreeNode, WorkspaceTreeNodes } from '@domain/workspaces/tree/types'; | ||
import { TreeNode } from '@domain/workspaces/tree/types'; | ||
import { Resources } from '@ui/contexts/workspace/WorkspaceContext'; | ||
|
||
export function getTree(nodes: WorkspaceTreeNodes, id: string): TreeNode { | ||
const root = nodes[id]; | ||
export function getTree(id: string, nodes: Resources): TreeNode { | ||
const node = nodes[id]; | ||
return { | ||
node: root, | ||
children: root.children.map(id => getTree(nodes, id)), | ||
}; | ||
} | ||
|
||
export function rootNode(wid: string, children?: string[]): WorkspaceTreeNode { | ||
return { | ||
id: wid, | ||
workspace: wid, | ||
name: 'root', | ||
parent: '', | ||
children: children || [], | ||
type: ResourceType.FOLDER, | ||
node, | ||
children: node.children.map(id => getTree(id, nodes)), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
code/client/src/ui/components/sidebar/components/ResourceView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.