1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00

only show progress bar if files are greater than 10MB

This commit is contained in:
Tim Daubenschütz 2015-09-09 16:32:08 +02:00
parent 2cc4284118
commit 384e0e3e6f

View File

@ -25,13 +25,27 @@ let FileDragAndDropPreviewProgress = React.createClass({
return overallProgress;
},
calcOverallFileSize() {
let overallFileSize = 0;
let files = this.props.files.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.status !== 'online');
for(let i = 0; i < files.length; i++) {
overallFileSize += files[i].size;
}
return overallFileSize;
},
render() {
let overallProgress = this.calcOverallProgress();
let overallFileSize = this.calcOverallFileSize();
let style = {
visibility: 'hidden'
};
if(overallProgress !== 0) {
// only visible if overallProgress is over zero
// or the overallFileSize is greater than 10MB
if(overallProgress !== 0 && overallFileSize > 10000000) {
style.visibility = 'visible';
}