Skip to content

Commit

Permalink
Implement option to ignore file size
Browse files Browse the repository at this point in the history
  • Loading branch information
gariasf committed Sep 8, 2019
1 parent bbcf157 commit 85a5955
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 21 additions & 2 deletions src/views/home/file-chooser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default connect(

this.state = {
showToast: false,
toastContent: ''
toastContent: '',
ignoreFileSizeLimit: false
};

this.toastTimeout = 300000;
Expand All @@ -46,7 +47,7 @@ export default connect(
handleFileChange(event) {
const file = event.target.files[0];

if (file.size / 1024 / 1024 > 1) {
if (!this.state.ignoreFileSizeLimit && file.size / 1024 / 1024 > 1) {
this.showToast('The chat is too large');

return;
Expand Down Expand Up @@ -91,6 +92,13 @@ export default connect(
});
}

@bind
onSizeLimitInput(event) {
this.setState({
ignoreFileSizeLimit: !this.state.ignoreFileSizeLimit
});
}

render() {
return (
<form class={`text-center ${style.uploadForm}`}>
Expand All @@ -114,6 +122,17 @@ export default connect(
onChangeExecute={this.handleFileChange}
onClickExecute={this.resetInput}
/>
<div>
<input
onChange={this.onSizeLimitInput}
checked={this.state.ignoreFileSizeLimit}
id="skipFileSizeLimit"
type="checkbox"
/>
<label for="skipFileSizeLimit">
&nbsp;&nbsp;<small>Ignore chat size warning</small>
</label>
</div>
</form>
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/views/home/quick-info/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
align-items: center;
}
}


}

0 comments on commit 85a5955

Please sign in to comment.