TagSpaces is an offline, open source, document manager with tagging support
cleaning from isManagementPanelVisible
Ilian Sapundshievdd98b7ecec0b
diff --git a/app/components/MobileNavigation.js b/app/components/MobileNavigation.jsnew file mode 100644index 000000000..749fd1dda--- /dev/null+++ b/app/components/MobileNavigation.js@@ -0,0 +1,344 @@+/**+ * 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 { connect } from 'react-redux';+import { bindActionCreators } from 'redux';+import uuidv1 from 'uuid';+import IconButton from '@material-ui/core/IconButton';+import NewFileIcon from '@material-ui/icons/Add';+import LocationsIcon from '@material-ui/icons/WorkOutline';+import TagLibraryIcon from '@material-ui/icons/LocalOfferOutlined';+import SearchIcon from '@material-ui/icons/SearchOutlined';+// import PerspectivesIcon from '@material-ui/icons/MapOutlined';+import SettingsIcon from '@material-ui/icons/Settings';+import ThemingIcon from '@material-ui/icons/InvertColors';+import UpgradeIcon from '@material-ui/icons/FlightTakeoff';+import HelpIcon from '@material-ui/icons/HelpOutline';+import { withTheme } from '@material-ui/core/styles';+import SplitPane from 'react-split-pane';+import LogoIcon from '../assets/images/icon100x100.svg';+import TagLibrary from '../components/TagLibrary';+import Search from '../components/Search';+import PerspectiveManager from '../components/PerspectiveManager';+import LocationManager from '../components/LocationManager';+import HelpFeedbackPanel from '../components/HelpFeedbackPanel';+import i18n from '../services/i18n';+import { Pro } from '../pro';+import { type Tag } from '../reducers/taglibrary';+import {+ actions as AppActions,+ getDirectoryPath,+ isSettingsDialogOpened,+ isLocationManagerPanelOpened,+ isTagLibraryPanelOpened,+ isSearchPanelOpened,+ isPerspectivesPanelOpened,+ isHelpFeedbackPanelOpened,+ isReadOnlyMode,+} from '../reducers/app';+import { actions as SettingsActions, isFirstRun } from '../reducers/settings';+import LoadingLazy from './LoadingLazy';++const ProTeaserDialog = React.lazy(() => import(/* webpackChunkName: "ProTeaserDialog" */ './dialogs/ProTeaserDialog'));+const ProTeaserDialogAsync = props => (+ <React.Suspense fallback={<LoadingLazy />}>+ <ProTeaserDialog {...props} />+ </React.Suspense>+);++type Props = {+ theme: Object,+ isFirstRun: boolean,+ setFirstRun: (isFirstRun: boolean) => void,+ toggleOnboardingDialog: () => void,+ toggleCreateFileDialog: () => void,+ toggleAboutDialog: () => void,+ toggleKeysDialog: () => void,+ toggleSettingsDialog: () => void,+ isSettingsDialogOpened: () => void,+ isLocationManagerPanelOpened: boolean,+ openLocationManagerPanel: () => void,+ isTagLibraryPanelOpened: boolean,+ openTagLibraryPanel: () => void,+ isSearchPanelOpened: boolean,+ openSearchPanel: () => void,+ isPerspectivesPanelOpened: boolean,+ openPerspectivesPanel: () => void,+ isHelpFeedbackPanelOpened: boolean,+ openHelpFeedbackPanel: () => void,+ closeAllVerticalPanels: () => void,+ openFileNatively: (url: string) => void,+ openURLExternally: (url: string) => void,+ switchTheme: () => void,+ shouldTogglePanel: string,+ isReadOnlyMode: boolean+};++type State = {+ isProTeaserVisible: boolean+};++class MobileNavigation extends React.Component<Props, State> {+ state = {+ isManagementPanelVisible: true,+ isProTeaserVisible: false+ };++ styles = {+ panel: {+ height: '100%',+ backgroundColor: '#2C001E' // 'rgb(89, 89, 89)' // '#00D1A1' // #008023+ },+ buttonIcon: {+ width: 28,+ height: 28,+ color: '#d6d6d6' // this.props.theme.palette.text.primary+ },+ button: {+ padding: 8,+ width: 44,+ height: 44+ },+ selectedButton: {+ borderRadius: 0,+ backgroundColor: '#880E4F'+ },+ settingsButton: {+ position: 'absolute',+ bottom: 0,+ left: 0+ },+ themingButton: {+ position: 'absolute',+ bottom: 45,+ left: 0+ },+ upgradeButton: {+ position: 'absolute',+ bottom: 90,+ left: 0+ }+ };++ toggleProTeaser = () => {+ this.setState({ isProTeaserVisible: !this.state.isProTeaserVisible });+ }++ render() {+ const {+ isFirstRun,+ isLocationManagerPanelOpened,+ isTagLibraryPanelOpened,+ isSearchPanelOpened,+ isSettingsDialogOpened,+ isPerspectivesPanelOpened,+ isHelpFeedbackPanelOpened,+ isReadOnlyMode,+ toggleCreateFileDialog,+ toggleAboutDialog,+ toggleOnboardingDialog,+ toggleSettingsDialog,+ toggleKeysDialog,+ openLocationManagerPanel,+ openTagLibraryPanel,+ openSearchPanel,+ openHelpFeedbackPanel,+ closeAllVerticalPanels,+ switchTheme,+ openFileNatively,+ openURLExternally,+ setFirstRun,+ theme+ } = this.props;+ return (+ <div>+ <style>+ {`+ #verticalNavButton:hover {+ border-radius: 0;+ background-color: #880E4F;+ }+ `}+ </style>+ <div style={this.styles.panel}>+ <IconButton+ onClick={toggleAboutDialog}+ style={{ ...this.styles.button, marginTop: 10, marginBottom: 16 }}+ title={i18n.t('core:aboutTitle')}+ data-tid="aboutTagSpaces"+ >+ <img+ style={{+ ...this.styles.buttonIcon,+ color: this.props.theme.palette.text.primary+ }}+ src={LogoIcon}+ alt="TagSpaces Logo"+ />+ </IconButton>+ { !isReadOnlyMode && (+ <IconButton+ id="verticalNavButton"+ onClick={toggleCreateFileDialog}+ style={{ ...this.styles.button, marginBottom: 20 }}+ title={i18n.t('core:createFileTitle')}+ data-tid="locationManager"+ >+ <NewFileIcon style={this.styles.buttonIcon} />+ </IconButton>+ )}+ <IconButton+ id="verticalNavButton"+ onClick={() => {+ if (isLocationManagerPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openLocationManagerPanel();+ }+ }}+ style={+ isLocationManagerPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ title={i18n.t('core:locationManager')}+ data-tid="locationManager"+ >+ <LocationsIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:tagGroupOperations')}+ data-tid="tagLibrary"+ onClick={() => {+ if (isTagLibraryPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openTagLibraryPanel();+ }+ }}+ style={+ isTagLibraryPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ >+ <TagLibraryIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:searchTitle')}+ data-tid="search"+ onClick={() => {+ if (isSearchPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openSearchPanel();+ }+ }}+ style={+ isSearchPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ >+ <SearchIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:settings')}+ data-tid="settings"+ onClick={toggleSettingsDialog}+ style={+ isSettingsDialogOpened+ ? {+ ...this.styles.button,+ ...this.styles.settingsButton,+ ...this.styles.selectedButton+ } : {+ ...this.styles.button,+ ...this.styles.settingsButton+ }+ }+ >+ <SettingsIcon style={this.styles.buttonIcon} />+ </IconButton>+ </div>+ { /*+ <div style={this.styles.panel}>+ <LocationManager style={{ display: isLocationManagerPanelOpened ? 'block' : 'none' }} />+ { isTagLibraryPanelOpened && <TagLibrary /> }+ <Search style={{ display: isSearchPanelOpened ? 'block' : 'none' }} />+ { isPerspectivesPanelOpened && <PerspectiveManager /> }+ { isHelpFeedbackPanelOpened &&+ <HelpFeedbackPanel+ openFileNatively={openFileNatively}+ openURLExternally={openURLExternally}+ toggleKeysDialog={toggleKeysDialog}+ toggleOnboardingDialog={toggleOnboardingDialog}+ toggleProTeaser={this.toggleProTeaser}+ /> }+ </div>+ */}+ </div>+ );+ }+}++function mapStateToProps(state) {+ return {+ isFirstRun: isFirstRun(state),+ isSettingsDialogOpened: isSettingsDialogOpened(state),+ isLocationManagerPanelOpened: isLocationManagerPanelOpened(state),+ isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),+ isSearchPanelOpened: isSearchPanelOpened(state),+ isPerspectivesPanelOpened: isPerspectivesPanelOpened(state),+ isHelpFeedbackPanelOpened: isHelpFeedbackPanelOpened(state),+ isReadOnlyMode: isReadOnlyMode(state)+ };+}++function mapActionCreatorsToProps(dispatch) {+ return bindActionCreators(+ {+ toggleCreateFileDialog: AppActions.toggleCreateFileDialog,+ toggleOnboardingDialog: AppActions.toggleOnboardingDialog,+ toggleSettingsDialog: AppActions.toggleSettingsDialog,+ toggleAboutDialog: AppActions.toggleAboutDialog,+ toggleKeysDialog: AppActions.toggleKeysDialog,+ openLocationManagerPanel: AppActions.openLocationManagerPanel,+ openTagLibraryPanel: AppActions.openTagLibraryPanel,+ openSearchPanel: AppActions.openSearchPanel,+ openPerspectivesPanel: AppActions.openPerspectivesPanel,+ openHelpFeedbackPanel: AppActions.openHelpFeedbackPanel,+ openFileNatively: AppActions.openFileNatively,+ openURLExternally: AppActions.openURLExternally,+ closeAllVerticalPanels: AppActions.closeAllVerticalPanels,+ switchTheme: SettingsActions.switchTheme,+ setFirstRun: SettingsActions.setFirstRun,+ },+ dispatch+ );+}++export default connect(+ mapStateToProps,+ mapActionCreatorsToProps+)(withTheme(MobileNavigation));diff --git a/app/components/VerticalNavigation.js b/app/components/VerticalNavigation.jsindex 1ef3068cd..99ffda972 100644--- a/app/components/VerticalNavigation.js+++ b/app/components/VerticalNavigation.js@@ -73,7 +73,6 @@ type Props = {toggleKeysDialog: () => void,toggleSettingsDialog: () => void,isSettingsDialogOpened: () => void,- setManagementPanelVisibility: boolean => void,isLocationManagerPanelOpened: boolean,openLocationManagerPanel: () => void,isTagLibraryPanelOpened: boolean,@@ -93,13 +92,11 @@ type Props = {};type State = {- isManagementPanelVisible?: boolean, // evtl. redux migration- isProTeaserVisible: boolean+ isProTeaserVisible: boolean // evtl. redux migration};class VerticalNavigation extends React.Component<Props, State> {state = {- isManagementPanelVisible: true,isProTeaserVisible: false};@@ -164,7 +161,6 @@ class VerticalNavigation extends React.Component<Props, State> {openHelpFeedbackPanel,closeAllVerticalPanels,switchTheme,- setManagementPanelVisibility,openFileNatively,openURLExternally,setFirstRun,@@ -361,23 +357,21 @@ class VerticalNavigation extends React.Component<Props, State> {<SettingsIcon style={this.styles.buttonIcon} /></IconButton></div>- {this.state.isManagementPanelVisible && (- <div style={this.styles.panel}>- <LocationManager style={{ display: isLocationManagerPanelOpened ? 'block' : 'none' }} />- { isTagLibraryPanelOpened && <TagLibrary /> }- <Search style={{ display: isSearchPanelOpened ? 'block' : 'none' }} />- { isPerspectivesPanelOpened && <PerspectiveManager /> }- { isHelpFeedbackPanelOpened &&- <HelpFeedbackPanel- openFileNatively={openFileNatively}- openURLExternally={openURLExternally}- toggleAboutDialog={toggleAboutDialog}- toggleKeysDialog={toggleKeysDialog}- toggleOnboardingDialog={toggleOnboardingDialog}- toggleProTeaser={this.toggleProTeaser}- /> }- </div>- )}+ <div style={this.styles.panel}>+ <LocationManager style={{ display: isLocationManagerPanelOpened ? 'block' : 'none' }} />+ { isTagLibraryPanelOpened && <TagLibrary /> }+ <Search style={{ display: isSearchPanelOpened ? 'block' : 'none' }} />+ { isPerspectivesPanelOpened && <PerspectiveManager /> }+ { isHelpFeedbackPanelOpened &&+ <HelpFeedbackPanel+ openFileNatively={openFileNatively}+ openURLExternally={openURLExternally}+ toggleAboutDialog={toggleAboutDialog}+ toggleKeysDialog={toggleKeysDialog}+ toggleOnboardingDialog={toggleOnboardingDialog}+ toggleProTeaser={this.toggleProTeaser}+ /> }+ </div></SplitPane></div>);