TagSpaces is an offline, open source, document manager with tagging support
refactoring dialog to be fullscreen on small screens
Ilian Sapundshieve180812cd6a3
diff --git a/app/components/dialogs/AboutDialog.js b/app/components/dialogs/AboutDialog.jsindex b51049634..312b00025 100644--- a/app/components/dialogs/AboutDialog.js+++ b/app/components/dialogs/AboutDialog.js@@ -36,6 +36,7 @@ import AppConfig from '../../config';type Props = {open: boolean,+ fullScreen: boolean,toggleLicenseDialog: () => void,toggleThirdPartyLibsDialog: () => void,onClose: () => void@@ -156,7 +157,7 @@ class AboutDialog extends React.Component<Props, State> {>{versionInfo}</Button>- { /*<Button+ { /* <Buttondata-tid="openLicenseDialog"onClick={this.props.toggleLicenseDialog}>@@ -180,10 +181,16 @@ class AboutDialog extends React.Component<Props, State> {};render() {+ const {+ fullScreen,+ open,+ onClose+ } = this.props;return (<GenericDialog- open={this.props.open}- onClose={this.props.onClose}+ fullScreen={fullScreen}+ open={open}+ onClose={onClose}renderTitle={this.renderTitle}renderContent={this.renderContent}renderActions={this.renderActions}diff --git a/app/components/dialogs/CreateFileDialog.js b/app/components/dialogs/CreateFileDialog.jsindex 08a343fde..a243ab343 100644--- a/app/components/dialogs/CreateFileDialog.js+++ b/app/components/dialogs/CreateFileDialog.js@@ -35,6 +35,7 @@ import Radio from '@material-ui/core/Radio';import Input from '@material-ui/core/Input';import InputLabel from '@material-ui/core/InputLabel';import InputAdornment from '@material-ui/core/InputAdornment';+import withMobileDialog from '@material-ui/core/withMobileDialog';import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import i18n from '../../services/i18n';import { formatDateTime4Tag } from '../../utils/misc';@@ -67,6 +68,7 @@ const styles = theme => ({type Props = {open: boolean,+ fullScreen: boolean,onClose: () => void,showSelectDirectoryDialog: () => void,selectedDirectoryPath?: string,@@ -335,13 +337,21 @@ class CreateFileDialog extends React.Component<Props, State> {);render() {+ const {+ fullScreen,+ chooseDirectoryPath,+ resetState,+ open,+ onClose+ } = this.props;return (<GenericDialog- open={this.props.open}+ fullScreen={fullScreen}+ open={open}onClose={() => {- this.props.chooseDirectoryPath(undefined);- this.props.resetState('CreateFileDialogKey');- this.props.onClose();+ chooseDirectoryPath(undefined);+ resetState('CreateFileDialogKey');+ onClose();}}onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}renderTitle={this.renderTitle}@@ -360,4 +370,4 @@ function mapActionCreatorsToProps(dispatch) {}, dispatch);}-export default connect(undefined, mapActionCreatorsToProps)(withStyles(styles)(CreateFileDialog));+export default connect(undefined, mapActionCreatorsToProps)(withMobileDialog()(withStyles(styles)(CreateFileDialog)));diff --git a/app/components/dialogs/CreateLocationDialog.js b/app/components/dialogs/CreateLocationDialog.jsindex 73aba82fb..032342b90 100644--- a/app/components/dialogs/CreateLocationDialog.js+++ b/app/components/dialogs/CreateLocationDialog.js@@ -21,6 +21,7 @@ import React from 'react';import Button from '@material-ui/core/Button';import uuidv1 from 'uuid';import { withStyles } from '@material-ui/core/styles';+import withMobileDialog from '@material-ui/core/withMobileDialog';import DialogActions from '@material-ui/core/DialogActions';import DialogContent from '@material-ui/core/DialogContent';import DialogTitle from '@material-ui/core/DialogTitle';@@ -55,7 +56,9 @@ const styles = theme => ({type Props = {classes: Object,- open?: boolean,+ open: boolean,+ onClose: () => void,+ fullScreen: boolean,onClose: () => void,addLocation: (location: Location) => void,perspectives: Array<Object>,@@ -424,10 +427,16 @@ class CreateLocationDialog extends React.Component<Props, State> {);render() {+ const {+ fullScreen,+ open,+ onClose+ } = this.props;return (<GenericDialog- open={this.props.open}- onClose={this.props.onClose}+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}renderTitle={this.renderTitle}renderContent={this.renderContent}@@ -437,4 +446,4 @@ class CreateLocationDialog extends React.Component<Props, State> {}}-export default withStyles(styles)(CreateLocationDialog);+export default withStyles(styles)(withMobileDialog()(CreateLocationDialog));diff --git a/app/components/dialogs/EditLocationDialog.js b/app/components/dialogs/EditLocationDialog.jsindex e3a001ea3..a33b526eb 100644--- a/app/components/dialogs/EditLocationDialog.js+++ b/app/components/dialogs/EditLocationDialog.js@@ -18,6 +18,7 @@*/import React from 'react';+import withMobileDialog from '@material-ui/core/withMobileDialog';import Button from '@material-ui/core/Button';import DialogActions from '@material-ui/core/DialogActions';import DialogContent from '@material-ui/core/DialogContent';@@ -40,6 +41,7 @@ import { Pro } from '../../pro';type Props = {open?: boolean,+ fullScreen: boolean,resetState: () => void,onClose: () => void,location?: Location | null,@@ -380,10 +382,15 @@ class EditLocationDialog extends React.Component<Props, State> {);render() {+ const {+ fullScreen,+ open,+ } = this.props;return (<GenericDialog- open={this.props.open}+ open={open}onClose={this.onCancel}+ fullScreen={fullScreen}onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}renderTitle={this.renderTitle}renderContent={this.renderContent}@@ -393,5 +400,5 @@ class EditLocationDialog extends React.Component<Props, State> {}}-export default EditLocationDialog;+export default withMobileDialog()(EditLocationDialog);diff --git a/app/components/dialogs/GenericDialog.js b/app/components/dialogs/GenericDialog.jsindex 8830139c0..4e5c97f5c 100644--- a/app/components/dialogs/GenericDialog.js+++ b/app/components/dialogs/GenericDialog.js@@ -73,18 +73,27 @@ class GenericDialog extends React.Component<Props> {);render() {+ const {+ fullScreen,+ open,+ onEnterKey,+ onClose,+ renderTitle,+ renderContent,+ renderActions+ } = this.props;return (<Dialog- open={this.props.open ? this.props.open : false}+ fullScreen={fullScreen}+ open={open}TransitionComponent={Transition}keepMounted- fullScreen={this.props.fullScreen ? this.props.fullScreen : false}onClose={this.props.onClose}- onKeyDown={this.props.onEnterKey ? this.props.onEnterKey : (event) => onEnterKeyHandler(event, this.props.onClose)}+ onKeyDown={onEnterKey || ((event) => onEnterKeyHandler(event, onClose))}>- {this.props.renderTitle ? this.props.renderTitle() : this.renderTitle()}- {this.props.renderContent ? this.props.renderContent() : this.renderContent()}- {this.props.renderActions ? this.props.renderActions() : this.renderActions()}+ {renderTitle ? renderTitle() : this.renderTitle()}+ {renderContent ? renderContent() : this.renderContent()}+ {renderActions ? renderActions() : this.renderActions()}</Dialog>);}diff --git a/app/components/dialogs/LicenseDialog.js b/app/components/dialogs/LicenseDialog.jsindex 14b6f2f0b..ea1b41e82 100644--- a/app/components/dialogs/LicenseDialog.js+++ b/app/components/dialogs/LicenseDialog.js@@ -32,6 +32,7 @@ const licenseUrl = Pro ? './node_modules/@tagspaces/pro/EULA.txt' : './LICENSE.ttype Props = {open: boolean,+ fullScreen: boolean,onClose: () => void};@@ -78,11 +79,16 @@ class LicenseDialog extends React.Component<Props, State> {);render() {+ const {+ fullScreen,+ open,+ onClose+ } = this.props;return (<GenericDialog- open={this.props.open}- onClose={this.props.onClose}- // onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}renderTitle={this.renderTitle}renderContent={this.renderContent}renderActions={this.renderActions}diff --git a/app/components/dialogs/SettingsDialog.js b/app/components/dialogs/SettingsDialog.jsindex 0babeddca..68325c614 100644--- a/app/components/dialogs/SettingsDialog.js+++ b/app/components/dialogs/SettingsDialog.js@@ -46,19 +46,22 @@ const styles = theme => ({}});-/*type Props = {+ open: boolean,+ fullScreen: boolean,classes: Object,- onClose: () => void,+ onClose: () => void};type State = {- currentTab?: number+ currentTab?: number,+ items: Array<Object>,+ selectedItem: Object,+ isValidationInProgress: boolean,+ isConfirmDialogOpened: boolean};-<Props, State>-*/-class SettingsDialog extends React.Component {+class SettingsDialog extends React.Component<Props, State> {state = {currentTab: 0,items: [],@@ -270,11 +273,16 @@ class SettingsDialog extends React.Component {);render() {+ const {+ fullScreen,+ open,+ onClose+ } = this.props;return (<GenericDialog- open={this.props.open}- onClose={this.props.onClose}- onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}renderTitle={this.renderTitle}renderContent={this.renderContent}renderActions={this.renderActions}