TagSpaces is an offline, open source, document manager with tagging support
TSN375 add menu to search manager
Mladen Sapundshievc775360547b7
diff --git a/app/components/Search.js b/app/components/Search.jsindex eb071e450..f19cb12e1 100644--- a/app/components/Search.js+++ b/app/components/Search.js@@ -48,6 +48,7 @@ import InputAdornment from '@material-ui/core/InputAdornment';import IconButton from '@material-ui/core/IconButton';import Select from '@material-ui/core/Select';import FormControl from '@material-ui/core/FormControl';+import MoreVertIcon from '@material-ui/icons/MoreVert';import TagsSelect from './TagsSelect';import CustomLogo from './CustomLogo';import { actions as AppActions, getDirectoryPath } from '../reducers/app';@@ -57,6 +58,7 @@ import styles from './SidePanels.css';import i18n from '../services/i18n';import { FileTypeGroups, type SearchQuery } from '../services/search';import { Pro } from '../pro';+import SearchMenu from './menus/SearchMenu';import type { Tag } from '../reducers/taglibrary';import ocl from '../utils/openlocationcode';import {@@ -98,7 +100,8 @@ type State = {tagPlaceLat: number | null,tagPlaceLong: number | null,tagPlaceRadius: number,- fileSize: string+ fileSize: string,+ isSearchMenuOpened: boolean};class Search extends React.Component<Props, State> {@@ -119,7 +122,8 @@ class Search extends React.Component<Props, State> {tagPlaceLat: null,tagPlaceLong: null,tagPlaceRadius: 0,- fileSize: ''+ fileSize: '',+ isSearchMenuOpened: false};handleInputChange = event => {@@ -262,7 +266,11 @@ class Search extends React.Component<Props, State> {};console.log('Search object: ' + JSON.stringify(searchQuery));this.props.searchLocationIndex(searchQuery);- };+ };++ handleSearchMenu = (event: Object) => {+ this.setState({isSearchMenuOpened: true })+ };render() {const { classes, indexing, indexedEntriesCount } = this.props;@@ -270,7 +278,7 @@ class Search extends React.Component<Props, State> {<div className={classes.panel} style={this.props.style}><CustomLogo /><div className={classes.toolbar}>- <Typography className={classNames(classes.panelTitle, classes.header)} style={{ flex: 'none' }}>+ <Typography className={classNames(classes.panelTitle, classes.header)}>{i18n.t('searchTitle')}</Typography><Typography variant="caption" className={classes.header} style={{ alignSelf: 'flex-end', paddingLeft: 5, display: 'block' }}>@@ -282,7 +290,17 @@ class Search extends React.Component<Props, State> {><HelpIcon /></IconButton> */}+ <IconButton+ data-tid="searchMenu"+ onClick={this.handleSearchMenu}+ >+ <MoreVertIcon />+ </IconButton></div>+ <SearchMenu+ open={this.state.isSearchMenuOpened}+ onClose={this.handleCloseImportExportMenu}+ /><div className={classes.searchArea}><FormControlclassName={classes.formControl}diff --git a/app/components/menus/SearchMenu.js b/app/components/menus/SearchMenu.jsnew file mode 100644index 000000000..8efd4bcad--- /dev/null+++ b/app/components/menus/SearchMenu.js@@ -0,0 +1,68 @@+/**+ * 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: (path: string) => void,+};++const SearchMenu = (props: Props) => {+ let anchorEl;+ const {+ open = false,+ onClose+ } = props;++ return (+ <div style={{ overflowY: 'hidden !important' }}>+ <Menu+ anchorEl={anchorEl}+ open={open}+ onClose={onClose}+ >+ <MenuItem+ data-tid="taglibraryHelp"+ onClick={() => {+ props.onClose();+ props.openURLExternally(AppConfig.documentationLinks.search)+ }}+ >+ <ListItemIcon>+ <HelpIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:help')} />+ </MenuItem>+ </Menu>+ </div>+ );+};++export default SearchMenu;