Skip to content

TagSpaces is an offline, open source, document manager with tagging support

added support for mapique perspective

Ilian Sapundshiev946ca197b8f5
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.js
index 37c269f23..170efdd0a 100644
--- a/app/components/FolderContainer.js
+++ b/app/components/FolderContainer.js
@@ -59,7 +59,7 @@ const GridPerspectiveAsync = props => (
);
let GalleryPerspective = React.Fragment;
-if (Pro && Pro.Perspectives) {
+if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {
// GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));
GalleryPerspective = Pro.Perspectives.GalleryPerspective;
}
@@ -69,6 +69,17 @@ const GalleryPerspectiveAsync = props => (
</React.Suspense>
);
+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 = Pro.Perspectives.MapiquePerspective;
+}
+const MapiquePerspectiveAsync = props => (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <MapiquePerspective {...props} />
+ </React.Suspense>
+);
+
const WelcomePanel = React.lazy(() => import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel'));
const WelcomePanelAsync = props => (
<React.Suspense fallback={<LoadingLazy />}>
@@ -167,7 +178,7 @@ type Props = {
};
type State = {
- currentPerspective?: string,
+ currentPerspective: string,
currentPath?: string,
pathParts?: Array<string>,
isPropertiesPanelVisible?: boolean,
@@ -322,17 +333,8 @@ class FolderContainer extends React.Component<Props, State> {
return;
}
this.setState({
- currentPerspective: this.state.currentPerspective === 'default' ? 'gallery' : 'default'
+ currentPerspective: perspectiveId ? perspectiveId : 'default'
});
- /* if (perspectiveId) {
- this.setState({
- currentPerspective: perspectiveId
- });
- } else {
- this.setState({
- currentPerspective: 'default'
- });
- } */
}
togglePerspectiveChooserClose = (event?: Object) => {
@@ -373,22 +375,17 @@ class FolderContainer extends React.Component<Props, State> {
return (
<GalleryPerspectiveAsync
directoryContent={this.props.directoryContent}
- // loadDirectoryContent={this.props.loadDirectoryContent}
- // openFile={this.props.openFile}
- // openFileNatively={this.props.openFileNatively}
- // loadParentDirectoryContent={this.props.loadParentDirectoryContent}
- // deleteFile={this.props.deleteFile}
- // renameFile={this.props.renameFile}
- // openDirectory={this.props.openDirectory}
- // showInFileManager={this.props.showInFileManager}
currentDirectoryPath={this.props.currentDirectoryPath}
setLastSelectedEntry={this.props.setLastSelectedEntry}
- // perspectiveCommand={this.state.perspectiveCommand}
- // addTags={this.props.addTags}
- // editTagForEntry={this.props.editTagForEntry}
- // deleteDirectory={this.props.deleteDirectory}
- // removeTags={this.props.removeTags}
- // removeAllTags={this.props.removeAllTags}
+ windowWidth={this.props.windowWidth}
+ />
+ );
+ } else if (this.state.currentPerspective === 'mapique') {
+ return (
+ <MapiquePerspectiveAsync
+ directoryContent={this.props.directoryContent}
+ currentDirectoryPath={this.props.currentDirectoryPath}
+ setLastSelectedEntry={this.props.setLastSelectedEntry}
windowWidth={this.props.windowWidth}
/>
);
diff --git a/app/components/menus/DirectoryMenu.js b/app/components/menus/DirectoryMenu.js
index 477d79d39..35bd49fcc 100644
--- a/app/components/menus/DirectoryMenu.js
+++ b/app/components/menus/DirectoryMenu.js
@@ -64,7 +64,7 @@ type Props = {
loadParentDirectoryContent?: () => void,
openFileNatively?: (path: string) => void,
extractContent?: () => void,
- switchPerspective?: () => void,
+ switchPerspective?: (perspectiveId: string) => void,
perspectiveMode: boolean,
showNotification?: (
text: string,
@@ -106,9 +106,9 @@ const DirectoryMenu = (props: Props) => {
props.extractContent();
}
- function switchPerspective() {
+ function switchPerspective(perspectiveId) {
props.onClose();
- props.switchPerspective();
+ props.switchPerspective(perspectiveId);
}
function showDeleteDirectoryDialog() {
@@ -407,14 +407,27 @@ const DirectoryMenu = (props: Props) => {
</MenuItem>
)}
<Divider />
- <MenuItem data-tid="extractContent" onClick={switchPerspective} title="Start experimental presentation mode">
+ <MenuItem data-tid="openDefaultPerspecitve" onClick={() => switchPerspective('default')} title="Switch to default perspective">
<ListItemIcon>
<GalleryPerspectiveIcon />
</ListItemIcon>
- <ListItemText primary="Toggle Gallery Perspective" />
+ <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 />
{!props.isReadOnlyMode && (
- <React.Fragment>
+ <React.Fragment>
<MenuItem data-tid="extractContent" onClick={initContentExtraction}>
<ListItemIcon>
<ContentExtractionIcon />