TagSpaces is an offline, open source, document manager with tagging support
added upgrade button. cleaning up css
Ilian Sapundshieva24641d2a9b4
diff --git a/app/components/VerticalNavigation.css b/app/components/VerticalNavigation.cssdeleted file mode 100644index 3df61fd53..000000000--- a/app/components/VerticalNavigation.css+++ /dev/null@@ -1,4 +0,0 @@-.verticalNavButton:hover {- border-radius: 0;- background-color: #880E4F;-}diff --git a/app/components/VerticalNavigation.js b/app/components/VerticalNavigation.jsindex 4a3c2a6fe..8527e9433 100644--- a/app/components/VerticalNavigation.js+++ b/app/components/VerticalNavigation.js@@ -29,6 +29,7 @@ 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'; // Palette+import UpgradeIcon from '@material-ui/icons/FlightTakeoff'; // Paletteimport { withTheme } from '@material-ui/core/styles';import SplitPane from 'react-split-pane';import LogoIcon from '../assets/images/icon100x100.svg';@@ -44,8 +45,9 @@ import TagLibrary from '../components/TagLibrary';import Search from '../components/Search';import PerspectiveManager from '../components/PerspectiveManager';import LocationManager from '../components/LocationManager';-import style from './VerticalNavigation.css';import i18n from '../services/i18n';+import PlatformIO from '../services/platform-io';+import { Pro } from '../pro';import {actions as AppActions,getDirectoryPath,@@ -56,12 +58,9 @@ import {isSettingsDialogOpened,isCreateFileDialogOpened,isCreateDirectoryOpened,- isSelectDirectoryDialogOpened,+ isSelectDirectoryDialogOpened} from '../reducers/app';-import {- actions as SettingActions,-} from '../reducers/settings';-+import { actions as SettingActions } from '../reducers/settings';export const AppVerticalPanels = {tagLibrary: 'tagLibrary',@@ -111,7 +110,7 @@ class VerticalNavigation extends React.Component<Props, State> {isSearchVisible: false,isPerspectiveManagerVisible: false,isManagementPanelVisible: true,- CreateFileDialogKey: uuidv1(),+ CreateFileDialogKey: uuidv1()};componentWillReceiveProps(nextProps: Props) {@@ -151,6 +150,11 @@ class VerticalNavigation extends React.Component<Props, State> {position: 'absolute',bottom: 45,left: 0+ },+ upgradeButton: {+ position: 'absolute',+ bottom: 90,+ left: 0}};@@ -167,58 +171,58 @@ class VerticalNavigation extends React.Component<Props, State> {togglePanel = panelName => {switch (panelName) {- case AppVerticalPanels.locationManager:- this.props.setManagementPanelVisibility(- !this.state.isLocationManagerVisible- );- this.setState({- isLocationManagerVisible: !this.state.isLocationManagerVisible,- isTagLibraryVisible: false,- isSearchVisible: false,- isPerspectiveManagerVisible: false,- });- break;- case AppVerticalPanels.tagLibrary:- this.props.setManagementPanelVisibility(- !this.state.isTagLibraryVisible- );- this.setState({- isLocationManagerVisible: false,- isTagLibraryVisible: !this.state.isTagLibraryVisible,- isSearchVisible: false,- isPerspectiveManagerVisible: false,- });- break;- case AppVerticalPanels.search:- this.props.setManagementPanelVisibility(!this.state.isSearchVisible);- this.setState({- isLocationManagerVisible: false,- isTagLibraryVisible: false,- isSearchVisible: !this.state.isSearchVisible,- isPerspectiveManagerVisible: false,- });- break;- case AppVerticalPanels.perspectiveManager:- this.props.setManagementPanelVisibility(- !this.state.isPerspectiveManagerVisible- );- this.setState({- isLocationManagerVisible: false,- isTagLibraryVisible: false,- isSearchVisible: false,- isPerspectiveManagerVisible: true,- });- break;- default:- // this.props.setManagementPanelVisibility(false);- // this.setState({- // isLocationManagerVisible: false,- // isTagLibraryVisible: false,- // isSearchVisible: false,- // isPerspectiveManagerVisible: false,- // isSettingsVisible: false- // });- break;+ case AppVerticalPanels.locationManager:+ this.props.setManagementPanelVisibility(+ !this.state.isLocationManagerVisible+ );+ this.setState({+ isLocationManagerVisible: !this.state.isLocationManagerVisible,+ isTagLibraryVisible: false,+ isSearchVisible: false,+ isPerspectiveManagerVisible: false+ });+ break;+ case AppVerticalPanels.tagLibrary:+ this.props.setManagementPanelVisibility(+ !this.state.isTagLibraryVisible+ );+ this.setState({+ isLocationManagerVisible: false,+ isTagLibraryVisible: !this.state.isTagLibraryVisible,+ isSearchVisible: false,+ isPerspectiveManagerVisible: false+ });+ break;+ case AppVerticalPanels.search:+ this.props.setManagementPanelVisibility(!this.state.isSearchVisible);+ this.setState({+ isLocationManagerVisible: false,+ isTagLibraryVisible: false,+ isSearchVisible: !this.state.isSearchVisible,+ isPerspectiveManagerVisible: false+ });+ break;+ case AppVerticalPanels.perspectiveManager:+ this.props.setManagementPanelVisibility(+ !this.state.isPerspectiveManagerVisible+ );+ this.setState({+ isLocationManagerVisible: false,+ isTagLibraryVisible: false,+ isSearchVisible: false,+ isPerspectiveManagerVisible: true+ });+ break;+ default:+ // this.props.setManagementPanelVisibility(false);+ // this.setState({+ // isLocationManagerVisible: false,+ // isTagLibraryVisible: false,+ // isSearchVisible: false,+ // isPerspectiveManagerVisible: false,+ // isSettingsVisible: false+ // });+ break;}};@@ -228,7 +232,7 @@ class VerticalNavigation extends React.Component<Props, State> {});};- resetState = (dialogKey) => {+ resetState = dialogKey => {this.setState({[dialogKey]: uuidv1()});@@ -237,6 +241,14 @@ class VerticalNavigation extends React.Component<Props, State> {render() {return (<div>+ <style>+ {`+ #verticalNavButton:hover {+ border-radius: 0;+ background-color: #880E4F;+ }+ `}+ </style><CreateDirectoryDialogopen={this.props.isCreateDirectoryOpened}onClose={this.props.toggleCreateDirectoryDialog}@@ -268,7 +280,9 @@ class VerticalNavigation extends React.Component<Props, State> {key={this.state.CreateFileDialogKey}resetState={this.resetState}open={this.props.isCreateFileDialogOpened}- selectedDirectoryPath={this.state.selectedDirectoryPath || this.props.currentDirectory}+ selectedDirectoryPath={+ this.state.selectedDirectoryPath || this.props.currentDirectory+ }chooseDirectoryPath={this.chooseDirectoryPath}onClose={this.props.toggleCreateFileDialog}/>@@ -276,7 +290,9 @@ class VerticalNavigation extends React.Component<Props, State> {open={this.props.isSelectDirectoryDialogOpened}onClose={this.props.toggleSelectDirectoryDialog}chooseDirectoryPath={this.chooseDirectoryPath}- selectedDirectoryPath={this.state.selectedDirectoryPath || this.props.currentDirectory}+ selectedDirectoryPath={+ this.state.selectedDirectoryPath || this.props.currentDirectory+ }/><SplitPanesplit="vertical"@@ -287,7 +303,6 @@ class VerticalNavigation extends React.Component<Props, State> {><div style={this.styles.panel}><IconButton- className={style.verticalNavButton}onClick={this.props.toggleAboutDialog}style={{ ...this.styles.button, marginTop: 10, marginBottom: 10 }}title={i18n.t('core:aboutTitle')}@@ -303,7 +318,7 @@ class VerticalNavigation extends React.Component<Props, State> {/></IconButton><IconButton- className={style.verticalNavButton}+ id="verticalNavButton"onClick={this.props.toggleCreateFileDialog}style={{ ...this.styles.button, marginBottom: 20 }}title={i18n.t('core:createFileTitle')}@@ -312,7 +327,7 @@ class VerticalNavigation extends React.Component<Props, State> {<NewFileIcon style={this.styles.buttonIcon} /></IconButton><IconButton- className={style.verticalNavButton}+ id="verticalNavButton"onClick={() => {this.togglePanel(AppVerticalPanels.locationManager);}}@@ -327,9 +342,9 @@ class VerticalNavigation extends React.Component<Props, State> {<LocationsIcon style={this.styles.buttonIcon} /></IconButton><IconButton+ id="verticalNavButton"title={i18n.t('core:tagGroupOperations')}data-tid="tagLibrary"- className={style.verticalNavButton}onClick={() => {this.togglePanel(AppVerticalPanels.tagLibrary);}}@@ -342,9 +357,9 @@ class VerticalNavigation extends React.Component<Props, State> {<TagLibraryIcon style={this.styles.buttonIcon} /></IconButton><IconButton+ id="verticalNavButton"title={i18n.t('core:searchTitle')}data-tid="search"- className={style.verticalNavButton}onClick={() => {this.togglePanel(AppVerticalPanels.search);}}@@ -356,10 +371,9 @@ class VerticalNavigation extends React.Component<Props, State> {><SearchIcon style={this.styles.buttonIcon} /></IconButton>- { /* <IconButton+ {/* <IconButtontitle={i18n.t('core:perspectiveManager')}data-tid="perspectiveManager"- className={style.verticalNavButton}onClick={() => {this.togglePanel(AppVerticalPanels.perspectiveManager);}}@@ -371,22 +385,44 @@ class VerticalNavigation extends React.Component<Props, State> {}><PerspectivesIcon style={this.styles.buttonIcon} />- </IconButton> */ }+ </IconButton> */}+ {!Pro && (+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:upgradeToPro')}+ data-tid="upgradeToPro"+ onClick={() => {+ PlatformIO.openUrl('https://www.tagspaces.org/products/');+ }}+ style={{ ...this.styles.button, ...this.styles.upgradeButton }}+ >+ <UpgradeIcon style={this.styles.buttonIcon} />+ </IconButton>+ )}+<IconButton+ id="verticalNavButton"title={i18n.t('core:switchTheme')}data-tid="switchTheme"- className={style.verticalNavButton}onClick={this.props.switchTheme}- style={this.state.isSettingsDialogOpened ? { ...this.styles.button, ...this.styles.themingButton, ...this.styles.selectedButton } : { ...this.styles.button, ...this.styles.themingButton }}+ style={{ ...this.styles.button, ...this.styles.themingButton }}><ThemingIcon style={this.styles.buttonIcon} /></IconButton><IconButton+ id="verticalNavButton"title={i18n.t('core:settings')}data-tid="settings"- className={style.verticalNavButton}onClick={this.props.toggleSettingsDialog}- style={this.state.isSettingsDialogOpened ? { ...this.styles.button, ...this.styles.settingsButton, ...this.styles.selectedButton } : { ...this.styles.button, ...this.styles.settingsButton }}+ style={+ this.state.isSettingsDialogOpened+ ? {+ ...this.styles.button,+ ...this.styles.settingsButton,+ ...this.styles.selectedButton+ }+ : { ...this.styles.button, ...this.styles.settingsButton }+ }><SettingsIcon style={this.styles.buttonIcon} /></IconButton>@@ -435,24 +471,28 @@ function mapStateToProps(state) {isCreateDirectoryOpened: isCreateDirectoryOpened(state),isCreateFileDialogOpened: isCreateFileDialogOpened(state),isSelectDirectoryDialogOpened: isSelectDirectoryDialogOpened(state),- currentDirectory: getDirectoryPath(state),+ currentDirectory: getDirectoryPath(state)};}function mapActionCreatorsToProps(dispatch) {- return bindActionCreators({- toggleCreateDirectoryDialog: AppActions.toggleCreateDirectoryDialog,- toggleCreateFileDialog: AppActions.toggleCreateFileDialog,- toggleSelectDirectoryDialog: AppActions.toggleSelectDirectoryDialog,- toggleSettingsDialog: AppActions.toggleSettingsDialog,- toggleKeysDialog: AppActions.toggleKeysDialog,- toggleLicenseDialog: AppActions.toggleLicenseDialog,- toggleThirdPartyLibsDialog: AppActions.toggleThirdPartyLibsDialog,- toggleAboutDialog: AppActions.toggleAboutDialog,- switchTheme: SettingActions.switchTheme,- }, dispatch);+ return bindActionCreators(+ {+ toggleCreateDirectoryDialog: AppActions.toggleCreateDirectoryDialog,+ toggleCreateFileDialog: AppActions.toggleCreateFileDialog,+ toggleSelectDirectoryDialog: AppActions.toggleSelectDirectoryDialog,+ toggleSettingsDialog: AppActions.toggleSettingsDialog,+ toggleKeysDialog: AppActions.toggleKeysDialog,+ toggleLicenseDialog: AppActions.toggleLicenseDialog,+ toggleThirdPartyLibsDialog: AppActions.toggleThirdPartyLibsDialog,+ toggleAboutDialog: AppActions.toggleAboutDialog,+ switchTheme: SettingActions.switchTheme+ },+ dispatch+ );}-export default connect(mapStateToProps, mapActionCreatorsToProps)(- withTheme()(VerticalNavigation)-);+export default connect(+ mapStateToProps,+ mapActionCreatorsToProps+)(withTheme()(VerticalNavigation));diff --git a/app/components/dialogs/AboutDialog.js b/app/components/dialogs/AboutDialog.jsindex 312b00025..63985c661 100644--- a/app/components/dialogs/AboutDialog.js+++ b/app/components/dialogs/AboutDialog.js@@ -59,31 +59,35 @@ class AboutDialog extends React.Component<Props, State> {state = {updateAvailable: false,newVersion: ''- }+ };checkForUpdates = () => {if (this.state.updateAvailable) {PlatformIO.openUrl(AppConfig.downloadURL);} else {- getLastVersionPromise().then((lastVersion) => {- console.log('Last version on server: ' + lastVersion);- const cleanedLastVersion = semver.coerce(lastVersion);- // const cleanedCurrentVersion = '3.0.2'- const cleanedCurrentVersion = semver.coerce(versionMeta.version);- if (semver.valid(cleanedLastVersion) && semver.gt(cleanedLastVersion, cleanedCurrentVersion)) {- this.setState({- updateAvailable: true,- newVersion: cleanedLastVersion.version- });- }- // this.setState({ newVersion: '3.0.1' });- return true;- })+ getLastVersionPromise()+ .then(lastVersion => {+ console.log('Last version on server: ' + lastVersion);+ const cleanedLastVersion = semver.coerce(lastVersion);+ // const cleanedCurrentVersion = '3.0.2'+ const cleanedCurrentVersion = semver.coerce(versionMeta.version);+ if (+ semver.valid(cleanedLastVersion) &&+ semver.gt(cleanedLastVersion, cleanedCurrentVersion)+ ) {+ this.setState({+ updateAvailable: true,+ newVersion: cleanedLastVersion.version+ });+ }+ // this.setState({ newVersion: '3.0.1' });+ return true;+ }).catch(error => {console.warn('Error while checking for update: ' + error);});}- }+ };renderTitle = () => <DialogTitle>{productName}</DialogTitle>;@@ -94,36 +98,53 @@ class AboutDialog extends React.Component<Props, State> {src={LogoIcon}style={{ float: 'left', marginRight: 10, width: 120, height: 120 }}/>- <Typography variant="subtitle1" title={'Build on: ' + versionMeta.buildTime}>Version: {versionMeta.version} / BuildID: {buildID}</Typography>- <br /><Typography- id="aboutContent"- variant="body1"+ variant="subtitle1"+ title={'Build on: ' + versionMeta.buildTime}>- <strong>{productName}</strong> is made possible by the TagSpaces(github.com/tagspaces) open source project- and other <Button onClick={this.props.toggleThirdPartyLibsDialog}>open source software</Button>.+ Version: {versionMeta.version} / BuildID: {buildID}+ </Typography>+ <br />+ <Typography id="aboutContent" variant="body1">+ <strong>{productName}</strong> is made possible by the+ TagSpaces(github.com/tagspaces) open source project and other{' '}+ <Button onClick={this.props.toggleThirdPartyLibsDialog}>+ open source software+ </Button>+ .+ <br />+ {!Pro && (+ <span>+ 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.+ </span>+ )}+ <br />+ 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 License for+ more details.<br />- {!Pro && (<span>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.</span>)}<br />- 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- License for more details.- <br /><br /><Button- onClick={() => { PlatformIO.openUrl('https://www.tagspaces.org/about/imprint/'); }}+ onClick={() => {+ PlatformIO.openUrl('https://www.tagspaces.org/about/imprint/');+ }}>Imprint</Button><Button- onClick={() => { PlatformIO.openUrl('https://www.tagspaces.org/about/privacy/'); }}+ onClick={() => {+ PlatformIO.openUrl('https://www.tagspaces.org/about/privacy/');+ }}>Privacy Policy</Button><Button- onClick={() => { PlatformIO.openUrl('https://www.tagspaces.org/whatsnew/'); }}+ onClick={() => {+ PlatformIO.openUrl('https://www.tagspaces.org/whatsnew/');+ }}>Changelog</Button>@@ -141,7 +162,9 @@ class AboutDialog extends React.Component<Props, State> {let versionInfo = 'Check for updates';if (this.state.newVersion.length > 1) {if (this.state.updateAvailable) {- versionInfo = i18n.t('getNewVersion', { newVersion: this.state.newVersion });+ versionInfo = i18n.t('getNewVersion', {+ newVersion: this.state.newVersion+ });} else {versionInfo = i18n.t('latestVersion', { productName });}@@ -149,6 +172,18 @@ class AboutDialog extends React.Component<Props, State> {return (<DialogActions>+ {!Pro && (+ <Button+ data-tid="checkForUpdates"+ title={i18n.t('core:checkForNewVersion')}+ onClick={() => {+ PlatformIO.openUrl('https://www.tagspaces.org/products/');+ }}+ color="primary"+ >+ Upgrade to PRO+ </Button>+ )}<Buttondata-tid="checkForUpdates"title={i18n.t('core:checkForNewVersion')}@@ -157,7 +192,7 @@ class AboutDialog extends React.Component<Props, State> {>{versionInfo}</Button>- { /* <Button+ {/* <Buttondata-tid="openLicenseDialog"onClick={this.props.toggleLicenseDialog}>@@ -168,7 +203,7 @@ class AboutDialog extends React.Component<Props, State> {onClick={this.props.toggleThirdPartyLibsDialog}>{i18n.t('core:thirdPartyLibs')}- </Button> */ }+ </Button> */}<Buttondata-tid="closeAboutDialog"onClick={this.props.onClose}@@ -181,11 +216,7 @@ class AboutDialog extends React.Component<Props, State> {};render() {- const {- fullScreen,- open,- onClose- } = this.props;+ const { fullScreen, open, onClose } = this.props;return (<GenericDialogfullScreen={fullScreen}