Skip to content

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

feature: refactoring perspectives, adding list and wiki perspective

Ilian Sapundshiev9124516abe59
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 3487e55d7..73824da9c 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -37,12 +37,8 @@ import Input from '@material-ui/core/Input';
import MenuItem from '@material-ui/core/MenuItem';
import ClearColorIcon from '@material-ui/icons/Backspace';
import ListItemIcon from '@material-ui/core/ListItemIcon';
-import DefaultPerspectiveIcon from '@material-ui/icons/GridOn';
import LayersClearIcon from '@material-ui/icons/LayersClear';
import ListItemText from '@material-ui/core/ListItemText';
-import GalleryPerspectiveIcon from '@material-ui/icons/Camera';
-import MapiquePerspectiveIcon from '@material-ui/icons/Map';
-import KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';
import {
AttributionControl,
Map,
@@ -76,7 +72,7 @@ import {
replaceThumbnailURLPromise,
getThumbnailURLPromise
} from '-/services/thumbsgenerator';
-import { OpenedEntry, perspectives } from '-/reducers/app';
+import { OpenedEntry } from '-/reducers/app';
import { savePerspective } from '-/utils/metaoperations';
import MarkerIcon from '-/assets/icons/marker-icon.png';
import Marker2xIcon from '-/assets/icons/marker-icon-2x.png';
@@ -86,6 +82,7 @@ import { TS } from '-/tagspaces.namespace';
import NoTileServer from '-/components/NoTileServer';
import InfoIcon from '-/components/InfoIcon';
import { ProTooltip } from '-/components/HelperComponents';
+import { AvailablePerspectives } from '-/perspectives';
const ThumbnailChooserDialog =
Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;
@@ -522,31 +519,6 @@ const EntryProperties = (props: Props) => {
perspectiveDefault = 'unspecified'; // perspectives.DEFAULT;
}
- function getMenuItem(perspective) {
- let icon;
- if (perspective === perspectives.DEFAULT) {
- icon = <DefaultPerspectiveIcon />;
- } else if (perspective === perspectives.GALLERY) {
- icon = <GalleryPerspectiveIcon />;
- } else if (perspective === perspectives.MAPIQUE) {
- icon = <MapiquePerspectiveIcon />;
- } else if (perspective === perspectives.KANBAN) {
- icon = <KanBanPerspectiveIcon />;
- }
- return (
- <MenuItem key={perspective} value={perspective}>
- <div style={{ display: 'flex' }}>
- <ListItemIcon style={{ paddingLeft: 3, paddingTop: 3 }}>
- {icon}
- </ListItemIcon>
- <ListItemText>
- {perspective.charAt(0).toUpperCase() + perspective.slice(1)}
- </ListItemText>
- </div>
- </MenuItem>
- );
- }
-
const iconFileMarker = new L.Icon({
iconUrl: MarkerIcon,
iconRetinaUrl: Marker2xIcon,
@@ -612,6 +584,40 @@ const EntryProperties = (props: Props) => {
const showLinkForDownloading = isCloudLocation && currentEntry.isFile;
+ const perspectiveSelectorMenuItems = [];
+ perspectiveSelectorMenuItems.push(
+ <MenuItem style={{ display: 'flex' }} key="unspecified" value="unspecified">
+ <div style={{ display: 'flex' }}>
+ <ListItemIcon style={{ paddingLeft: 3, paddingTop: 3 }}>
+ <LayersClearIcon />
+ </ListItemIcon>
+ <ListItemText>{i18n.t('core:unspecified')}</ListItemText>
+ </div>
+ </MenuItem>
+ );
+
+ AvailablePerspectives.forEach(perspective => {
+ let includePerspective = perspective.beta === false;
+ if (!Pro && perspective.pro === true) {
+ includePerspective = false;
+ }
+ if (Pro && perspective.beta === false) {
+ includePerspective = true;
+ }
+ if (includePerspective) {
+ perspectiveSelectorMenuItems.push(
+ <MenuItem key={perspective.key} value={perspective.id}>
+ <div style={{ display: 'flex' }}>
+ <ListItemIcon style={{ paddingLeft: 3, paddingTop: 3 }}>
+ {perspective.icon}
+ </ListItemIcon>
+ <ListItemText>{perspective.title}</ListItemText>
+ </div>
+ </MenuItem>
+ );
+ }
+ });
+
// @ts-ignore
return (
<div className={classes.entryProperties}>
@@ -1216,25 +1222,7 @@ const EntryProperties = (props: Props) => {
onChange={changePerspective}
input={<Input id="changePerspectiveId" />}
>
- <MenuItem
- style={{ display: 'flex' }}
- key="unspecified"
- value="unspecified"
- >
- <div style={{ display: 'flex' }}>
- <ListItemIcon style={{ paddingLeft: 3, paddingTop: 3 }}>
- <LayersClearIcon />
- </ListItemIcon>
- <ListItemText>{i18n.t('core:unspecified')}</ListItemText>
- </div>
- </MenuItem>
- {Object.values(perspectives).map(perspective =>
- getMenuItem(perspective)
- )}
- {/* {Pro &&
- Object.values(
- Pro.Perspectives.AvailablePerspectives
- ).map(perspective => getMenuItem(perspective))} */}
+ {perspectiveSelectorMenuItems}
</Select>
</FormControl>
</Grid>
@@ -1269,7 +1257,10 @@ const EntryProperties = (props: Props) => {
)}
</div>
<div className={classes.fluidGrid}>
- <div className={classes.gridItem}>
+ <div
+ className={classes.gridItem}
+ title={i18n.t('core:changeThumbnail')}
+ >
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
<div
className={classes.header}
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index b78ad22ec..6997d55e0 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -32,9 +32,6 @@ import Badge from '@material-ui/core/Badge';
import { withStyles } from '@material-ui/core/styles';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
-import DefaultPerspectiveIcon from '@material-ui/icons/GridOn';
-import GalleryPerspectiveIcon from '@material-ui/icons/Camera';
-import MapiquePerspectiveIcon from '@material-ui/icons/Map';
import LocationMenu from './menus/LocationMenu';
import i18n from '../services/i18n';
import { getMaxSearchResults, getDesktopMode } from '-/reducers/settings';
@@ -47,7 +44,6 @@ import {
getCurrentLocationPath,
getCurrentDirectoryPerspective,
OpenedEntry,
- perspectives,
getSelectedEntries,
getProgress
} from '../reducers/app';
@@ -67,6 +63,7 @@ import {
} from '-/reducers/location-index';
import Links from '-/links';
import PlatformIO from '-/services/platform-facade';
+import { PerspectiveIDs, AvailablePerspectives } from '-/perspectives';
const GridPerspective = React.lazy(() =>
import(
@@ -79,10 +76,19 @@ const GridPerspectiveAsync = props => (
</React.Suspense>
);
+const ListPerspective = React.lazy(() =>
+ import(/* webpackChunkName: "ListPerspective" */ '../perspectives/list/')
+);
+const ListPerspectiveAsync = props => (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <ListPerspective {...props} />
+ </React.Suspense>
+);
+
let GalleryPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {
// GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));
- // eslint-disable-next-line prefer-destructuring
+
GalleryPerspective = Pro.Perspectives.GalleryPerspective;
}
const GalleryPerspectiveAsync = props => (
@@ -94,7 +100,6 @@ 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'));
- // eslint-disable-next-line prefer-destructuring
MapiquePerspective = Pro.Perspectives.MapiquePerspective;
}
const MapiquePerspectiveAsync = props => (
@@ -117,7 +122,6 @@ const TreeVizPerspectiveAsync = props => (
let KanBanPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.KanBanPerspective) {
- // eslint-disable-next-line prefer-destructuring
KanBanPerspective = Pro.Perspectives.KanBanPerspective;
}
const KanBanPerspectiveAsync = props => (
@@ -126,6 +130,16 @@ const KanBanPerspectiveAsync = props => (
</React.Suspense>
);
+let WikiPerspective = React.Fragment;
+if (Pro && Pro.Perspectives && Pro.Perspectives.WikiPerspective) {
+ WikiPerspective = Pro.Perspectives.WikiPerspective;
+}
+const WikiPerspectiveAsync = props => (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <WikiPerspective {...props} />
+ </React.Suspense>
+);
+
const WelcomePanel = React.lazy(() =>
import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel')
);
@@ -247,44 +261,6 @@ const FolderContainer = (props: Props) => {
null
);
- const switchPerspective = (perspectiveId: string) => {
- if (Pro) {
- props.setCurrentDirectoryPerspective(perspectiveId);
- return;
- }
- if (perspectiveId === perspectives.GALLERY) {
- const openPersDocs = window.confirm(
- 'Gallery is part of TagSpaces Pro. Do you want to learn more about this perspective?'
- );
- if (openPersDocs) {
- props.openURLExternally(
- Links.documentationLinks.galleryPerspective,
- true
- );
- }
- } else if (perspectiveId === perspectives.MAPIQUE) {
- const openPersDocs = window.confirm(
- 'Mapique is part of TagSpaces Pro. Do you want to learn more about this perspective?'
- );
- if (openPersDocs) {
- props.openURLExternally(
- Links.documentationLinks.mapiquePerspective,
- true
- );
- }
- } else if (perspectiveId === perspectives.KANBAN) {
- const openPersDocs = window.confirm(
- 'Kanban is part of TagSpaces Pro. Do you want to learn more about this perspective?'
- );
- if (openPersDocs) {
- props.openURLExternally(
- Links.documentationLinks.kanbanPerspective,
- true
- );
- }
- }
- };
-
const showWelcomePanel =
!props.currentDirectoryPath && props.directoryContent.length < 1;
@@ -296,11 +272,27 @@ const FolderContainer = (props: Props) => {
<React.Fragment />
);
}
- if (
- Pro &&
- props.currentDirectoryPerspective ===
- Pro.Perspectives.AvailablePerspectives.GALLERY
- ) {
+ if (props.currentDirectoryPerspective === PerspectiveIDs.LIST) {
+ return (
+ <ListPerspectiveAsync
+ directoryContent={props.directoryContent}
+ loadDirectoryContent={props.loadDirectoryContent}
+ openFsEntry={props.openFsEntry}
+ openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}
+ loadParentDirectoryContent={props.loadParentDirectoryContent}
+ renameFile={props.renameFile}
+ openDirectory={props.openDirectory}
+ showInFileManager={props.showInFileManager}
+ currentDirectoryPath={props.currentDirectoryPath}
+ addTags={props.addTags}
+ editTagForEntry={props.editTagForEntry}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ windowWidth={props.windowWidth}
+ />
+ );
+ }
+ if (Pro && props.currentDirectoryPerspective === PerspectiveIDs.GALLERY) {
return (
<GalleryPerspectiveAsync
directoryContent={props.directoryContent}
@@ -311,11 +303,7 @@ const FolderContainer = (props: Props) => {
/>
);
}
- if (
- Pro &&
- props.currentDirectoryPerspective ===
- Pro.Perspectives.AvailablePerspectives.MAPIQUE
- ) {
+ if (Pro && props.currentDirectoryPerspective === PerspectiveIDs.MAPIQUE) {
return (
<MapiquePerspectiveAsync
directoryContent={props.directoryContent}
@@ -326,11 +314,7 @@ const FolderContainer = (props: Props) => {
/>
);
}
- if (
- Pro &&
- props.currentDirectoryPerspective ===
- Pro.Perspectives.AvailablePerspectives.KANBAN
- ) {
+ if (Pro && props.currentDirectoryPerspective === PerspectiveIDs.KANBAN) {
return (
<KanBanPerspectiveAsync
directoryContent={props.directoryContent}
@@ -351,6 +335,26 @@ const FolderContainer = (props: Props) => {
/>
);
}
+ if (Pro && props.currentDirectoryPerspective === PerspectiveIDs.WIKI) {
+ return (
+ <WikiPerspectiveAsync
+ directoryContent={props.directoryContent}
+ loadDirectoryContent={props.loadDirectoryContent}
+ openFsEntry={props.openFsEntry}
+ openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}
+ loadParentDirectoryContent={props.loadParentDirectoryContent}
+ renameFile={props.renameFile}
+ openDirectory={props.openDirectory}
+ showInFileManager={props.showInFileManager}
+ currentDirectoryPath={props.currentDirectoryPath}
+ addTags={props.addTags}
+ editTagForEntry={props.editTagForEntry}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ windowWidth={props.windowWidth}
+ />
+ );
+ }
return (
<GridPerspectiveAsync
directoryContent={props.directoryContent}
@@ -399,7 +403,7 @@ const FolderContainer = (props: Props) => {
} */
const currentPerspective =
- currentDirectoryPerspective || perspectives.DEFAULT;
+ currentDirectoryPerspective || PerspectiveIDs.DEFAULT;
function CircularProgressWithLabel(prop) {
return (
@@ -437,6 +441,75 @@ const FolderContainer = (props: Props) => {
return 100;
};
+ const switchPerspective = (perspectiveId: string) => {
+ if (
+ perspectiveId === PerspectiveIDs.DEFAULT ||
+ perspectiveId === PerspectiveIDs.LIST
+ ) {
+ props.setCurrentDirectoryPerspective(perspectiveId);
+ return;
+ } else if (perspectiveId === PerspectiveIDs.GALLERY) {
+ if (Pro) {
+ props.setCurrentDirectoryPerspective(perspectiveId);
+ } else {
+ const openPersDocs = window.confirm(
+ 'Gallery is part of TagSpaces Pro. Do you want to learn more about this perspective?'
+ );
+ if (openPersDocs) {
+ props.openURLExternally(
+ Links.documentationLinks.galleryPerspective,
+ true
+ );
+ }
+ }
+ } else if (perspectiveId === PerspectiveIDs.MAPIQUE) {
+ if (Pro) {
+ props.setCurrentDirectoryPerspective(perspectiveId);
+ } else {
+ const openPersDocs = window.confirm(
+ 'Mapique is part of TagSpaces Pro. Do you want to learn more about this perspective?'
+ );
+ if (openPersDocs) {
+ props.openURLExternally(
+ Links.documentationLinks.mapiquePerspective,
+ true
+ );
+ }
+ }
+ } else if (perspectiveId === PerspectiveIDs.KANBAN) {
+ if (Pro) {
+ props.setCurrentDirectoryPerspective(perspectiveId);
+ } else {
+ const openPersDocs = window.confirm(
+ 'Kanban is part of TagSpaces Pro. Do you want to learn more about this perspective?'
+ );
+ if (openPersDocs) {
+ props.openURLExternally(
+ Links.documentationLinks.kanbanPerspective,
+ true
+ );
+ }
+ }
+ }
+ };
+
+ const perspectiveToggleButtons = [];
+ AvailablePerspectives.forEach(perspective => {
+ if (perspective.beta === false) {
+ perspectiveToggleButtons.push(
+ <ToggleButton
+ value={perspective.id}
+ aria-label={perspective.id}
+ onClick={() => switchPerspective(perspective.id)}
+ >
+ <Tooltip arrow title={perspective.title}>
+ <div style={{ display: 'flex' }}>{perspective.icon}</div>
+ </Tooltip>
+ </ToggleButton>
+ );
+ }
+ });
+
return (
<div data-tid="folderContainerTID" style={{ position: 'relative' }}>
<div
@@ -632,39 +705,7 @@ const FolderContainer = (props: Props) => {
backgroundColor: theme.palette.background.default
}}
>
- <ToggleButton
- value={perspectives.DEFAULT}
- aria-label={perspectives.DEFAULT}
- onClick={() => switchPerspective(perspectives.DEFAULT)}
- >
- <Tooltip arrow title="Switch to default perspective">
- <div style={{ display: 'flex' }}>
- <DefaultPerspectiveIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- <ToggleButton
- value={perspectives.GALLERY}
- aria-label={perspectives.GALLERY}
- onClick={() => switchPerspective(perspectives.GALLERY)}
- >
- <Tooltip arrow title="Switch to Gallery perspective">
- <div style={{ display: 'flex' }}>
- <GalleryPerspectiveIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- <ToggleButton
- value={perspectives.MAPIQUE}
- aria-label={perspectives.MAPIQUE}
- onClick={() => switchPerspective(perspectives.MAPIQUE)}
- >
- <Tooltip arrow title="Switch to Mapique perspective">
- <div style={{ display: 'flex' }}>
- <MapiquePerspectiveIcon />
- </div>
- </Tooltip>
- </ToggleButton>
+ {perspectiveToggleButtons}
</ToggleButtonGroup>
)}
</div>
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index 06781ba5c..ed4ee12ec 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -30,12 +30,7 @@ import AddExistingFileIcon from '@material-ui/icons/ExitToApp';
import ImportTagsIcon from '@material-ui/icons/FindInPage';
import OpenFolderNativelyIcon from '@material-ui/icons/Launch';
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 KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';
import NewFileIcon from '@material-ui/icons/InsertDriveFile';
-import NewFolderIcon from '@material-ui/icons/CreateNewFolder';
import ShareIcon from '@material-ui/icons/Link';
import RenameFolderIcon from '@material-ui/icons/FormatTextdirectionLToR';
import DeleteForeverIcon from '@material-ui/icons/DeleteForever';
@@ -56,11 +51,7 @@ import {
} from '-/utils/paths';
import PlatformIO from '-/services/platform-facade';
import { formatDateTime4Tag } from '-/utils/misc';
-import {
- actions as AppActions,
- getSelectedEntries,
- perspectives
-} from '-/reducers/app';
+import { actions as AppActions, getSelectedEntries } from '-/reducers/app';
import IOActions from '-/reducers/io-actions';
import TaggingActions from '-/reducers/tagging-actions';
import { getAllPropertiesPromise } from '-/services/utils-io';
@@ -70,6 +61,7 @@ import FileUploadContainer, {
import { TS } from '-/tagspaces.namespace';
import { ProLabel, BetaLabel } from '-/components/HelperComponents';
import Links from '-/links';
+import { PerspectiveIDs, AvailablePerspectives } from '-/perspectives';
interface Props {
open: boolean;
@@ -204,7 +196,7 @@ const DirectoryMenu = (props: Props) => {
} else {
props.setCurrentDirectoryPerspective(perspectiveId);
}
- } else if (perspectiveId === perspectives.GALLERY) {
+ } else if (perspectiveId === PerspectiveIDs.GALLERY) {
const openPersDocs = window.confirm(
'Gallery is part of TagSpaces Pro. Do you want to learn more about this perspective?'
);
@@ -214,7 +206,7 @@ const DirectoryMenu = (props: Props) => {
true
);
}
- } else if (perspectiveId === perspectives.MAPIQUE) {
+ } else if (perspectiveId === PerspectiveIDs.MAPIQUE) {
const openPersDocs = window.confirm(
'Mapique is part of TagSpaces Pro. Do you want to learn more about this perspective?'
);
@@ -224,7 +216,7 @@ const DirectoryMenu = (props: Props) => {
true
);
}
- } else if (perspectiveId === perspectives.KANBAN) {
+ } else if (perspectiveId === PerspectiveIDs.KANBAN) {
const openPersDocs = window.confirm(
'Kanban is part of TagSpaces Pro. Do you want to learn more about this perspective?'
);
@@ -513,18 +505,6 @@ Do you want to continue?`)
menuItems.push(<Divider key="divider1" />);
}
if (!isReadOnlyMode && !props.perspectiveMode) {
- menuItems.push(
- <MenuItem
- key="newSubDirectory"
- data-tid="newSubDirectory"
- onClick={showCreateDirectoryDialog}
- >
- <ListItemIcon>
- <NewFolderIcon />
- </ListItemIcon>
- <ListItemText primary={i18n.t('core:newSubdirectory')} />
- </MenuItem>
- );
menuItems.push(
<MenuItem
key="createNewFile"
@@ -618,82 +598,36 @@ Do you want to continue?`)
}
if (!props.perspectiveMode) {
menuItems.push(<Divider key="divider2" />);
- menuItems.push(
- <MenuItem
- key="openDefaultPerspective"
- data-tid="openDefaultPerspective"
- onClick={() => switchPerspective(perspectives.DEFAULT)}
- title="Switch to default perspective"
- >
- <ListItemIcon>
- <DefaultPerspectiveIcon />
- </ListItemIcon>
- <ListItemText primary="Default Perspective" />
- </MenuItem>
- );
- menuItems.push(
- <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(
- <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(
- <Tooltip title="Switch to Kanban perspective">
+ AvailablePerspectives.forEach(perspective => {
+ let badge = <></>;
+ if (!Pro && perspective.pro) {
+ badge = <ProLabel />;
+ }
+ if (!Pro && perspective.beta) {
+ badge = <BetaLabel />;
+ }
+ if (Pro && perspective.beta) {
+ badge = <BetaLabel />;
+ }
+ menuItems.push(
<MenuItem
- key="openKanBanPerspective"
- data-tid="openKanBanPerspectiveTID"
- onClick={() => switchPerspective(perspectives.KANBAN)}
+ key={perspective.key}
+ data-tid={perspective.key}
+ onClick={() => switchPerspective(perspective.id)}
+ title={perspective.tooltip}
>
- <ListItemIcon>
- <KanBanPerspectiveIcon />
- </ListItemIcon>
+ <ListItemIcon>{perspective.icon}</ListItemIcon>
<ListItemText
primary={
<>
- Kanban Perspective
- {Pro ? <BetaLabel /> : <ProLabel />}
+ {perspective.title}
+ {badge}
</>
}
/>
</MenuItem>
- </Tooltip>
- );
+ );
+ });
}
if (selectedEntries.length < 2) {
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index dd5bfeb99..b4145db18 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -68,6 +68,7 @@ import AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog'
import { TS } from '-/tagspaces.namespace';
import { Pro } from '-/pro';
import Links from '-/links';
+import { defaultSettings } from '../index';
interface Props {
classes: any;
@@ -88,7 +89,6 @@ interface Props {
openFileNatively: (path?: string) => void;
openURLExternally: (path: string) => void;
loadParentDirectoryContent: () => void;
- // setLastSelectedEntry: (entryPath: string | null) => void;
setSelectedEntries: (selectedEntries: Array<Object>) => void;
addTags: () => void;
addTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;
@@ -109,7 +109,9 @@ interface Props {
}
const GridPerspective = (props: Props) => {
- const settings = JSON.parse(localStorage.getItem('tsPerspectiveGrid')); // loading settings
+ const settings = JSON.parse(
+ localStorage.getItem(defaultSettings.settingsKey)
+ ); // loading settings
const [mouseX, setMouseX] = useState<number>(undefined);
const [mouseY, setMouseY] = useState<number>(undefined);
@@ -140,36 +142,43 @@ const GridPerspective = (props: Props) => {
undefined
);
const [sortBy, setSortBy] = useState<string>(
- settings && settings.sortBy ? settings.sortBy : 'byName'
+ settings && settings.sortBy ? settings.sortBy : defaultSettings.sortBy
);
const [orderBy, setOrderBy] = useState<null | boolean>(
settings && typeof settings.orderBy !== 'undefined'
? settings.orderBy
- : true
- );
- const [layoutType, setLayoutType] = useState<string>(
- settings && settings.layoutType ? settings.layoutType : 'grid'
+ : defaultSettings.orderBy
);
+ // const [layoutType, setLayoutType] = useState<string>(
+ // settings && settings.layoutType
+ // ? settings.layoutType
+ // : defaultSettings.layoutType
+ // );
+ const [layoutType, setLayoutType] = useState<string>('grid');
const [singleClickAction, setSingleClickAction] = useState<string>(
settings && settings.singleClickAction
? settings.singleClickAction
- : 'openInternal' // openExternal
+ : defaultSettings.singleClickAction
);
const [entrySize, setEntrySize] = useState<string>(
- settings && settings.entrySize ? settings.entrySize : 'small' // small, normal, big
+ settings && settings.entrySize
+ ? settings.entrySize
+ : defaultSettings.entrySize
);
const [thumbnailMode, setThumbnailMode] = useState<string>(
- settings && settings.thumbnailMode ? settings.thumbnailMode : 'contain' // cover contain
+ settings && settings.thumbnailMode
+ ? settings.thumbnailMode
+ : defaultSettings.thumbnailMode
);
const [showDirectories, setShowDirectories] = useState<boolean>(
settings && typeof settings.showDirectories !== 'undefined'
? settings.showDirectories
- : true
+ : defaultSettings.showDirectories
);
const [showTags, setShowTags] = useState<boolean>(
settings && typeof settings.showTags !== 'undefined'
? settings.showTags
- : true
+ : defaultSettings.showTags
);
const [
isMoveCopyFilesDialogOpened,
@@ -202,7 +211,10 @@ const GridPerspective = (props: Props) => {
thumbnailMode,
gridPageLimit
};
- localStorage.setItem('tsPerspectiveGrid', JSON.stringify(settingsObj));
+ localStorage.setItem(
+ defaultSettings.settingsKey,
+ JSON.stringify(settingsObj)
+ );
}, [
showDirectories,
showTags,
@@ -248,7 +260,6 @@ const GridPerspective = (props: Props) => {
isObj(firstSelectedElement) &&
!isVisibleOnScreen(firstSelectedElement)
) {
- // firstSelectedElement.parentNode.scrollTop = firstSelectedElement.offsetTop - firstSelectedElement.parentNode.offsetTop;
firstSelectedElement.scrollIntoView(false);
}
}
@@ -330,7 +341,6 @@ const GridPerspective = (props: Props) => {
selectedEntries.filter(entry => entry.path !== fsEntry.path)
); // deselect selected entry
} else {
- // selectedEntry.current = fsEntry;
setSelectedEntries([...selectedEntries, fsEntry]);
}
} else {
@@ -347,8 +357,6 @@ const GridPerspective = (props: Props) => {
const clearSelection = () => {
props.setSelectedEntries([]);
- // props.setLastSelectedEntry(null);
- // selectedEntry.current = undefined;
selectedEntryPath.current = undefined;
};
@@ -368,9 +376,7 @@ const GridPerspective = (props: Props) => {
} else {
const selectedEntries = [];
props.directoryContent.map(entry => {
- // if (entry.isFile) {
selectedEntries.push(entry);
- // }
return true;
});
props.setSelectedEntries(selectedEntries);
@@ -457,11 +463,7 @@ const GridPerspective = (props: Props) => {
} else {
props.setSelectedEntries([fsEntry]);
}
- } /* else { // deselect selected entry
- props.setSelectedEntries(
- selectedEntries.filter(entry => entry.uuid !== fsEntry.uuid)
- );
- } */
+ }
} else if (
props.selectedEntries.length === 0 ||
!fileOperationsEnabled()
@@ -493,7 +495,6 @@ const GridPerspective = (props: Props) => {
} else {
props.setSelectedEntries([fsEntry]);
}
- // selectedEntry.current = fsEntry;
setDirContextMenuAnchorEl(event.currentTarget);
}
};
@@ -591,9 +592,7 @@ const GridPerspective = (props: Props) => {
selectedEntries.some(entry => entry.path === fsEntry.path)
) {
selected = true;
- } /* else {
- selectedEntries.push(fsEntry);
- } */
+ }
const cellContent: any = (
<TagDropContainer
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index 467758598..b2ab80fe2 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -140,7 +140,7 @@ const MainToolbar = (props: Props) => {
<PropertiesIcon />
</IconButton>
</Tooltip>
- {layoutType === 'row' ? (
+ {/* {layoutType === 'row' ? (
<Tooltip title={i18n.t('core:switchToGridView')}>
<IconButton
aria-label={i18n.t('core:switchToGridView')}
@@ -164,7 +164,7 @@ const MainToolbar = (props: Props) => {
<ViewListIcon />
</IconButton>
</Tooltip>
- )}
+ )} */}
{!isReadOnlyMode && (
<Tooltip title={i18n.t('core:tagSelectedEntries')}>
<span>
diff --git a/app/perspectives/grid-perspective/index.tsx b/app/perspectives/grid-perspective/index.tsx
index 326d0554c..0e82c9b05 100644
--- a/app/perspectives/grid-perspective/index.tsx
+++ b/app/perspectives/grid-perspective/index.tsx
@@ -1 +1,27 @@
+import React from 'react';
+
export { default } from './components/MainContainer';
+
+// interface PerspectiveSettings {
+// settingsKey: string;
+// orderBy: boolean;
+// sortBy: string; // 'byName',
+// layoutType: string; // 'grid', // list grid
+// singleClickAction: string; // openInternal openExternal
+// entrySize: string; // small, normal, big
+// thumbnailMode: string; // cover contain
+// showDirectories: boolean;
+// showTags: boolean;
+// }
+
+export const defaultSettings = {
+ settingsKey: 'tsPerspectiveGrid',
+ orderBy: true,
+ sortBy: 'byName',
+ layoutType: 'grid', // list grid
+ singleClickAction: 'openInternal', // openInternal openExternal
+ entrySize: 'small', // small, normal, big
+ thumbnailMode: 'contain', // cover contain
+ showDirectories: true,
+ showTags: true
+};
diff --git a/app/perspectives/index.js b/app/perspectives/index.js
new file mode 100644
index 000000000..11eeda382
--- /dev/null
+++ b/app/perspectives/index.js
@@ -0,0 +1,102 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+import React from 'react';
+import KanbanPerspectiveIcon from '@material-ui/icons/Dashboard';
+import MapiquePerspectiveIcon from '@material-ui/icons/Map';
+import WikiPerspectiveIcon from '@material-ui/icons/FormatAlignLeft';
+import GalleryPerspectiveIcon from '@material-ui/icons/Camera';
+import ListPerspectiveIcon from '@material-ui/icons/ViewList';
+import GridPerspectiveIcon from '@material-ui/icons/ViewModule';
+
+export const PerspectiveIDs = {
+ DEFAULT: 'default',
+ LIST: 'list',
+ GALLERY: 'gallery',
+ // TREEVIZ: 'treeviz',
+ MAPIQUE: 'mapique',
+ KANBAN: 'kanban',
+ WIKI: 'wiki'
+};
+
+export const GridPerspectiveMeta = {
+ id: PerspectiveIDs.DEFAULT,
+ key: 'openDefaultPerspective',
+ pro: false,
+ beta: false,
+ icon: <GridPerspectiveIcon />,
+ title: 'Grid Perspective',
+ tooltip: 'Switch to Grid perspective'
+};
+
+export const ListPerspectiveMeta = {
+ id: PerspectiveIDs.LIST,
+ key: 'openListPerspective',
+ pro: false,
+ beta: false,
+ icon: <ListPerspectiveIcon />,
+ title: 'List Perspective',
+ tooltip: 'Switch to List perspective'
+};
+
+export const WikiPerspectiveMeta = {
+ id: PerspectiveIDs.WIKI,
+ key: 'openWikiPerspective',
+ pro: true,
+ beta: true,
+ icon: <WikiPerspectiveIcon />,
+ title: 'Wiki Perspective',
+ tooltip: 'Switch to Wiki perspective'
+};
+
+export const MapiquePerspectiveMeta = {
+ id: PerspectiveIDs.MAPIQUE,
+ key: 'openMapiquePerspective',
+ pro: true,
+ beta: false,
+ icon: <MapiquePerspectiveIcon />,
+ title: 'Mapique Perspective',
+ tooltip: 'Switch to Mapique perspective'
+};
+
+export const KanbanPerspectiveMeta = {
+ id: PerspectiveIDs.KANBAN,
+ key: 'openKanbanPerspective',
+ pro: true,
+ beta: true,
+ icon: <KanbanPerspectiveIcon />,
+ title: 'Kanban Perspective',
+ tooltip: 'Switch to Kanban perspective'
+};
+
+export const GalleryPerspectiveMeta = {
+ id: PerspectiveIDs.GALLERY,
+ key: 'openGalleryPerspective',
+ pro: true,
+ beta: false,
+ icon: <GalleryPerspectiveIcon />,
+ title: 'Gallery Perspective',
+ tooltip: 'Switch to Gallery perspective'
+};
+
+export const AvailablePerspectives = [];
+AvailablePerspectives.push(GridPerspectiveMeta);
+AvailablePerspectives.push(ListPerspectiveMeta);
+AvailablePerspectives.push(GalleryPerspectiveMeta);
+AvailablePerspectives.push(MapiquePerspectiveMeta);
+AvailablePerspectives.push(KanbanPerspectiveMeta);
+AvailablePerspectives.push(WikiPerspectiveMeta);
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
new file mode 100644
index 000000000..ed17d1209
--- /dev/null
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -0,0 +1,962 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import React, { useEffect, useMemo, useRef, useState } from 'react';
+import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
+import { GlobalHotKeys } from 'react-hotkeys';
+import { withStyles } from '@material-ui/core/styles';
+import { actions as TagLibraryActions } from '-/reducers/taglibrary';
+import {
+ getSupportedFileTypes,
+ getDesktopMode,
+ getKeyBindingObject,
+ isDesktopMode
+} from '-/reducers/settings';
+import {
+ isObj,
+ isVisibleOnScreen,
+ locationType,
+ sortByCriteria
+} from '-/utils/misc';
+import styles from '-/perspectives/grid-perspective/components/styles.css';
+import FileMenu from '-/components/menus/FileMenu';
+import DirectoryMenu from '-/components/menus/DirectoryMenu';
+import EntryTagMenu from '-/components/menus/EntryTagMenu';
+import i18n from '-/services/i18n';
+import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
+import MoveCopyFilesDialog from '-/components/dialogs/MoveCopyFilesDialog';
+import TargetMoveFileBox from '-/components/TargetMoveFileBox';
+import FileSourceDnd from '-/components/FileSourceDnd';
+import AppConfig from '-/config';
+import DragItemTypes from '-/components/DragItemTypes';
+import TagDropContainer from '-/components/TagDropContainer';
+import IOActions from '-/reducers/io-actions';
+import {
+ actions as AppActions,
+ getLastSelectedEntry,
+ getSelectedEntries,
+ isDeleteMultipleEntriesDialogOpened,
+ isReadOnlyMode
+} from '-/reducers/app';
+import TaggingActions from '-/reducers/tagging-actions';
+import CellContent from '-/perspectives/grid-perspective/components/CellContent';
+import MainToolbar from '-/perspectives/grid-perspective/components/MainToolbar';
+import SortingMenu from '-/perspectives/grid-perspective/components/SortingMenu';
+import GridOptionsMenu from '-/perspectives/grid-perspective/components/GridOptionsMenu';
+import { getLocation, getLocations } from '-/reducers/locations';
+import PlatformIO from '-/services/platform-facade';
+import { getLocationPath } from '-/utils/paths';
+import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';
+import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';
+import AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog';
+import { TS } from '-/tagspaces.namespace';
+import { Pro } from '-/pro';
+import Links from '-/links';
+import { defaultSettings } from '../index';
+
+interface Props {
+ classes: any;
+ theme: any;
+ desktopMode: boolean;
+ currentDirectoryPath: string;
+ lastSelectedEntry: any;
+ selectedEntries: Array<any>;
+ supportedFileTypes: Array<any>;
+ isReadOnlyMode: boolean;
+ openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;
+ openNextFile: () => any;
+ openPrevFile: () => any;
+ openRenameEntryDialog: () => void;
+ loadDirectoryContent: (path: string, generateThumbnails: boolean) => void;
+ openDirectory: (path: string) => void;
+ showInFileManager: (path: string) => void;
+ openFileNatively: (path?: string) => void;
+ openURLExternally: (path: string) => void;
+ loadParentDirectoryContent: () => void;
+ setSelectedEntries: (selectedEntries: Array<Object>) => void;
+ addTags: () => void;
+ addTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;
+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
+ removeAllTags: () => void;
+ directoryContent: Array<TS.FileSystemEntry>;
+ moveFiles: (files: Array<string>, destination: string) => void;
+ keyBindings: any;
+ showNotification: (
+ text: string,
+ notificationType: string,
+ autohide: boolean
+ ) => void;
+ currentLocation: TS.Location;
+ locations: Array<TS.Location>;
+ isDesktopMode: boolean;
+ toggleDeleteMultipleEntriesDialog: () => void;
+}
+
+const GridPerspective = (props: Props) => {
+ const settings = JSON.parse(
+ localStorage.getItem(defaultSettings.settingsKey)
+ ); // loading settings
+
+ const [mouseX, setMouseX] = useState<number>(undefined);
+ const [mouseY, setMouseY] = useState<number>(undefined);
+ // const selectedEntry = useRef<FileSystemEntry>(undefined);
+ const selectedEntryPath = useRef<string>(undefined);
+ const selectedTag = useRef<TS.Tag | null>(null);
+ const [
+ fileContextMenuAnchorEl,
+ setFileContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+ const [
+ dirContextMenuAnchorEl,
+ setDirContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+ const [
+ tagContextMenuAnchorEl,
+ setTagContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+ const [
+ sortingContextMenuAnchorEl,
+ setSortingContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+ const [
+ optionsContextMenuAnchorEl,
+ setOptionsContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+ const [isAddTagDialogOpened, setIsAddTagDialogOpened] = useState<TS.Tag>(
+ undefined
+ );
+ const [sortBy, setSortBy] = useState<string>(
+ settings && settings.sortBy ? settings.sortBy : defaultSettings.sortBy
+ );
+ const [orderBy, setOrderBy] = useState<null | boolean>(
+ settings && typeof settings.orderBy !== 'undefined'
+ ? settings.orderBy
+ : defaultSettings.orderBy
+ );
+ // const [layoutType, setLayoutType] = useState<string>(
+ // settings && settings.layoutType
+ // ? settings.layoutType
+ // : defaultSettings.layoutType
+ // );
+ const [layoutType, setLayoutType] = useState<string>('row');
+ const [singleClickAction, setSingleClickAction] = useState<string>(
+ settings && settings.singleClickAction
+ ? settings.singleClickAction
+ : defaultSettings.singleClickAction
+ );
+ const [entrySize, setEntrySize] = useState<string>(
+ settings && settings.entrySize
+ ? settings.entrySize
+ : defaultSettings.entrySize
+ );
+ const [thumbnailMode, setThumbnailMode] = useState<string>(
+ settings && settings.thumbnailMode
+ ? settings.thumbnailMode
+ : defaultSettings.thumbnailMode
+ );
+ const [showDirectories, setShowDirectories] = useState<boolean>(
+ settings && typeof settings.showDirectories !== 'undefined'
+ ? settings.showDirectories
+ : defaultSettings.showDirectories
+ );
+ const [showTags, setShowTags] = useState<boolean>(
+ settings && typeof settings.showTags !== 'undefined'
+ ? settings.showTags
+ : defaultSettings.showTags
+ );
+ const [
+ isMoveCopyFilesDialogOpened,
+ setIsMoveCopyFilesDialogOpened
+ ] = useState<boolean>(false);
+ const [
+ isAddRemoveTagsDialogOpened,
+ setIsAddRemoveTagsDialogOpened
+ ] = useState<boolean>(false);
+ const [isGridSettingsDialogOpened, setIsGridSettingsDialogOpened] = useState<
+ boolean
+ >(false);
+ const [gridPageLimit, setGridPageLimit] = useState<number>(
+ settings && settings.gridPageLimit ? settings.gridPageLimit : 100
+ );
+
+ useEffect(() => {
+ makeFirstSelectedEntryVisible();
+ }, [props.selectedEntries]);
+
+ useEffect(() => {
+ const settingsObj = {
+ showDirectories,
+ showTags,
+ layoutType,
+ orderBy,
+ sortBy,
+ singleClickAction,
+ entrySize,
+ thumbnailMode,
+ gridPageLimit
+ };
+ localStorage.setItem(
+ defaultSettings.settingsKey,
+ JSON.stringify(settingsObj)
+ );
+ }, [
+ showDirectories,
+ showTags,
+ layoutType,
+ orderBy,
+ sortBy,
+ singleClickAction,
+ entrySize,
+ thumbnailMode,
+ gridPageLimit
+ ]);
+
+ const fileOperationsEnabled = () => {
+ let selectionContainsDirectories = false;
+ if (props.selectedEntries && props.selectedEntries.length > 0) {
+ selectionContainsDirectories = selectedEntries.some(
+ entry => !entry.isFile
+ );
+ }
+ return !selectionContainsDirectories;
+ };
+
+ const folderOperationsEnabled = () => {
+ let selectionContainsFiles = false;
+ if (props.selectedEntries && props.selectedEntries.length > 0) {
+ selectionContainsFiles = selectedEntries.some(entry => entry.isFile);
+ }
+ return !selectionContainsFiles;
+ };
+
+ const sortedDirContentMemoized = useMemo(
+ () => sortByCriteria(props.directoryContent, sortBy, orderBy),
+ [props.directoryContent, sortBy, orderBy]
+ );
+
+ const makeFirstSelectedEntryVisible = () => {
+ const { selectedEntries } = props;
+ if (selectedEntries && selectedEntries.length > 0) {
+ const firstSelectedElement = document.querySelector(
+ '[data-entry-id="' + selectedEntries[0].uuid + '"]'
+ );
+ if (
+ isObj(firstSelectedElement) &&
+ !isVisibleOnScreen(firstSelectedElement)
+ ) {
+ firstSelectedElement.scrollIntoView(false);
+ }
+ }
+ };
+
+ const handleLayoutSwitch = (type: string) => {
+ setLayoutType(type);
+ };
+
+ const handleGridPageLimit = (limit: number) => {
+ setGridPageLimit(limit);
+ setIsGridSettingsDialogOpened(false);
+ };
+
+ const handleSortBy = handleSort => {
+ if (sortBy !== handleSort) {
+ setSortBy(handleSort);
+ } else {
+ setOrderBy(!orderBy);
+ }
+ setSortingContextMenuAnchorEl(null);
+ };
+
+ const handleSortingMenu = event => {
+ const anchor = event ? event.currentTarget : null;
+ setSortingContextMenuAnchorEl(anchor);
+ };
+
+ const handleExportCsvMenu = () => {
+ if (Pro) {
+ Pro.exportAsCsv.ExportAsCsv(props.directoryContent);
+ }
+ };
+
+ const handleGridCellClick = (event, fsEntry: TS.FileSystemEntry) => {
+ const {
+ selectedEntries,
+ directoryContent,
+ lastSelectedEntry,
+ setSelectedEntries
+ } = props;
+ const selectHelperKey = AppConfig.isMacLike ? event.metaKey : event.ctrlKey;
+ if (event.shiftKey) {
+ let lastSelectedIndex;
+ if (lastSelectedEntry) {
+ lastSelectedIndex = directoryContent.findIndex(
+ entry => entry.path === lastSelectedEntry.path
+ );
+ }
+ const currentSelectedIndex = directoryContent.findIndex(
+ entry => entry.path === fsEntry.path
+ );
+ if (lastSelectedIndex < 0) {
+ lastSelectedIndex = currentSelectedIndex;
+ }
+
+ let entriesToSelect;
+ // console.log('lastSelectedIndex: ' + lastSelectedIndex + ' currentSelectedIndex: ' + currentSelectedIndex);
+ if (currentSelectedIndex > lastSelectedIndex) {
+ entriesToSelect = directoryContent.slice(
+ lastSelectedIndex,
+ currentSelectedIndex + 1
+ );
+ } else if (currentSelectedIndex < lastSelectedIndex) {
+ entriesToSelect = directoryContent
+ .slice(currentSelectedIndex, lastSelectedIndex + 1)
+ .reverse();
+ } else if (currentSelectedIndex === lastSelectedIndex) {
+ entriesToSelect = [fsEntry];
+ }
+
+ setSelectedEntries(entriesToSelect);
+ } else if (selectHelperKey) {
+ if (
+ selectedEntries &&
+ selectedEntries.some(entry => entry.path === fsEntry.path)
+ ) {
+ setSelectedEntries(
+ selectedEntries.filter(entry => entry.path !== fsEntry.path)
+ ); // deselect selected entry
+ } else {
+ setSelectedEntries([...selectedEntries, fsEntry]);
+ }
+ } else {
+ setSelectedEntries([fsEntry]);
+ if (fsEntry.isFile) {
+ if (singleClickAction === 'openInternal') {
+ props.openFsEntry(fsEntry);
+ } else if (singleClickAction === 'openExternal') {
+ props.openFileNatively(fsEntry.path);
+ }
+ }
+ }
+ };
+
+ const clearSelection = () => {
+ props.setSelectedEntries([]);
+ selectedEntryPath.current = undefined;
+ };
+
+ const {
+ classes,
+ selectedEntries,
+ loadParentDirectoryContent,
+ theme,
+ currentDirectoryPath
+ } = props;
+
+ const someFileSelected = selectedEntries.length > 1;
+
+ const toggleSelectAllFiles = () => {
+ if (someFileSelected) {
+ clearSelection();
+ } else {
+ const selectedEntries = [];
+ props.directoryContent.map(entry => {
+ selectedEntries.push(entry);
+ return true;
+ });
+ props.setSelectedEntries(selectedEntries);
+ }
+ };
+
+ const toggleShowDirectories = () => {
+ closeOptionsMenu();
+ setShowDirectories(!showDirectories);
+ };
+
+ const toggleShowTags = () => {
+ closeOptionsMenu();
+ setShowTags(!showTags);
+ };
+
+ const toggleThumbnailsMode = () => {
+ closeOptionsMenu();
+ const thumbMode = thumbnailMode === 'cover' ? 'contain' : 'cover';
+ setThumbnailMode(thumbMode);
+ };
+
+ const changeEntrySize = size => {
+ closeOptionsMenu();
+ setEntrySize(size);
+ };
+
+ const changeSingleClickAction = singleClick => {
+ closeOptionsMenu();
+ setSingleClickAction(singleClick);
+ };
+
+ const openHelpWebPage = () => {
+ closeOptionsMenu();
+ props.openURLExternally(Links.documentationLinks.defaultPerspective);
+ };
+
+ const openSettings = () => {
+ closeOptionsMenu();
+ setIsGridSettingsDialogOpened(true);
+ };
+
+ const handleGridCellDblClick = (event, fsEntry: TS.FileSystemEntry) => {
+ props.setSelectedEntries([]);
+ if (props.currentLocation.type === locationType.TYPE_CLOUD) {
+ PlatformIO.enableObjectStoreSupport(props.currentLocation)
+ .then(() => {
+ openLocation(fsEntry);
+ return true;
+ })
+ .catch(error => {
+ console.log('enableObjectStoreSupport', error);
+ });
+ } else if (props.currentLocation.type === locationType.TYPE_LOCAL) {
+ PlatformIO.disableObjectStoreSupport();
+ openLocation(fsEntry);
+ }
+ };
+
+ const openLocation = (fsEntry: TS.FileSystemEntry) => {
+ if (fsEntry.isFile) {
+ props.setSelectedEntries([fsEntry]);
+ props.openFsEntry(fsEntry);
+ } else {
+ console.log('Handle Grid cell db click, selected path : ', fsEntry.path);
+ props.loadDirectoryContent(fsEntry.path, true);
+ }
+ };
+
+ const handleGridContextMenu = (event, fsEntry: TS.FileSystemEntry) => {
+ event.preventDefault();
+ event.stopPropagation();
+ setMouseX(event.clientX);
+ setMouseY(event.clientY);
+ const { desktopMode, selectedEntries } = props;
+ const isEntryExist = selectedEntries.some(
+ entry => entry.uuid === fsEntry.uuid
+ );
+ if (fsEntry.isFile) {
+ if (!desktopMode) {
+ if (!isEntryExist) {
+ if (selectedEntries.length > 0) {
+ props.setSelectedEntries([...selectedEntries, fsEntry]);
+ } else {
+ props.setSelectedEntries([fsEntry]);
+ }
+ }
+ } else if (
+ props.selectedEntries.length === 0 ||
+ !fileOperationsEnabled()
+ ) {
+ props.setSelectedEntries([fsEntry]);
+ } else if (event.ctrlKey) {
+ if (!isEntryExist) {
+ props.setSelectedEntries([...selectedEntries, fsEntry]);
+ }
+ } else if (isEntryExist) {
+ // update selected entry
+ props.setSelectedEntries([
+ ...selectedEntries.filter(entry => entry.uuid !== fsEntry.uuid),
+ fsEntry
+ ]);
+ } else {
+ props.setSelectedEntries([fsEntry]);
+ }
+ setFileContextMenuAnchorEl(event.currentTarget);
+ } else {
+ if (props.selectedEntries.length === 0 || !folderOperationsEnabled()) {
+ props.setSelectedEntries([fsEntry]);
+ } else if (isEntryExist) {
+ // update selected entry
+ props.setSelectedEntries([
+ ...selectedEntries.filter(entry => entry.uuid !== fsEntry.uuid),
+ fsEntry
+ ]);
+ } else {
+ props.setSelectedEntries([fsEntry]);
+ }
+ setDirContextMenuAnchorEl(event.currentTarget);
+ }
+ };
+
+ const selectEntry = (fsEntry: TS.FileSystemEntry) => {
+ const { setSelectedEntries, selectedEntries } = props;
+ setSelectedEntries([...selectedEntries, fsEntry]);
+ };
+
+ const deselectEntry = (fsEntry: TS.FileSystemEntry) => {
+ const { setSelectedEntries, selectedEntries } = props;
+ const newSelection = selectedEntries.filter(
+ data => data.path !== fsEntry.path
+ );
+ setSelectedEntries(newSelection);
+ };
+
+ const handleTagMenu = (
+ event: React.ChangeEvent<HTMLInputElement>,
+ tag: TS.Tag,
+ entryPath: string
+ ) => {
+ event.preventDefault();
+ event.stopPropagation();
+
+ selectedTag.current = tag;
+ selectedEntryPath.current = entryPath;
+ setTagContextMenuAnchorEl(event.currentTarget);
+ };
+
+ const closeOptionsMenu = () => {
+ setOptionsContextMenuAnchorEl(null);
+ };
+
+ const openMoveCopyFilesDialog = () => {
+ setIsMoveCopyFilesDialogOpened(true);
+ };
+
+ const openDeleteFileDialog = () => {
+ props.toggleDeleteMultipleEntriesDialog();
+ };
+
+ const openAddRemoveTagsDialog = () => {
+ setIsAddRemoveTagsDialogOpened(true);
+ };
+
+ const handleFileMoveDrop = (item, monitor) => {
+ if (props.isReadOnlyMode) {
+ props.showNotification(
+ i18n.t('core:dndDisabledReadOnlyMode'),
+ 'error',
+ true
+ );
+ return;
+ }
+ if (monitor) {
+ const { path, selectedEntries } = monitor.getItem();
+ let arrPath;
+ if (selectedEntries && selectedEntries.length > 0) {
+ const arrSelected = selectedEntries
+ .map(entry => entry.path)
+ // remove target folder selection
+ .filter(epath => epath !== item.path);
+ if (arrSelected.length > 0) {
+ arrPath = arrSelected;
+ } else {
+ arrPath = [path];
+ }
+ } else {
+ arrPath = [path];
+ }
+ console.log('Dropped files: ' + path);
+ props.moveFiles(arrPath, item.path);
+ clearSelection();
+ }
+ };
+
+ const renderCell = (fsEntry: TS.FileSystemEntry, isLast?: boolean) => {
+ const {
+ classes,
+ theme,
+ selectedEntries,
+ addTags,
+ addTag,
+ supportedFileTypes,
+ openFsEntry
+ } = props;
+ if (!fsEntry.isFile && !showDirectories) {
+ return;
+ }
+
+ let selected = false;
+ if (
+ selectedEntries &&
+ selectedEntries.some(entry => entry.path === fsEntry.path)
+ ) {
+ selected = true;
+ }
+
+ const cellContent: any = (
+ <TagDropContainer
+ entryPath={fsEntry.path} // TODO remove entryPath it is already included in selectedEntries
+ selectedEntries={
+ selectedEntries.length > 0 ? selectedEntries : [fsEntry]
+ }
+ >
+ <CellContent
+ selected={selected}
+ fsEntry={fsEntry}
+ entrySize={entrySize}
+ classes={classes}
+ isLast={isLast}
+ theme={theme}
+ supportedFileTypes={supportedFileTypes}
+ thumbnailMode={thumbnailMode}
+ addTags={addTags}
+ addTag={addTag}
+ selectedEntries={selectedEntries}
+ selectEntry={selectEntry}
+ deselectEntry={deselectEntry}
+ isReadOnlyMode={props.isReadOnlyMode}
+ handleTagMenu={handleTagMenu}
+ layoutType={layoutType}
+ showTags={showTags}
+ openFsEntry={openFsEntry}
+ handleGridContextMenu={handleGridContextMenu}
+ handleGridCellDblClick={handleGridCellDblClick}
+ handleGridCellClick={handleGridCellClick}
+ />
+ </TagDropContainer>
+ );
+
+ const key = fsEntry.path;
+
+ if (fsEntry.isFile) {
+ return <FileSourceDnd key={key}>{cellContent}</FileSourceDnd>;
+ }
+
+ return (
+ <div
+ style={{
+ position: 'relative'
+ }}
+ key={key}
+ >
+ <TargetMoveFileBox
+ // @ts-ignore
+ accepts={[DragItemTypes.FILE]}
+ path={fsEntry.path}
+ onDrop={handleFileMoveDrop}
+ >
+ {cellContent}
+ </TargetMoveFileBox>
+ </div>
+ );
+ };
+
+ const keyMap = {
+ nextDocument: props.keyBindings.nextDocument,
+ prevDocument: props.keyBindings.prevDocument,
+ selectAll: props.keyBindings.selectAll,
+ deleteDocument: props.keyBindings.deleteDocument,
+ addRemoveTags: props.keyBindings.addRemoveTags,
+ renameFile: props.keyBindings.renameFile,
+ openEntry: props.keyBindings.openEntry,
+ openFileExternally: props.keyBindings.openFileExternally
+ };
+
+ const onContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {
+ event.preventDefault();
+ setMouseX(event.clientX);
+ setMouseY(event.clientY);
+ if (props.selectedEntries.length > 0) {
+ props.setSelectedEntries([]);
+ }
+ setDirContextMenuAnchorEl(event.currentTarget);
+ };
+
+ const onClick = (event: React.MouseEvent<HTMLDivElement>) => {
+ event.preventDefault();
+ if (props.selectedEntries.length > 0) {
+ props.setSelectedEntries([]);
+ }
+ };
+
+ const getSelEntryPath = () => {
+ if (props.lastSelectedEntry) {
+ return props.lastSelectedEntry.path;
+ }
+ return currentDirectoryPath;
+ };
+
+ const keyBindingHandlers = {
+ nextDocument: () => props.openNextFile(),
+ prevDocument: () => props.openPrevFile(),
+ selectAll: () => toggleSelectAllFiles(),
+ deleteDocument: () => {
+ if (fileOperationsEnabled()) {
+ openDeleteFileDialog();
+ }
+ },
+ addRemoveTags: () => {
+ if (getSelEntryPath()) {
+ openAddRemoveTagsDialog();
+ }
+ },
+ renameFile: () => {
+ props.openRenameEntryDialog();
+ },
+ openEntry: e => {
+ e.preventDefault();
+ props.openFsEntry();
+ },
+ openFileExternally: () => {
+ props.openFileNatively();
+ }
+ };
+
+ const selectedFilePaths = selectedEntries
+ ? selectedEntries
+ .filter(fsEntry => fsEntry.isFile)
+ .map(fsentry => fsentry.path)
+ : [];
+ const sortedDirectories = sortedDirContentMemoized.filter(
+ entry => !entry.isFile
+ );
+ const sortedFiles = sortedDirContentMemoized.filter(entry => entry.isFile);
+ const locationPath = props.currentLocation
+ ? getLocationPath(props.currentLocation)
+ : '';
+ let entryWidth = 200;
+ if (entrySize === 'small') {
+ entryWidth = 150;
+ } else if (entrySize === 'normal') {
+ entryWidth = 200;
+ } else if (entrySize === 'big') {
+ entryWidth = 300;
+ }
+
+ return (
+ <div
+ style={{
+ height: 'calc(100% - 48px)'
+ }}
+ >
+ <MainToolbar
+ classes={classes}
+ layoutType={layoutType}
+ isReadOnlyMode={props.isReadOnlyMode}
+ selectedEntries={selectedEntries}
+ loadParentDirectoryContent={loadParentDirectoryContent}
+ toggleSelectAllFiles={toggleSelectAllFiles}
+ someFileSelected={someFileSelected}
+ handleLayoutSwitch={handleLayoutSwitch}
+ openAddRemoveTagsDialog={openAddRemoveTagsDialog}
+ fileOperationsEnabled={fileOperationsEnabled()}
+ openMoveCopyFilesDialog={openMoveCopyFilesDialog}
+ openDeleteFileDialog={openDeleteFileDialog}
+ openFsEntry={props.openFsEntry}
+ handleSortingMenu={handleSortingMenu}
+ handleExportCsvMenu={handleExportCsvMenu}
+ openSettings={openSettings}
+ directoryPath={currentDirectoryPath}
+ />
+ <GlobalHotKeys
+ keyMap={keyMap}
+ handlers={keyBindingHandlers}
+ allowChanges={true}
+ >
+ <GridPagination
+ gridPageLimit={gridPageLimit}
+ className={
+ layoutType === 'grid' ? classes.gridContainer : classes.rowContainer
+ }
+ style={{
+ marginTop: 53,
+ gridTemplateColumns:
+ layoutType === 'grid'
+ ? 'repeat(auto-fit,minmax(' + entryWidth + 'px,1fr))'
+ : 'none'
+ // gridTemplateRows:
+ // layoutType === 'grid' ? 'repeat(auto-fit, 230px)' : 'auto'
+ }}
+ theme={theme}
+ // gridRef={this.mainGrid}
+ directories={sortedDirectories}
+ showDirectories={showDirectories}
+ files={sortedFiles}
+ renderCell={renderCell}
+ currentPage={1}
+ currentLocationPath={locationPath}
+ currentDirectoryPath={props.currentDirectoryPath}
+ onClick={onClick}
+ onContextMenu={onContextMenu}
+ />
+ </GlobalHotKeys>
+ {isAddRemoveTagsDialogOpened && (
+ <AddRemoveTagsDialog
+ open={isAddRemoveTagsDialogOpened}
+ onClose={() => setIsAddRemoveTagsDialogOpened(false)}
+ addTags={props.addTags}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ selectedEntries={props.selectedEntries}
+ />
+ )}
+ {isAddTagDialogOpened !== undefined && (
+ <AddTagToTagGroupDialog
+ open={isAddTagDialogOpened !== undefined}
+ onClose={() => setIsAddTagDialogOpened(undefined)}
+ addTag={props.addTag}
+ selectedTag={isAddTagDialogOpened}
+ />
+ )}
+ {isGridSettingsDialogOpened && (
+ <GridSettingsDialog
+ open={isGridSettingsDialogOpened}
+ onClose={() => setIsGridSettingsDialogOpened(false)}
+ setGridPageLimit={handleGridPageLimit}
+ gridPageLimit={gridPageLimit}
+ toggleShowDirectories={toggleShowDirectories}
+ toggleShowTags={toggleShowTags}
+ showDirectories={showDirectories}
+ showTags={showTags}
+ toggleThumbnailsMode={toggleThumbnailsMode}
+ thumbnailMode={thumbnailMode}
+ changeEntrySize={changeEntrySize}
+ entrySize={entrySize}
+ changeSingleClickAction={changeSingleClickAction}
+ singleClickAction={singleClickAction}
+ openHelpWebPage={openHelpWebPage}
+ />
+ )}
+ {isMoveCopyFilesDialogOpened && (
+ <MoveCopyFilesDialog
+ open={isMoveCopyFilesDialogOpened}
+ onClose={() => setIsMoveCopyFilesDialogOpened(false)}
+ selectedFiles={selectedFilePaths}
+ />
+ )}
+ {Boolean(fileContextMenuAnchorEl) && (
+ <FileMenu
+ anchorEl={fileContextMenuAnchorEl}
+ mouseX={mouseX}
+ mouseY={mouseY}
+ open={Boolean(fileContextMenuAnchorEl)}
+ onClose={() => setFileContextMenuAnchorEl(null)}
+ openDeleteFileDialog={openDeleteFileDialog}
+ openRenameFileDialog={props.openRenameEntryDialog}
+ openMoveCopyFilesDialog={openMoveCopyFilesDialog}
+ openAddRemoveTagsDialog={openAddRemoveTagsDialog}
+ openFsEntry={props.openFsEntry}
+ openFileNatively={props.openFileNatively}
+ loadDirectoryContent={props.loadDirectoryContent}
+ showInFileManager={props.showInFileManager}
+ showNotification={props.showNotification}
+ isReadOnlyMode={props.isReadOnlyMode}
+ selectedFilePath={getSelEntryPath()}
+ selectedEntries={props.selectedEntries}
+ currentLocation={props.currentLocation}
+ locations={props.locations}
+ />
+ )}
+ {/* {Boolean(dirContextMenuAnchorEl) && ( // todo move dialogs from DirectoryMenu */}
+ <DirectoryMenu
+ open={Boolean(dirContextMenuAnchorEl)}
+ onClose={() => setDirContextMenuAnchorEl(null)}
+ anchorEl={dirContextMenuAnchorEl}
+ mouseX={mouseX}
+ mouseY={mouseY}
+ directoryPath={getSelEntryPath()}
+ loadDirectoryContent={props.loadDirectoryContent}
+ openRenameDirectoryDialog={props.openRenameEntryDialog}
+ openDirectory={props.openDirectory}
+ openFsEntry={props.openFsEntry}
+ isReadOnlyMode={props.isReadOnlyMode}
+ perspectiveMode={getSelEntryPath() !== props.currentDirectoryPath}
+ currentLocation={props.currentLocation}
+ locations={props.locations}
+ />
+ {/* {Boolean(tagContextMenuAnchorEl) && ( // TODO EntryTagMenu is used in TagSelect we cannot move confirm dialog from menu */}
+ <EntryTagMenu
+ anchorEl={tagContextMenuAnchorEl}
+ open={Boolean(tagContextMenuAnchorEl)}
+ onClose={() => setTagContextMenuAnchorEl(null)}
+ setIsAddTagDialogOpened={setIsAddTagDialogOpened}
+ selectedTag={selectedTag.current}
+ currentEntryPath={selectedEntryPath.current} // getSelEntryPath()}
+ removeTags={props.removeTags}
+ isReadOnlyMode={props.isReadOnlyMode}
+ />
+ {Boolean(sortingContextMenuAnchorEl) && (
+ <SortingMenu
+ open={Boolean(sortingContextMenuAnchorEl)}
+ onClose={() => setSortingContextMenuAnchorEl(null)}
+ anchorEl={sortingContextMenuAnchorEl}
+ sortBy={sortBy}
+ orderBy={orderBy}
+ handleSortBy={handleSortBy}
+ />
+ )}
+ {Boolean(optionsContextMenuAnchorEl) && (
+ <GridOptionsMenu
+ open={Boolean(optionsContextMenuAnchorEl)}
+ onClose={closeOptionsMenu}
+ anchorEl={optionsContextMenuAnchorEl}
+ toggleShowDirectories={toggleShowDirectories}
+ showDirectories={showDirectories}
+ toggleShowTags={toggleShowTags}
+ showTags={showTags}
+ toggleThumbnailsMode={toggleThumbnailsMode}
+ thumbnailMode={thumbnailMode}
+ entrySize={entrySize}
+ changeSingleClickAction={changeSingleClickAction}
+ singleClickAction={singleClickAction}
+ changeEntrySize={changeEntrySize}
+ openHelpWebPage={openHelpWebPage}
+ openSettings={openSettings}
+ />
+ )}
+ </div>
+ );
+};
+
+function mapActionCreatorsToProps(dispatch) {
+ return bindActionCreators(
+ {
+ moveFiles: IOActions.moveFiles,
+ setSelectedEntries: AppActions.setSelectedEntries,
+ showNotification: AppActions.showNotification,
+ openFileNatively: AppActions.openFileNatively,
+ openURLExternally: AppActions.openURLExternally,
+ openNextFile: AppActions.openNextFile,
+ openPrevFile: AppActions.openPrevFile,
+ toggleDeleteMultipleEntriesDialog:
+ AppActions.toggleDeleteMultipleEntriesDialog,
+ addTags: TaggingActions.addTags,
+ addTag: TagLibraryActions.addTag
+ },
+ dispatch
+ );
+}
+
+function mapStateToProps(state) {
+ return {
+ supportedFileTypes: getSupportedFileTypes(state),
+ isReadOnlyMode: isReadOnlyMode(state),
+ lastSelectedEntry: getLastSelectedEntry(state),
+ desktopMode: getDesktopMode(state),
+ selectedEntries: getSelectedEntries(state),
+ keyBindings: getKeyBindingObject(state),
+ currentLocation: getLocation(state, state.app.currentLocationId),
+ locations: getLocations(state),
+ isDesktopMode: isDesktopMode(state),
+ isDeleteMultipleEntriesDialogOpened: isDeleteMultipleEntriesDialogOpened(
+ state
+ )
+ };
+}
+
+export default connect(
+ mapStateToProps,
+ mapActionCreatorsToProps
+ // @ts-ignore
+)(withStyles(styles, { withTheme: true })(GridPerspective));
diff --git a/app/perspectives/list/index.tsx b/app/perspectives/list/index.tsx
new file mode 100644
index 000000000..f1764d349
--- /dev/null
+++ b/app/perspectives/list/index.tsx
@@ -0,0 +1,27 @@
+import React from 'react';
+
+export { default } from './components/MainContainer';
+
+// interface PerspectiveSettings {
+// settingsKey: string;
+// orderBy: boolean;
+// sortBy: string; // 'byName',
+// layoutType: string; // 'grid', // list grid
+// singleClickAction: string; // openInternal openExternal
+// entrySize: string; // small, normal, big
+// thumbnailMode: string; // cover contain
+// showDirectories: boolean;
+// showTags: boolean;
+// }
+
+export const defaultSettings = {
+ settingsKey: 'tsPerspectiveList',
+ orderBy: true,
+ sortBy: 'byName',
+ layoutType: 'row', // row grid
+ singleClickAction: 'openInternal', // openInternal openExternal
+ entrySize: 'small', // small, normal, big
+ thumbnailMode: 'contain', // cover contain
+ showDirectories: true,
+ showTags: true
+};
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index e98efcb1f..5f940f767 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -60,6 +60,7 @@ import {
isGlobalKeyBindingEnabled
} from '-/reducers/settings';
import { TS } from '-/tagspaces.namespace';
+import { PerspectiveIDs } from '-/perspectives';
export const types = {
DEVICE_ONLINE: 'APP/DEVICE_ONLINE',
@@ -120,13 +121,6 @@ export const types = {
UPDATE_CURRENTDIR_ENTRY: 'APP/UPDATE_CURRENTDIR_ENTRY',
SET_ISLOADING: 'APP/SET_ISLOADING'
};
-export const perspectives = {
- DEFAULT: 'default',
- GALLERY: 'gallery',
- // TREEVIZ: 'treeviz',
- MAPIQUE: 'mapique',
- KANBAN: 'kanban'
-};
export const NotificationTypes = {
default: 'default',
@@ -1489,7 +1483,7 @@ export const actions = {
dispatch(actions.loadDirectoryContent(getLocationPath(location), true));
if (Pro && Pro.Watcher && location.watchForChanges) {
const perspective = getCurrentDirectoryPerspective(getState());
- const depth = perspective === perspectives.KANBAN ? 3 : 1;
+ const depth = perspective === PerspectiveIDs.KANBAN ? 3 : 1;
Pro.Watcher.watchFolder(
getLocationPath(location),
dispatch,