TagSpaces is an offline, open source, document manager with tagging support
adding support for treeviz perspective
Ilian Sapundshiev1948531200ba
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.jsindex 641c40c92..c22e1f3b4 100644--- a/app/components/FolderContainer.js+++ b/app/components/FolderContainer.js@@ -60,7 +60,7 @@ const GridPerspectiveAsync = props => (let GalleryPerspective = React.Fragment;if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {-// GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));+// GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));GalleryPerspective = Pro.Perspectives.GalleryPerspective;}const GalleryPerspectiveAsync = props => (@@ -71,7 +71,7 @@ const GalleryPerspectiveAsync = props => (let MapiquePerspective = React.Fragment;if (Pro && Pro.Perspectives && Pro.Perspectives.MapiquePerspective) {-// MapiquePerspective = React.lazy(() => import(/* webpackChunkName: "MapiquePerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/mapique'));+// MapiquePerspective = React.lazy(() => import(/* webpackChunkName: "MapiquePerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/mapique'));MapiquePerspective = Pro.Perspectives.MapiquePerspective;}const MapiquePerspectiveAsync = props => (@@ -80,6 +80,17 @@ const MapiquePerspectiveAsync = props => (</React.Suspense>);+let TreeVizPerspective = React.Fragment;+if (Pro && Pro.Perspectives && Pro.Perspectives.TreeVizPerspective) {+// TreeVizPerspective = React.lazy(() => import(/* webpackChunkName: "TreeVizPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/treeviz'));+ TreeVizPerspective = Pro.Perspectives.TreeVizPerspective;+}+const TreeVizPerspectiveAsync = props => (+ <React.Suspense fallback={<LoadingLazy />}>+ <TreeVizPerspective {...props} />+ </React.Suspense>+);+const WelcomePanel = React.lazy(() => import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel'));const WelcomePanelAsync = props => (<React.Suspense fallback={<LoadingLazy />}>@@ -355,6 +366,16 @@ class FolderContainer extends React.Component<Props, State> {directoryContent={this.props.directoryContent}currentDirectoryPath={this.props.currentDirectoryPath}windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}+ />+ );+ } else if (this.state.currentPerspective === 'treeviz') {+ return (+ <TreeVizPerspectiveAsync+ directoryContent={this.props.directoryContent}+ currentDirectoryPath={this.props.currentDirectoryPath}+ windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}/>);} else if (this.state.currentPerspective === 'mapique') {@@ -363,6 +384,7 @@ class FolderContainer extends React.Component<Props, State> {directoryContent={this.props.directoryContent}currentDirectoryPath={this.props.currentDirectoryPath}windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}/>);}diff --git a/app/components/menus/DirectoryMenu.js b/app/components/menus/DirectoryMenu.jsindex e8a8259f6..91f783750 100644--- a/app/components/menus/DirectoryMenu.js+++ b/app/components/menus/DirectoryMenu.js@@ -31,7 +31,10 @@ import OpenFolderIcon from '@material-ui/icons/SubdirectoryArrowLeft';import AddExistingFileIcon from '@material-ui/icons/ExitToApp';import OpenFolderNativelyIcon from '@material-ui/icons/Launch';import AutoRenew from '@material-ui/icons/Autorenew';-import GalleryPerspectiveIcon from '@material-ui/icons/Slideshow';+import DefaultPerspectiveIcon from '@material-ui/icons/GridOn';+import GalleryPerspectiveIcon from '@material-ui/icons/Camera';+import MapiquePerspectiveIcon from '@material-ui/icons/Map';+import TreeVizPerspectiveIcon from '@material-ui/icons/AccountTree';import NewFileIcon from '@material-ui/icons/InsertDriveFile';import NewFolderIcon from '@material-ui/icons/CreateNewFolder';import RenameFolderIcon from '@material-ui/icons/FormatTextdirectionLToR';@@ -408,27 +411,33 @@ const DirectoryMenu = (props: Props) => {)}<Divider />{ !props.perspectiveMode && (- <div>- <MenuItem data-tid="openDefaultPerspecitve" onClick={() => switchPerspective('default')} title="Switch to default perspective">- <ListItemIcon>- <GalleryPerspectiveIcon />- </ListItemIcon>- <ListItemText primary="Default perspective" />- </MenuItem>- <MenuItem data-tid="openGalleryPerspecitve" onClick={() => switchPerspective('gallery')} title="Switch to gallery perspective">- <ListItemIcon>- <GalleryPerspectiveIcon />- </ListItemIcon>- <ListItemText primary="Gallery Perspective" />- </MenuItem>- <MenuItem data-tid="openMapiquePerspecitve" onClick={() => switchPerspective('mapique')} title="Switch to mapique perspective">- <ListItemIcon>- <GalleryPerspectiveIcon />- </ListItemIcon>- <ListItemText primary="Mapique Perspective" />- </MenuItem>- <Divider />- </div>+ <div>+ <MenuItem data-tid="openDefaultPerspective" onClick={() => switchPerspective('default')} title="Switch to default perspective">+ <ListItemIcon>+ <DefaultPerspectiveIcon />+ </ListItemIcon>+ <ListItemText primary="Default perspective" />+ </MenuItem>+ <MenuItem data-tid="openGalleryPerspective" onClick={() => switchPerspective('gallery')} title="Switch to gallery perspective">+ <ListItemIcon>+ <GalleryPerspectiveIcon />+ </ListItemIcon>+ <ListItemText primary="Gallery Perspective" />+ </MenuItem>+ <MenuItem data-tid="openMapiquePerspective" onClick={() => switchPerspective('mapique')} title="Switch to mapique perspective">+ <ListItemIcon>+ <MapiquePerspectiveIcon />+ </ListItemIcon>+ <ListItemText primary="Mapique Perspective" />+ </MenuItem>+ <MenuItem data-tid="openTreeVizPerspective" onClick={() => switchPerspective('treeviz')} title="Switch to tree visualization perspective">+ <ListItemIcon>+ <TreeVizPerspectiveIcon />+ </ListItemIcon>+ <ListItemText primary="TreeViz Perspective" />+ </MenuItem>+ <Divider />+ </div>)}{/* {!props.isReadOnlyMode && (<React.Fragment>diff --git a/package.json b/package.jsonindex a3265293b..3d3855db5 100644--- a/package.json+++ b/package.json@@ -238,6 +238,7 @@"react": "^16.8.6","react-autosuggest": "^9.3.2","react-color": "^2.17.0",+ "react-d3-tree": "^1.15.3","react-dnd": "^7.0.2","react-dnd-html5-backend": "^7.0.2","react-dom": "^16.8.2",diff --git a/yarn.lock b/yarn.lockindex 9855c2365..eff735b5b 100644--- a/yarn.lock+++ b/yarn.lock@@ -4703,6 +4703,11 @@ caseless@~0.12.0:resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=+chain-function@^1.0.0:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.1.tgz#c63045e5b4b663fb86f1c6e186adaf1de402a1cc"+ integrity sha512-SxltgMwL9uCko5/ZCLiyG2B7R9fY4pDZUw7hJ4MhirdjBLosoDqkWABi3XMucddHdLiFJMb7PD2MZifZriuMTg==+chainsaw@~0.1.0:version "0.1.0"resolved "https://registry.yarnpkg.com/chainsaw/-/chainsaw-0.1.0.tgz#5eab50b28afe58074d0d58291388828b5e5fbc98"@@ -5832,6 +5837,11 @@ cyclist@~0.2.2:resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=+ version "3.5.17"+ resolved "https://registry.yarnpkg.com/d3/-/d3-3.5.17.tgz#bc46748004378b21a360c9fc7cf5231790762fb8"+ integrity sha1-vEZ0gAQ3iyGjYMn8fPUjF5B2L7g=+damerau-levenshtein@^1.0.0:version "1.0.5"resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414"@@ -6240,7 +6250,7 @@ doiuse@^2.4.1:through2 "^0.6.3"yargs "^3.5.4"-"dom-helpers@^2.4.0 || ^3.0.0", dom-helpers@^3.2.1, dom-helpers@^3.4.0:+"dom-helpers@^2.4.0 || ^3.0.0", dom-helpers@^3.2.0, dom-helpers@^3.2.1, dom-helpers@^3.4.0:version "3.4.0"resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8"integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==@@ -13410,7 +13420,7 @@ promzard@^0.3.0:dependencies:read "1"[email protected], prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:[email protected], prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:version "15.7.2"resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==@@ -13729,6 +13739,19 @@ react-color@^2.17.0:reactcss "^1.2.0"tinycolor2 "^1.4.1"+react-d3-tree@^1.15.3:+ version "1.15.3"+ resolved "https://registry.yarnpkg.com/react-d3-tree/-/react-d3-tree-1.15.3.tgz#812ece841d46d8232c4fac61111245572214c8d7"+ integrity sha512-4+svDlOpMZ0U++REJX9R98piZOT6VAWZarjuZiYHibX8nE9mL10wtTqKi8xUcRSDaW78WfITDe6LUcOnZt4rBg==+ dependencies:+ clone "^2.1.1"+ d3 "3.5.17"+ deep-equal "^1.0.1"+ prop-types "^15.5.10"+ react-lifecycles-compat "^3.0.4"+ react-transition-group "^1.1.3"+ uuid "^3.0.1"+react-dnd-html5-backend@^7.0.2:version "7.7.0"resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-7.7.0.tgz#e2b8ea61a1bc34ba743b89cafcda6213b006c06a"@@ -14005,6 +14028,17 @@ react-themeable@^1.1.0:dependencies:object-assign "^3.0.0"+react-transition-group@^1.1.3:+ version "1.2.1"+ resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.1.tgz#e11f72b257f921b213229a774df46612346c7ca6"+ integrity sha512-CWaL3laCmgAFdxdKbhhps+c0HRGF4c+hdM4H23+FI1QBNUyx/AMeIJGWorehPNSaKnQNOAxL7PQmqMu78CDj3Q==+ dependencies:+ chain-function "^1.0.0"+ dom-helpers "^3.2.0"+ loose-envify "^1.3.1"+ prop-types "^15.5.6"+ warning "^3.0.0"+react-transition-group@^2.2.1:version "2.9.0"resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d"