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 dupsCount = this.state.dups && this.state.dups.length;
|
||||
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 (
|
||||
|
|
|
@ -30,14 +30,14 @@ var PlaylistBox = React.createClass({
|
|||
playlists = this.props.playlists.map(function (pl) {
|
||||
var id = pl.id;
|
||||
var active = currentId == id;
|
||||
var classes = this.props.dupsLoading ? "disabled" : "";
|
||||
var dupsCount = active ? !this.props.dupsLoading && this.props.dupsCount : "";
|
||||
return (
|
||||
<ListGroupItem href="#"
|
||||
onClick={this.clickOnItem.bind(this, id, pl.owner.id, pl.name)}
|
||||
className={classes}
|
||||
disabled={this.props.dupsLoading}
|
||||
active={active}
|
||||
key={id}>
|
||||
{pl.name}
|
||||
{pl.name} <span className="badge">{dupsCount}</span>
|
||||
</ListGroupItem>
|
||||
);
|
||||
}, this);
|
||||
|
|
Loading…
Reference in a new issue