forked from nukeop/nuclear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Top Tracks from lastfm in dashboard
Todo : better presentation + clickable tracks / artists
- Loading branch information
1 parent
2a3fc66
commit 4c0d984
Showing
7 changed files
with
208 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
import React from 'react'; | ||
import {Tab} from 'semantic-ui-react'; | ||
import PropTypes from 'prop-types'; | ||
import { Tab } from 'semantic-ui-react'; | ||
import artPlaceholder from '../../../../resources/media/art_placeholder.png'; | ||
import numeral from 'numeral'; | ||
|
||
import styles from './styles.scss'; | ||
|
||
const ChartsTab = props => { | ||
return ( | ||
<Tab.Pane attached={false}> | ||
<div className={styles.charts_container}> | ||
<h3>Charts in Nuclear are coming soon.</h3> | ||
</div> | ||
</Tab.Pane> | ||
); | ||
}; | ||
class ChartsTab extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
ChartsTab.propTypes = { | ||
|
||
}; | ||
render() { | ||
console.log(this.props); | ||
return ( | ||
<Tab.Pane attached={false}> | ||
<div className={styles.charts_container}> | ||
<h3>Top Tracks from LastFm.</h3> | ||
{this.props.topTracks.map((track, i) => { | ||
return ( | ||
<div key={'toptrack-' + i} className={styles.track_row}> | ||
<img src={track.image[0]['#text'] || artPlaceholder} /> | ||
<div className={styles.popular_track_name}>{track.name}</div> | ||
<div className={styles.popular_track_artist}> | ||
{track.artist.name} | ||
</div> | ||
<div className={styles.playcount}> | ||
{numeral(track.playcount).format('0,0')} plays | ||
</div> | ||
</div> | ||
); | ||
})} | ||
{console.log(this.props.topTracks)} | ||
</div> | ||
</Tab.Pane> | ||
); | ||
} | ||
} | ||
|
||
export default ChartsTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,65 @@ | ||
@import '../../../vars'; | ||
.charts_container { | ||
} | ||
|
||
.popular_tracks_container { | ||
display: flex; | ||
flex: 1 1 auto; | ||
flex-flow: column; | ||
|
||
margin: 0 0.5rem; | ||
|
||
.header { | ||
margin-bottom: 1rem; | ||
|
||
font-size: 16px; | ||
font-variant: small-caps; | ||
} | ||
|
||
.track_row { | ||
display: flex; | ||
align-items: center; | ||
flex-flow: row; | ||
|
||
transition: 0.25s ease-in-out; | ||
|
||
border-bottom: 1px solid rgba($background2, 0.2); | ||
|
||
&:hover { | ||
background: lighten($background, 10%); | ||
} | ||
|
||
img { | ||
flex: 0 0 auto; | ||
|
||
width: 3rem; | ||
height: 3rem; | ||
} | ||
|
||
.popular_track_name { | ||
flex: 1 1 auto; | ||
margin: 0.25rem 0.5rem; | ||
text-align: left; | ||
} | ||
|
||
.playcount { | ||
flex: 1 1 auto; | ||
margin: 0.25rem 0.5rem; | ||
text-align: right; | ||
text-transform: uppercase; | ||
} | ||
} | ||
|
||
.expand_button { | ||
display: flex; | ||
justify-content: center; | ||
padding: 0.5rem; | ||
margin-top: 0.5rem; | ||
transition: 0.25s; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
background: lighten($background, 5%); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters