1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

add user interface feedback

This commit is contained in:
Tim Daubenschütz 2015-07-24 15:13:20 +02:00
parent 494ab209ca
commit 38751ae612
3 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,7 @@
'use strict';
import React from 'react';
import ProgressBar from 'react-progressbar';
import FileDragAndDropDialog from './file_drag_and_drop_dialog';
import FileDragAndDropPreviewIterator from './file_drag_and_drop_preview_iterator';
@ -151,11 +152,8 @@ let FileDragAndDrop = React.createClass({
return (
<div className={className}>
<p>{getLangText('Computing hashes... This may take a few minutes.')}</p>
<p>{this.props.hashingProgress}</p>
<img
height={35}
className="action-file"
src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />
<p>{Math.ceil(this.props.hashingProgress)}%</p>
<ProgressBar completed={this.props.hashingProgress} color="#48DACB"/>
</div>
);
} else {

View File

@ -151,7 +151,7 @@ var ReactS3FineUploader = React.createClass({
}
return name;
},
multiple: true,
multiple: false,
defaultErrorMessage: getLangText('Unexpected error. Please contact us if this happens repeatedly.')
};
},
@ -528,7 +528,8 @@ var ReactS3FineUploader = React.createClass({
// update file's progress
files[index].progress = value;
// calculate overall progress
// calculate weighted average for overall progress of all
// currently hashing files
let overallHashingProgress = 0;
for(let i = 0; i < files.length; i++) {
let filesSliceOfOverall = files[i].size / overallFileSize;
@ -536,11 +537,15 @@ var ReactS3FineUploader = React.createClass({
overallHashingProgress += filesSliceOfOverall * files[i].progress;
}
this.setState({ hashingProgress: overallHashingProgress });
// Multiply by 100, since react-progressbar expects decimal numbers
this.setState({ hashingProgress: overallHashingProgress * 100});
})
.then((convertedFiles) => {
// clear hashing progress, since its done
this.setState({ hashingProgress: -1});
// actually replacing all files with their txt-hash representative
files = convertedFiles;

View File

@ -10,7 +10,7 @@
cursor: default !important;
padding: 1.5em 1.5em 1.5em 0;
padding: 1.5em 0 1.5em 0;
}
.inactive-dropzone {