Skip to content

Commit

Permalink
fix: disable file input areas while processing
Browse files Browse the repository at this point in the history
Fixes #24
  • Loading branch information
marisademeglio authored and rdeltour committed Dec 23, 2018
1 parent 286fbb5 commit 802ddf7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/renderer/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { bindActionCreators } from 'redux';
import { createMuiTheme, withStyles, MuiThemeProvider } from '@material-ui/core/styles';
import {
CircularProgress,
Divider,
Drawer,
IconButton,
Divider,
Drawer,
IconButton,
List,
ListItem,
ListItemIcon,
Expand Down Expand Up @@ -43,7 +43,7 @@ const sidebarTheme = createMuiTheme({
});

const styles = theme => ({

menuButton: {
marginLeft: 12,
marginRight: 36,
Expand Down Expand Up @@ -103,7 +103,7 @@ class Sidebar extends React.Component {
open: true,
fileHover: false,
};

showOpenEPUBDialog = () => {
process.platform == 'darwin'
? FileDialogHelpers.showEpubFileOrFolderBrowseDialog(this.props.openFile)
Expand All @@ -115,7 +115,7 @@ class Sidebar extends React.Component {
FileDialogHelpers.showExportReportDialog(this.props.exportReport);
return false;
}

onDragOver = e => {
e.stopPropagation();
e.preventDefault();
Expand Down Expand Up @@ -164,6 +164,7 @@ class Sidebar extends React.Component {
<Divider />
<List className={classes.primaryActions}>
<ListItem button
disabled={processing.ace}
onClick={this.showOpenEPUBDialog}
onDrop={this.onDrop}
onDragOver={this.onDragOver}
Expand All @@ -176,7 +177,7 @@ class Sidebar extends React.Component {
{processing.ace && reportPath &&
<CircularProgress size={40} className={classes.buttonProcessing} />}
</ListItem>
<ListItem button
<ListItem button
onClick={() => openFile(inputPath)}
disabled={!inputPath}>
<ListItemIcon>
Expand Down Expand Up @@ -228,4 +229,3 @@ function mapDispatchToProps(dispatch) {
}

export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles,{ withTheme: true })(Sidebar));

20 changes: 13 additions & 7 deletions src/renderer/components/Splash.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ class Splash extends React.Component {

render() {
let {classes, processing} = this.props;

let disabled = processing ? 'disabled' : '';
return (
<div className={`splash
${this.state.fileHover ? 'hover' : ''}`}
${this.state.fileHover ? 'hover' : ''}
${processing ? 'processing' : ''}`}
onDrop={this.onDrop}
onDragOver={this.onDragOver}
onDragLeave={this.onDragLeave}
Expand All @@ -83,16 +84,21 @@ class Splash extends React.Component {
<img src={`${AceLogo}`} alt="" width="150" height="150"/>
{processing && <CircularProgress size={178} className={classes.buttonProcessing}/>}
</div>
{!processing &&
<p>Drop an EPUB file or directory here,<br/>
or on the&nbsp;
<AddCircleOutlineIcon titleAccess="“New”" fontSize='inherit' style={{position: 'relative', bottom: '-0.15em'}}/>
&nbsp;button in the sidebar, <br/>
or {process.platform == 'darwin'
?<span><a href="#" onClick={this.onBrowseFileOrFolderClick}>click to browse.</a></span>
:<span>browse for a <a href="#" onClick={this.onBrowseFileClick}>file</a> or
a <a href="#" onClick={this.onBrowseFolderClick}>folder</a>.</span>
}
or
{process.platform == 'darwin'
? <span> <a href="#"onClick={this.onBrowseFileOrFolderClick}>click to browse.</a></span>
: <span> browse for
a <a href="#" onClick={this.onBrowseFileClick}>file</a> or
a <a href="#" onClick={this.onBrowseFolderClick}>folder</a>.
</span>
}
</p>
}
</div>
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/styles/Splash.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
border: 5px dashed rgba(0, 0, 0, 0.1);
border-radius: 50px;
transition: border-color 0.5s ease;
}
}

.splash.processing {
background-color: rgba(128, 128, 128, .4) !important;
pointer-events: none;
}

0 comments on commit 802ddf7

Please sign in to comment.