Skip to content

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

chore: adding help links to perspectives, cleaning up

Ilian Sapundshievc789c2ce4794
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index 10853d3d4..26df040f4 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -21,10 +21,10 @@ import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
+import Tooltip from '@material-ui/core/Tooltip';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import Divider from '@material-ui/core/Divider';
-// import ContentExtractionIcon from '@material-ui/icons/TrackChanges';
import OpenFolderIcon from '@material-ui/icons/SubdirectoryArrowLeft';
import AddExistingFileIcon from '@material-ui/icons/ExitToApp';
import ImportTagsIcon from '@material-ui/icons/FindInPage';
@@ -33,7 +33,6 @@ import AutoRenew from '@material-ui/icons/Autorenew';
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 KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';
import NewFileIcon from '@material-ui/icons/InsertDriveFile';
import NewFolderIcon from '@material-ui/icons/CreateNewFolder';
@@ -44,7 +43,6 @@ import { Progress } from 'aws-sdk/clients/s3';
import ImageIcon from '@material-ui/icons/Image';
import { Pro } from '../../pro';
import CreateDirectoryDialog from '../dialogs/CreateDirectoryDialog';
-// import RenameDirectoryDialog from '../dialogs/RenameDirectoryDialog';
import AppConfig from '-/config';
import i18n from '-/services/i18n';
import {
@@ -80,7 +78,6 @@ interface Props {
openFsEntry: (fsEntry: TS.FileSystemEntry) => void;
reflectCreateEntry?: (path: string, isFile: boolean) => void;
toggleCreateFileDialog?: () => void;
- // extractContent: (config: Object) => void,
uploadFilesAPI: (
files: Array<File>,
destination: string,
@@ -111,20 +108,16 @@ interface Props {
setSelectedEntries: (selectedEntries: Array<Object>) => void;
mouseX?: number;
mouseY?: number;
+ openURLExternally?: (url: string, skipConfirmation: boolean) => void;
}
const DirectoryMenu = (props: Props) => {
- // let fileInput; // Object | null;
const fileUploadContainerRef = useRef<FileUploadContainerRef>(null);
const [
isCreateDirectoryDialogOpened,
setIsCreateDirectoryDialogOpened
] = useState(false);
- /* const [
- isRenameDirectoryDialogOpened,
- setIsRenameDirectoryDialogOpened
- ] = useState(false); */
function reloadDirectory() {
props.onClose();
@@ -153,11 +146,6 @@ const DirectoryMenu = (props: Props) => {
);
}
- // function initContentExtraction() {
- // props.onClose();
- // props.extractContent({ EXIFGeo: true });
- // }
-
function switchPerspective(perspectiveId) {
props.onClose();
if (Pro) {
@@ -166,12 +154,36 @@ const DirectoryMenu = (props: Props) => {
} else {
props.setCurrentDirectoryPerspective(perspectiveId);
}
- } else {
- props.showNotification(
- 'Perspectives are part of TagSpaces PRO',
- 'default',
- true
+ } else if (perspectiveId === perspectives.GALLERY) {
+ const openPersDocs = window.confirm(
+ 'Gallery is part of the PRO version. Do you want to learn more about this perspective?'
+ );
+ if (openPersDocs) {
+ props.openURLExternally(
+ AppConfig.documentationLinks.galleryPerspective,
+ true
+ );
+ }
+ } else if (perspectiveId === perspectives.MAPIQUE) {
+ const openPersDocs = window.confirm(
+ 'Mapique is part of the PRO version. Do you want to learn more about this perspective?'
+ );
+ if (openPersDocs) {
+ props.openURLExternally(
+ AppConfig.documentationLinks.mapiquePerspective,
+ true
+ );
+ }
+ } else if (perspectiveId === perspectives.KANBAN) {
+ const openPersDocs = window.confirm(
+ 'Kanban is part of the PRO version. Do you want to learn more about this perspective?'
);
+ if (openPersDocs) {
+ props.openURLExternally(
+ AppConfig.documentationLinks.kanbanPerspective,
+ true
+ );
+ }
}
}
@@ -186,7 +198,6 @@ const DirectoryMenu = (props: Props) => {
function showRenameDirectoryDialog() {
props.onClose();
props.openRenameDirectoryDialog();
- // setIsRenameDirectoryDialogOpened(true);
}
function showCreateDirectoryDialog() {
@@ -330,13 +341,6 @@ Do you want to continue?`)
});
}
- /* function getDirPath(dirPath: string) {
- const fileName = extractFileName(dirPath, PlatformIO.getDirSeparator());
- return props.directoryPath && fileName
- ? fileName
- : cleanTrailingDirSeparator(props.directoryPath);
- } */
-
function setFolderThumbnail() {
props.onClose();
const parentDirectoryPath = extractContainingDirectoryPath(
@@ -564,55 +568,70 @@ Do you want to continue?`)
</MenuItem>
);
menuItems.push(
- <MenuItem
- key="openGalleryPerspective"
- data-tid="openGalleryPerspective"
- onClick={() => switchPerspective(perspectives.GALLERY)}
- title="Switch to gallery perspective"
- >
- <ListItemIcon>
- <GalleryPerspectiveIcon />
- </ListItemIcon>
- <ListItemText primary="Gallery Perspective" />
- </MenuItem>
+ <Tooltip title="Switch to Gallery perspective">
+ <MenuItem
+ key="openGalleryPerspective"
+ data-tid="openGalleryPerspective"
+ onClick={() => switchPerspective(perspectives.GALLERY)}
+ >
+ <ListItemIcon>
+ <GalleryPerspectiveIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={
+ <>
+ Gallery Perspective
+ <ProLabel />
+ </>
+ }
+ />
+ </MenuItem>
+ </Tooltip>
);
menuItems.push(
- <MenuItem
- key="openMapiquePerspective"
- data-tid="openMapiquePerspective"
- onClick={() => switchPerspective(perspectives.MAPIQUE)}
- title="Switch to mapique perspective"
- >
- <ListItemIcon>
- <MapiquePerspectiveIcon />
- </ListItemIcon>
- <ListItemText primary="Mapique Perspective" />
- </MenuItem>
+ <Tooltip title="Switch to Mapique perspective">
+ <MenuItem
+ key="openMapiquePerspective"
+ data-tid="openMapiquePerspective"
+ onClick={() => switchPerspective(perspectives.MAPIQUE)}
+ >
+ <ListItemIcon>
+ <MapiquePerspectiveIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={
+ <>
+ Mapique Perspective
+ <ProLabel />
+ </>
+ }
+ />
+ </MenuItem>
+ </Tooltip>
);
menuItems.push(
- <MenuItem
- key="openKanBanPerspective"
- data-tid="openKanBanPerspectiveTID"
- onClick={() => switchPerspective(perspectives.KANBAN)}
- title="Switch to kanban perspective"
- >
- <ListItemIcon>
- <KanBanPerspectiveIcon />
- </ListItemIcon>
- <ListItemText primary="KanBan Perspective" />
- </MenuItem>
+ <Tooltip title="Switch to Kanban perspective">
+ <MenuItem
+ key="openKanBanPerspective"
+ data-tid="openKanBanPerspectiveTID"
+ onClick={() => switchPerspective(perspectives.KANBAN)}
+ >
+ <ListItemIcon>
+ <KanBanPerspectiveIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={
+ <>
+ Kanban Perspective
+ {Pro ? <BetaLabel /> : <ProLabel />}
+ </>
+ }
+ />
+ </MenuItem>
+ </Tooltip>
);
}
- /* if (!props.isReadOnlyMode) {
- menuItems.push(
- <MenuItem data-tid="extractContent" onClick={initContentExtraction}>
- <ListItemIcon>
- <ContentExtractionIcon />
- </ListItemIcon>
- <ListItemText primary={i18n.t('core:startContentExtraction')} />
- </MenuItem>
- );
- } */
+
if (props.selectedEntries.length < 2) {
menuItems.push(<Divider key="divider3" />);
menuItems.push(
@@ -631,14 +650,6 @@ Do you want to continue?`)
return (
<div style={{ overflowY: 'hidden' }}>
- {/* {isRenameDirectoryDialogOpened && (
- <RenameDirectoryDialog
- key={'renameDir' + props.directoryPath}
- open={isRenameDirectoryDialogOpened}
- onClose={() => setIsRenameDirectoryDialogOpened(false)}
- selectedDirectoryPath={props.directoryPath}
- />
- )} */}
{isCreateDirectoryDialogOpened && ( // TODO move dialogs in MainContainer and don't include the Menu HTML always
<CreateDirectoryDialog
key={'createDir' + props.directoryPath}
@@ -698,7 +709,8 @@ function mapDispatchToProps(dispatch) {
addTags: TaggingActions.addTags,
toggleDeleteMultipleEntriesDialog:
AppActions.toggleDeleteMultipleEntriesDialog,
- setSelectedEntries: AppActions.setSelectedEntries
+ setSelectedEntries: AppActions.setSelectedEntries,
+ openURLExternally: AppActions.openURLExternally
},
dispatch
);
diff --git a/app/config.ts b/app/config.ts
index 63fb0efcc..5e462683c 100644
--- a/app/config.ts
+++ b/app/config.ts
@@ -79,10 +79,11 @@ export const AppConfig = {
},
documentationLinks: {
general: 'https://docs.tagspaces.org/',
- defaultPerspective: 'https://docs.tagspaces.org/perspectives/grid',
- mapiquePerspective: 'https://docs.tagspaces.org/perspectives/mapique',
- treevizPerspective: 'https://docs.tagspaces.org/perspectives/treeviz',
- galleryPerspective: 'https://docs.tagspaces.org/perspectives/gallery',
+ defaultPerspective: 'https://docs.tagspaces.org/perspectives/grid/',
+ mapiquePerspective: 'https://docs.tagspaces.org/perspectives/mapique/',
+ treevizPerspective: 'https://docs.tagspaces.org/perspectives/treeviz/',
+ galleryPerspective: 'https://docs.tagspaces.org/perspectives/gallery/',
+ kanbanPerspective: 'https://docs.tagspaces.org/perspectives/kanban/',
locations: 'https://docs.tagspaces.org/ui/locations',
taglibrary: 'https://docs.tagspaces.org/ui/taglibrary',
search: 'https://docs.tagspaces.org/search',