Slightly improve downloading UI
parent
fa9cc0468e
commit
24f51cab8d
|
|
@ -40,7 +40,7 @@ class FileChatEntry extends Component
|
||||||
{
|
{
|
||||||
this.setState({
|
this.setState({
|
||||||
numPeers : torrent.numPeers,
|
numPeers : torrent.numPeers,
|
||||||
progress : Math.round(torrent.progress * 100 * 100) / 100
|
progress : torrent.progress
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -53,7 +53,8 @@ class FileChatEntry extends Component
|
||||||
clearInterval(onProgress);
|
clearInterval(onProgress);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
files : torrent.files
|
files : torrent.files,
|
||||||
|
active: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -64,23 +65,32 @@ class FileChatEntry extends Component
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div>
|
<div>
|
||||||
<button onClick={this.download}>
|
{!this.state.active && !this.state.files && (
|
||||||
append shared file to body
|
<Fragment>
|
||||||
</button>
|
<p>A new file was shared.</p>
|
||||||
|
|
||||||
{this.state.active && (
|
<button onClick={this.download}>
|
||||||
|
Download
|
||||||
|
</button>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{this.state.active && this.state.numPeers === 0 && (
|
||||||
<div>
|
<div>
|
||||||
peers: {this.state.numPeers}
|
Locating peers
|
||||||
progress: {this.state.progress}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{this.state.active && this.state.numPeers > 0 && (
|
||||||
|
<progress value={this.state.progress} />
|
||||||
|
)}
|
||||||
|
|
||||||
{this.state.files && (
|
{this.state.files && (
|
||||||
<div>
|
<div>
|
||||||
{this.state.files.map((file, i) => (
|
{this.state.files.map((file, i) => (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
<button onClick={() => this.saveFile(file)}>
|
<button onClick={() => this.saveFile(file)}>
|
||||||
download {file.name}
|
Save {file.name}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue