TagSpaces is an offline, open source, document manager with tagging support
TSN375 add Location Manager menu
Mladen Sapundshiev94a8b80fb7d7
diff --git a/app/components/LocationManager.js b/app/components/LocationManager.jsindex 06fa54a22..93b9a83a1 100644--- a/app/components/LocationManager.js+++ b/app/components/LocationManager.js@@ -48,6 +48,7 @@ import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward';import OpenFolderNativelyIcon from '@material-ui/icons/Launch';import styles from './SidePanels.css';import DirectoryMenu from './menus/DirectoryMenu';+import LocationManagerMenu from './menus/LocationManagerMenu';import EditLocationDialog from './dialogs/EditLocationDialog';import CreateLocationDialog from './dialogs/CreateLocationDialog';import ConfirmDialog from './dialogs/ConfirmDialog';@@ -80,6 +81,7 @@ type Props = {currentLocationId: string,isReadOnlyMode: boolean,hideDrawer?: () => void,+ openURLExternally: (path: string) => void,loadDirectoryContent: (path: string) => void,openLocation: (location: Location) => void,openFileNatively: (path: string) => void,@@ -117,7 +119,9 @@ type State = {isSelectDirectoryDialogOpened?: boolean,isCreateDirectoryDialogOpened?: boolean,createLocationDialogKey: string,- isCreateDirectoryDialogOpened?: boolean,+ isCreateDirectoryDialogOpened?: boolean,+ locationManagerMenuOpened: boolean,+ locationManagerMenuAnchorEl: Object | null,dirs?: Object};@@ -142,7 +146,9 @@ class LocationManager extends React.Component<Props, State> {isEditLocationDialogOpened: false,isDeleteLocationDialogOpened: false,isCreateDirectoryDialogOpened: false,- isSelectDirectoryDialogOpened: false,+ isSelectDirectoryDialogOpened: false,+ locationManagerMenuOpened: false,+ locationManagerMenuAnchorEl: null,createLocationDialogKey: uuidv1(),editLocationDialogKey: uuidv1(),dirs: {}@@ -364,7 +370,6 @@ class LocationManager extends React.Component<Props, State> {}};-showEditLocationDialog = () => {this.handleRequestCloseContextMenus();this.setState({ isEditLocationDialogOpened: true });@@ -650,6 +655,17 @@ class LocationManager extends React.Component<Props, State> {{table}</div>);+ };++ handleLocationManagerMenu = (event: Object) => {+ this.setState({+ locationManagerMenuOpened: true,+ locationManagerMenuAnchorEl: event.currentTarget+ });+ };++ handleCloseLocationManagerMenu = () => {+ this.setState({ locationManagerMenuOpened: false});};render() {@@ -661,7 +677,19 @@ class LocationManager extends React.Component<Props, State> {<Typography className={classNames(classes.panelTitle, classes.header)} type="subtitle1">{i18n.t('core:locationManager')}</Typography>+ <IconButton+ data-tid="locationManagerMenu"+ onClick={this.handleLocationManagerMenu}+ >+ <MoreVertIcon />+ </IconButton></div>+ <LocationManagerMenu+ anchorEl={this.state.locationManagerMenuAnchorEl}+ open={this.state.locationManagerMenuOpened}+ onClose={this.handleCloseLocationManagerMenu}+ openURLExternally={this.props.openURLExternally}+ />{!isLocationsReadOnly && (<div style={{ width: '100%', textAlign: 'center', marginBottom: 10 }}><Button@@ -853,7 +881,8 @@ function mapDispatchToProps(dispatch) {openFileNatively: AppActions.openFileNatively,openFile: AppActions.openFile,showNotification: AppActions.showNotification,- moveFiles: IOActions.moveFiles+ moveFiles: IOActions.moveFiles,+ openURLExternally: AppActions.openURLExternally,}, dispatch);}diff --git a/app/components/menus/LocationManagerMenu.js b/app/components/menus/LocationManagerMenu.jsnew file mode 100644index 000000000..d93aec2c4--- /dev/null+++ b/app/components/menus/LocationManagerMenu.js@@ -0,0 +1,63 @@+/**+ * 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/>.+ *+ * @flow+ */++import React from 'react';+import ListItemText from '@material-ui/core/ListItemText';+import ListItemIcon from '@material-ui/core/ListItemIcon';+import Menu from '@material-ui/core/Menu';+import MenuItem from '@material-ui/core/MenuItem';+import HelpIcon from '@material-ui/icons/Help';+import i18n from '../../services/i18n';+import AppConfig from '../../config';++type Props = {+ classes: Object,+ open: boolean,+ anchorEl: Object,+ onClose: () => void,+ openURLExternally: (url: string) => void,+};++const LocationManagerMenu = (props: Props) => {++ return (+ <div style={{ overflowY: 'hidden !important' }}>+ <Menu+ anchorEl={props.anchorEl}+ open={props.open}+ onClose={props.onClose}+ >+ <MenuItem+ data-tid="locationManagerMenu"+ onClick={() => {+ props.onClose();+ props.openURLExternally(AppConfig.documentationLinks.locations)+ }}+ >+ <ListItemIcon>+ <HelpIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:help')} />+ </MenuItem>+ </Menu>+ </div>+ );+};++export default LocationManagerMenu;\ No newline at end of file