Skip to content

Commit

Permalink
Album ordering
Browse files Browse the repository at this point in the history
Signed-off-by: mashaal <[email protected]>
  • Loading branch information
mashaal committed Jan 9, 2017
1 parent 3d0b877 commit 9b9fc71
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/connection/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { sortTracks, sortAlbums } from '../utilities'
const path = require('path')
const mm = require('musicmetadata')
const fs = require('fs')
const dateFns = require('date-fns')

export default class Local {
collection (fileList) {
Expand Down Expand Up @@ -36,7 +37,7 @@ export default class Local {
metadata.album = metadata.album || ''
metadata.root = root
metadata.path = fileName
metadata.time = +new Date(fileStats.mtime)
metadata.time = Number(dateFns.format(new Date(fileStats.ctime), 'YYYYMMDDmm')) * -1
this.tracks.push(metadata)
store.dispatch({type: 'SCANNING', message: 'SCANNING: ' + metadata.artist + ' - ' + metadata.album})
rs.close()
Expand Down
2 changes: 1 addition & 1 deletion components/library/album.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class Album extends Component {
let cover = {backgroundImage:`url(../../library/default.jpg)`}
if (this.props.album.cover) cover = {backgroundImage: 'url("' + this.props.album.cover + '")'}
return (
<li onClick={this.handleClick} onMouseOver={this.activate} onMouseOut={this.reset} style={[styles.base, this.props.newest ? {order: (this.props.album.time * -1)} : '' ]}>
<li onClick={this.handleClick} onMouseOver={this.activate} onMouseOut={this.reset} style={[styles.base, this.props.newest ? {order: (this.props.album.time)} : {order: -2} ]}>
<div style={this.state.fade ? styles.fade : styles.nonfade}>
<div ref='album' style={[styles.cover, cover, this.state.active ? styles.zoom : '']}></div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions components/library/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class Library extends Component {
render () {
return (
<ul ref='library' style={[styles.base, this.props.player.track ? {padding: '12.5vh 0 33vh'} : {padding: '2em 0 33vh'}]}>
<div style={{flexBasis: '100%', padding: '0 2em', cursor: 'pointer'}} onClick={()=> store.dispatch({type: 'EDIT_METADATA'})}>
<div style={[{flexBasis: '100%', padding: '0 2em 0', cursor: 'pointer'}, {order: -999999999999}]} onClick={()=> store.dispatch({type: 'EDIT_METADATA'})}>
<Errors errors={this.countErrors()} />
</div>
{this.props.library.albums.map((album, index) => {
Expand Down Expand Up @@ -67,6 +67,7 @@ const styles = {
},
li: {
flex: '1 1 300px',
padding: '1em 2em'
padding: '1em 2em',
order: 10
}
}

0 comments on commit 9b9fc71

Please sign in to comment.