Add badge for duplicates count
This commit is contained in:
parent
b930036a45
commit
45046b77e3
2 changed files with 8 additions and 4 deletions
|
@ -73,8 +73,12 @@ var DuplicateFinderBox = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
var playlistBox = <p>Loading...</p>;
|
var playlistBox = <p>Loading...</p>;
|
||||||
|
var dupsCount = this.state.dups && this.state.dups.length;
|
||||||
if (!this.props.playlistsLoading) {
|
if (!this.props.playlistsLoading) {
|
||||||
playlistBox = <PlaylistBox handleClick={this.handlePlaylistClick} dupsLoading={this.state.dupsLoading} playlists={this.props.playlists}/>;
|
playlistBox = <PlaylistBox handleClick={this.handlePlaylistClick}
|
||||||
|
dupsCount={dupsCount}
|
||||||
|
dupsLoading={this.state.dupsLoading}
|
||||||
|
playlists={this.props.playlists}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -30,14 +30,14 @@ var PlaylistBox = React.createClass({
|
||||||
playlists = this.props.playlists.map(function (pl) {
|
playlists = this.props.playlists.map(function (pl) {
|
||||||
var id = pl.id;
|
var id = pl.id;
|
||||||
var active = currentId == id;
|
var active = currentId == id;
|
||||||
var classes = this.props.dupsLoading ? "disabled" : "";
|
var dupsCount = active ? !this.props.dupsLoading && this.props.dupsCount : "";
|
||||||
return (
|
return (
|
||||||
<ListGroupItem href="#"
|
<ListGroupItem href="#"
|
||||||
onClick={this.clickOnItem.bind(this, id, pl.owner.id, pl.name)}
|
onClick={this.clickOnItem.bind(this, id, pl.owner.id, pl.name)}
|
||||||
className={classes}
|
disabled={this.props.dupsLoading}
|
||||||
active={active}
|
active={active}
|
||||||
key={id}>
|
key={id}>
|
||||||
{pl.name}
|
{pl.name} <span className="badge">{dupsCount}</span>
|
||||||
</ListGroupItem>
|
</ListGroupItem>
|
||||||
);
|
);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
Loading…
Reference in a new issue