|
@@ -56,6 +56,28 @@ function Difficulties(props) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+function VoteRatio(props){
|
|
|
+ var total = props.up + props.down;
|
|
|
+ if(props.up > props.down){
|
|
|
+ return <span>👍{(props.up / total * 100).toFixed(1) }/<CompactNumber value={ props.up + props.down }/></span>
|
|
|
+ }else if (props.up < props.down){
|
|
|
+ return <span>👎{(props.down / total * 100).toFixed(1)}/<CompactNumber value={ props.up + props.down }/></span>
|
|
|
+ }else{
|
|
|
+ return <span></span>
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function CompactNumber(props){
|
|
|
+ var num = props.value, uni = 0;
|
|
|
+
|
|
|
+ if( num >= 100 && num < 1000) return <span>{(num / 100).toFixed(0)}H</span>
|
|
|
+ if( num >= 1000 && num < 10000) return <span>{(num / 1000).toFixed(0)}K</span>
|
|
|
+ if( num >= 10000 && num < 1000000) return <span>{(num / 10000).toFixed(0)}万</span>
|
|
|
+ if( num >= 1000000 && num < 10000000) return <span>{(num / 1000000).toFixed(0)}M</span>
|
|
|
+
|
|
|
+ return <span>{num}</span>
|
|
|
+}
|
|
|
+
|
|
|
class CoverGridItem extends Component {
|
|
|
|
|
|
constructor() {
|
|
@@ -98,6 +120,7 @@ componentWillReceiveProps(props) {
|
|
|
</div>
|
|
|
)
|
|
|
} else {
|
|
|
+ //debugger here
|
|
|
return (
|
|
|
<div key={ this.props.key } className='cover-grid-item' onClick={ () => { this.props.setScrollTop(document.getElementById('cover-grid-container').scrollTop); if(this.props.file) { this.props.loadDetailsFromFile(this.props.file) } else { this.props.loadDetailsFromKey(this.props.songKey) } } }>
|
|
|
<img className="cover-image" src={ this.props.imageSource.startsWith('file://') ? this.props.imageSource : `https://beatsaver.com${ this.props.imageSource }` } alt=""/>
|
|
@@ -105,6 +128,11 @@ componentWillReceiveProps(props) {
|
|
|
<div style={ { backgroundColor: this.state.bgc, color: this.state.textColor } } className="cover-grid-info-tab">
|
|
|
<div className="cover-grid-title">{this.props.title}</div>
|
|
|
<div className="cover-grid-artist">{this.props.artist}</div>
|
|
|
+ <div>
|
|
|
+ {/* 👍{ this.props.upvotes } 👎{ this.props.downvotes } */}
|
|
|
+ <VoteRatio up={ this.props.upvotes } down={ this.props.downvotes } />
|
|
|
+ 🏁{ ( 100 * this.props.plays / this.props.downloads).toFixed(1) }/<CompactNumber value={ this.props.downloads }/>
|
|
|
+ </div>
|
|
|
<div className="dots">
|
|
|
<Difficulties difficulties={ this.props.difficulties } textColor={ this.state.textColor } />
|
|
|
</div>
|