TagSpaces is an offline, open source, document manager with tagging support
added initial perspective switch in the directory menu
Ilian Sapundshieve2b3cd22a219
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.jsindex 2cfe0dbeb..da577eade 100644--- a/app/components/FolderContainer.js+++ b/app/components/FolderContainer.js@@ -59,9 +59,10 @@ const GridPerspectiveAsync = props => ();let GalleryPerspective = React.Fragment;-// if (Pro && Pro.Perspectives) {+if (Pro && Pro.Perspectives) {// GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));-// }+ GalleryPerspective = Pro.Perspectives.GalleryPerspective;+}const GalleryPerspectiveAsync = props => (<React.Suspense fallback={<LoadingLazy />}><GalleryPerspective {...props} />@@ -160,7 +161,7 @@ type Props = {loadParentDirectoryContent: () => void,setLastSelectedEntry: (entryPath: string | null) => void,isReadOnlyMode: boolean,- showNotification: () => void,+ showNotification: (content: string) => void,openSearchPanel: () => void,maxSearchResults: number};@@ -316,7 +317,14 @@ class FolderContainer extends React.Component<Props, State> {};switchPerspective = (perspectiveId: string) => {- if (perspectiveId) {+ if (!Pro) {+ this.props.showNotification(i18n.t('core:needProVersion'));+ return;+ }+ this.setState({+ currentPerspective: this.state.currentPerspective === 'default' ? 'gallery' : 'default'+ });+ /* if (perspectiveId) {this.setState({currentPerspective: perspectiveId});@@ -324,7 +332,7 @@ class FolderContainer extends React.Component<Props, State> {this.setState({currentPerspective: 'default'});- }+ } */}togglePerspectiveChooserClose = (event?: Object) => {@@ -465,6 +473,7 @@ class FolderContainer extends React.Component<Props, State> {toggleCreateFileDialog={this.props.toggleCreateFileDialog}deleteDirectory={this.props.deleteDirectory}showNotification={this.props.showNotification}+ switchPerspective={this.switchPerspective}isReadOnlyMode={this.props.isReadOnlyMode}/></div>diff --git a/app/components/menus/DirectoryMenu.js b/app/components/menus/DirectoryMenu.jsindex 237a65b4b..3e5d4b84e 100644--- a/app/components/menus/DirectoryMenu.js+++ b/app/components/menus/DirectoryMenu.js@@ -31,6 +31,7 @@ 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 NewFileIcon from '@material-ui/icons/InsertDriveFile';import NewFolderIcon from '@material-ui/icons/CreateNewFolder';import RenameFolderIcon from '@material-ui/icons/FormatTextdirectionLToR';@@ -63,6 +64,7 @@ type Props = {loadParentDirectoryContent?: () => void,openFileNatively?: (path: string) => void,extractContent?: () => void,+ switchPerspective?: () => void,perspectiveMode: boolean,showNotification?: (text: string,@@ -104,6 +106,11 @@ const DirectoryMenu = (props: Props) => {props.extractContent();}+ function switchPerspective() {+ props.onClose();+ props.switchPerspective();+ }+function showDeleteDirectoryDialog() {props.onClose();setIsDeleteDirectoryDialogOpened(true);@@ -401,20 +408,26 @@ const DirectoryMenu = (props: Props) => {)}<Divider />{!props.isReadOnlyMode && (- <MenuItem data-tid="extractContent" onClick={initContentExtraction}>- <ListItemIcon>- <ContentExtractionIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:startContentExtraction')}- />- </MenuItem>+ <React.Fragment>+ <MenuItem data-tid="extractContent" onClick={switchPerspective} title="Start experimental presentation mode">+ <ListItemIcon>+ <GalleryPerspectiveIcon />+ </ListItemIcon>+ <ListItemText primary="Toggle Gallery Perspective" />+ </MenuItem>+ <MenuItem data-tid="extractContent" onClick={initContentExtraction}>+ <ListItemIcon>+ <ContentExtractionIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:startContentExtraction')} />+ </MenuItem>+ </React.Fragment>)}<MenuItem data-tid="showProperties" onClick={showProperties}><ListItemIcon><SettingsIcon /></ListItemIcon>- <ListItemText primary={i18n.t('core:directoryPropertiesTitle')}- />+ <ListItemText primary={i18n.t('core:directoryPropertiesTitle')} /></MenuItem></Menu><input