Move tree implementation out of collections store (#4763)

* refactor: attaching emoji in tree node is unnecessary

* refactor: pass depth and hasChildren as separate props

* refactor: move tree impl into a separate hook

* refactor: separate out as DocumentExplorer for reuse

* fix: separate search and node

* fix: review comments

* fix: tsc
This commit is contained in:
Apoorv Mishra
2023-01-27 11:33:51 +05:30
committed by GitHub
parent cc14c212b6
commit ad902af52c
31 changed files with 656 additions and 517 deletions

View File

@@ -113,6 +113,9 @@
"Default collection": "Default collection",
"Deleted Collection": "Deleted Collection",
"Unpin": "Unpin",
"Search collections & documents": "Search collections & documents",
"No results found": "No results found",
"Untitled": "Untitled",
"New": "New",
"Only visible to you": "Only visible to you",
"Draft": "Draft",
@@ -199,7 +202,6 @@
"Click to retry": "Click to retry",
"Back": "Back",
"Documents": "Documents",
"Untitled": "Untitled",
"Results": "Results",
"No results for {{query}}": "No results for {{query}}",
"Logo": "Logo",
@@ -508,13 +510,11 @@
"Document moved": "Document moved",
"Current location": "Current location",
"Choose a new location": "Choose a new location",
"Search collections & documents": "Search collections & documents",
"Couldnt create the document, try again?": "Couldnt create the document, try again?",
"Document permanently deleted": "Document permanently deleted",
"Are you sure you want to permanently delete the <em>{{ documentTitle }}</em> document? This action is immediate and cannot be undone.": "Are you sure you want to permanently delete the <em>{{ documentTitle }}</em> document? This action is immediate and cannot be undone.",
"Select a location to publish": "Select a location to publish",
"Couldnt publish the document, try again?": "Couldnt publish the document, try again?",
"No results found": "No results found",
"Publish in <em>{{ location }}</em>": "Publish in <em>{{ location }}</em>",
"view and edit access": "view and edit access",
"view only access": "view only access",

View File

@@ -117,3 +117,20 @@ export enum TeamPreference {
}
export type TeamPreferences = { [key in TeamPreference]?: boolean };
export enum NavigationNodeType {
Collection = "collection",
Document = "document",
}
export type NavigationNode = {
id: string;
title: string;
url: string;
children: NavigationNode[];
isDraft?: boolean;
collectionId?: string;
type?: NavigationNodeType;
parent?: NavigationNode | null;
depth?: number;
};

View File

@@ -1,4 +1,4 @@
import { NavigationNode } from "~/types";
import { NavigationNode } from "@shared/types";
import naturalSort from "./naturalSort";
type Sort = {