TagSpaces is an offline, open source, document manager with tagging support
Improving navigation to parent folder #1038
Ilian Sapundshiev330c380ed3f7
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.jsindex 9a857f8eb..6a7733560 100644--- a/app/components/FolderContainer.js+++ b/app/components/FolderContainer.js@@ -21,8 +21,8 @@ import React from 'react';import { connect } from 'react-redux';import { bindActionCreators } from 'redux';import Button from '@material-ui/core/Button';-// import FolderSeparatorIcon from '@material-ui/icons/KeyboardArrowRight';import MoreVertIcon from '@material-ui/icons/MoreVert';+import BackButtonIcon from '@material-ui/icons/ArrowBack';import MenuIcon from '@material-ui/icons/Menu';import Badge from '@material-ui/core/Badge';import { withStyles } from '@material-ui/core/styles';@@ -425,7 +425,8 @@ class FolderContainer extends React.Component<Props, State> {maxSearchResults,openSearchPanel,toggleDrawer,- isDesktopMode+ isDesktopMode,+ loadParentDirectoryContent} = this.props;const normalizedCurrentDirPath = normalizePath(currentDirectoryPath.split('\\').join('/'));let searchResultCounterText = searchResultCount + ' ' + i18n.t('entries');@@ -456,8 +457,8 @@ class FolderContainer extends React.Component<Props, State> {/><div className={classes.flexMiddle} />{currentDirectoryPath && (- <div>- {this.state.pathParts &&+ <React.Fragment>+ {isDesktopMode && this.state.pathParts &&this.state.pathParts.map(pathPart => (<Buttonkey={pathPart}@@ -469,6 +470,17 @@ class FolderContainer extends React.Component<Props, State> { / </Button>))}+ {!isDesktopMode && this.state.pathParts && this.state.pathParts.length > 0 && (+ <React.Fragment>+ <Button+ onClick={loadParentDirectoryContent}+ data-tid="openParentDirectory"+ style={{ paddingLeft: 3, paddingRight: 0}}+ >+ <BackButtonIcon />+ </Button>+ </React.Fragment>+ )}<Buttondata-tid="folderContainerOpenDirMenu"title={@@ -493,7 +505,7 @@ class FolderContainer extends React.Component<Props, State> {loadDirectoryContent={this.props.loadDirectoryContent}openFileNatively={this.props.openFileNatively}openDirectory={this.props.openDirectory}- loadParentDirectoryContent={this.props.loadParentDirectoryContent}+ loadParentDirectoryContent={loadParentDirectoryContent}showInFileManager={this.props.showInFileManager}reflectCreateEntry={this.props.reflectCreateEntry}openFile={this.props.openFile}@@ -503,7 +515,7 @@ class FolderContainer extends React.Component<Props, State> {switchPerspective={this.switchPerspective}isReadOnlyMode={this.props.isReadOnlyMode}/>- </div>+ </React.Fragment>)}</div></div>diff --git a/app/components/LocationManager.js b/app/components/LocationManager.jsindex 561045cf4..384161d3a 100644--- a/app/components/LocationManager.js+++ b/app/components/LocationManager.js@@ -456,12 +456,12 @@ class LocationManager extends React.Component<Props, State> {this.props.openLocation(location);this.state.locationRootPath = location.paths[0];}- const grid = document.querySelector('[data-tid="perspectiveGridFileTable"]');- const firstGridItem = grid.querySelector('div');- if (isObj(firstGridItem)) {- firstGridItem.parentNode.scrollTop = target.offsetTop;- }+ // const grid = document.querySelector('[data-tid="perspectiveGridFileTable"]');+ // const firstGridItem = grid.querySelector('div');+ // if (isObj(firstGridItem)) {+ // firstGridItem.parentNode.scrollTop = target.offsetTop;+ // }};reloadDirectory = () => {diff --git a/app/components/menus/DirectoryMenu.js b/app/components/menus/DirectoryMenu.jsindex ff1f32f0f..ede61ab1d 100644--- a/app/components/menus/DirectoryMenu.js+++ b/app/components/menus/DirectoryMenu.js@@ -26,7 +26,7 @@ import ListItemText from '@material-ui/core/ListItemText';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 ContentExtractionIcon from '@material-ui/icons/TrackChanges';import OpenFolderIcon from '@material-ui/icons/SubdirectoryArrowLeft';import AddExistingFileIcon from '@material-ui/icons/ExitToApp';import OpenFolderNativelyIcon from '@material-ui/icons/Launch';@@ -52,21 +52,17 @@ import { actions as AppActions } from '../../reducers/app';import IOActions from '../../reducers/io-actions';type Props = {- classes: Object,open: boolean,onClose: () => void,anchorEl: Object | null,directoryPath: string,loadDirectoryContent: (path: string) => void,openDirectory: (path: string) => void,- showInFileManager: (path: string) => void,openFile: (path: string, isFile: boolean) => void,deleteDirectory: (path: string) => void,reflectCreateEntry: (path: string, isFile: boolean) => void,toggleCreateFileDialog: () => void,- loadParentDirectoryContent: () => void,- openFileNatively: (path: string) => void,- extractContent: (config: Object) => void,+ // extractContent: (config: Object) => void,switchPerspective: (perspectiveId: string) => void,perspectiveMode: boolean,showNotification: (@@ -89,11 +85,6 @@ const DirectoryMenu = (props: Props) => {props.loadDirectoryContent(props.directoryPath);}- function openParentDirectory() {- props.onClose();- props.loadParentDirectoryContent();- }-function openDirectory() {props.onClose();props.loadDirectoryContent(props.directoryPath);@@ -104,10 +95,10 @@ const DirectoryMenu = (props: Props) => {props.openFile(props.directoryPath, false);}- function initContentExtraction() {- props.onClose();- props.extractContent({ EXIFGeo: true });- }+ // function initContentExtraction() {+ // props.onClose();+ // props.extractContent({ EXIFGeo: true });+ // }function switchPerspective(perspectiveId) {props.onClose();@@ -189,13 +180,13 @@ const DirectoryMenu = (props: Props) => {});}- function loadImageLocal() {- props.onClose();- navigator.camera.getPicture(onCameraSuccess, onFail, {- destinationType: Camera.DestinationType.FILE_URI,- sourceType: Camera.PictureSourceType.PHOTOLIBRARY- });- }+ // function loadImageLocal() {+ // props.onClose();+ // navigator.camera.getPicture(onCameraSuccess, onFail, {+ // destinationType: Camera.DestinationType.FILE_URI,+ // sourceType: Camera.PictureSourceType.PHOTOLIBRARY+ // });+ // }function cameraTakePicture() {props.onClose();@@ -319,17 +310,6 @@ const DirectoryMenu = (props: Props) => {<ListItemText primary={i18n.t('core:openDirectory')} /></MenuItem>)}- {/* {!props.perspectiveMode && (- <MenuItem- data-tid="openParentDirectory"- onClick={openParentDirectory}- >- <ListItemIcon>- <OpenFolderIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:openParentDirectory')} />- </MenuItem>- )} */}{!props.perspectiveMode && (<MenuItem data-tid="reloadDirectory" onClick={reloadDirectory}><ListItemIcon>diff --git a/app/perspectives/grid-perspective/components/MainContainer.js b/app/perspectives/grid-perspective/components/MainContainer.jsindex ededed4ed..016530702 100644--- a/app/perspectives/grid-perspective/components/MainContainer.js+++ b/app/perspectives/grid-perspective/components/MainContainer.js@@ -55,7 +55,8 @@ import {} from '../../../services/utils-io';import { type Tag } from '../../../reducers/taglibrary';import {- getSupportedFileTypes+ getSupportedFileTypes,+ getDesktopMode,} from '../../../reducers/settings';import {sortByCriteria,@@ -93,6 +94,7 @@ const settings = JSON.parse(localStorage.getItem('tsPerspectiveGrid')); // loaditype Props = {classes: Object,theme: Object,+ desktopMode: boolean,currentDirectoryPath: string,currentDirectoryColor: string,lastSelectedEntryPath: string | null,@@ -639,7 +641,8 @@ class GridPerspective extends React.Component<Props, State> {directoryContent,currentDirectoryColor,selectedEntries,- theme+ theme,+ desktopMode} = this.props;const { layoutType, entrySize, sortBy, orderBy } = this.state;const selectedFilePaths = selectedEntries.filter(fsEntry => fsEntry.isFile).map(fsentry => fsentry.path);@@ -678,14 +681,16 @@ class GridPerspective extends React.Component<Props, State> {<DeSelectAllIcon />)}</IconButton>- {/* <IconButton- title={i18n.t('core:navigateToParentDirectory')}- aria-label={i18n.t('core:navigateToParentDirectory')}- data-tid="gridPerspectiveOnBackButton"- onClick={this.props.loadParentDirectoryContent}- >- <ParentDirIcon />- </IconButton> */}+ {/* { desktopMode && (+ <IconButton+ title={i18n.t('core:navigateToParentDirectory')}+ aria-label={i18n.t('core:navigateToParentDirectory')}+ data-tid="gridPerspectiveOnBackButton"+ onClick={this.props.loadParentDirectoryContent}+ >+ <ParentDirIcon />+ </IconButton>+ )} */}{this.state.layoutType === 'row' ? (<IconButtontitle={i18n.t('core:switchToGridView')}@@ -1073,7 +1078,7 @@ function mapActionCreatorsToProps(dispatch) {showNotification: AppActions.showNotification,openFileNatively: AppActions.openFileNatively,openURLExternally: AppActions.openURLExternally,- addTags: TaggingActions.addTags+ addTags: TaggingActions.addTags,}, dispatch);}@@ -1084,6 +1089,7 @@ function mapStateToProps(state) {isReadOnlyMode: isReadOnlyMode(state),lastSelectedEntryPath: getLastSelectedEntry(state),currentDirectoryColor: getCurrentDirectoryColor(state),+ desktopMode: getDesktopMode(state),selectedEntries: getSelectedEntries(state)};}