Hide duplicates when refreshing token

This commit is contained in:
Gabriel Augendre 2016-04-21 02:24:22 +02:00
parent 09e9c3ff98
commit 80f4369e7b

View file

@ -88,14 +88,21 @@ var DuplicateFinderBox = React.createClass({
currentId: null,
currentUId: null,
dups: null,
dupsLoading: false
dupsLoading: false,
clicked: false
};
},
componentWillReceiveProps: function (nextProps) {
this.setState({
clicked: false
});
},
handlePlaylistClick: function (id, uid) {
this.setState({
currentId: id,
currentUId: uid,
dupsLoading: true
dupsLoading: true,
clicked: true
});
var self = this;
@ -117,9 +124,18 @@ var DuplicateFinderBox = React.createClass({
});
},
render: function () {
var duplicates = <p>Loading...</p>;
if (!this.state.dupsLoading) {
duplicates = <DuplicatesBox dups={this.state.dups}/>;
var duplicates;
if (this.state.clicked) {
duplicates = <p>Loading...</p>;
if (!this.state.dupsLoading) {
duplicates = <DuplicatesBox dups={this.state.dups}/>;
}
duplicates = (
<div className="col-md-6">
<h2>Duplicates</h2>
{duplicates}
</div>
)
}
var playlistBox = <p>Loading...</p>;
if (!this.props.playlistsLoading) {
@ -131,10 +147,7 @@ var DuplicateFinderBox = React.createClass({
<h2>Playlists</h2>
{playlistBox}
</div>
<div className="col-md-6">
<h2>Duplicates</h2>
{duplicates}
</div>
{duplicates}
</div>
);
}