Auto eslint fix
This commit is contained in:
@ -1,83 +1,83 @@
|
||||
|
||||
import React from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { bindActionCreators } from 'redux'
|
||||
import { bindActionCreators } from 'redux';
|
||||
|
||||
import TrackList from '../components/TrackList'
|
||||
import Header from '../components/Header'
|
||||
import Icon from '../components/Icon'
|
||||
import TrackList from '../components/TrackList';
|
||||
import Header from '../components/Header';
|
||||
import Icon from '../components/Icon';
|
||||
|
||||
import * as uiActions from '../services/ui/actions'
|
||||
import * as pusherActions from '../services/pusher/actions'
|
||||
import * as spotifyActions from '../services/spotify/actions'
|
||||
import * as mopidyActions from '../services/mopidy/actions'
|
||||
import * as uiActions from '../services/ui/actions';
|
||||
import * as pusherActions from '../services/pusher/actions';
|
||||
import * as spotifyActions from '../services/spotify/actions';
|
||||
import * as mopidyActions from '../services/mopidy/actions';
|
||||
|
||||
class QueueHistory extends React.Component{
|
||||
class QueueHistory extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
constructor(props){
|
||||
super(props);
|
||||
}
|
||||
componentDidMount() {
|
||||
this.props.uiActions.setWindowTitle('Queue history');
|
||||
this.loadHistory();
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.props.uiActions.setWindowTitle("Queue history");
|
||||
this.loadHistory()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (!this.props.mopidy_connected && nextProps.mopidy_connected) {
|
||||
this.loadHistory(nextProps);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps){
|
||||
if (!this.props.mopidy_connected && nextProps.mopidy_connected){
|
||||
this.loadHistory(nextProps)
|
||||
}
|
||||
}
|
||||
loadHistory(props = this.props) {
|
||||
if (props.mopidy_connected) {
|
||||
this.props.mopidyActions.getQueueHistory();
|
||||
}
|
||||
}
|
||||
|
||||
loadHistory(props = this.props){
|
||||
if (props.mopidy_connected){
|
||||
this.props.mopidyActions.getQueueHistory()
|
||||
}
|
||||
}
|
||||
|
||||
render(){
|
||||
var options = (
|
||||
<a className="button button--no-hover" onClick={e => this.props.history.push('/queue')}>
|
||||
<Icon name="keyboard_backspace" />
|
||||
render() {
|
||||
const options = (
|
||||
<a className="button button--no-hover" onClick={(e) => this.props.history.push('/queue')}>
|
||||
<Icon name="keyboard_backspace" />
|
||||
|
||||
Back
|
||||
</a>
|
||||
)
|
||||
</a>
|
||||
);
|
||||
|
||||
var tracks = [];
|
||||
for (var i = 0; i < this.props.queue_history.length; i++){
|
||||
var track = Object.assign({}, this.props.queue_history[i]);
|
||||
const tracks = [];
|
||||
for (let i = 0; i < this.props.queue_history.length; i++) {
|
||||
let track = { ...this.props.queue_history[i] };
|
||||
|
||||
// We have the track in the index, so merge the track objects
|
||||
if (this.props.tracks[track.uri] !== undefined){
|
||||
track = Object.assign(
|
||||
{},
|
||||
track,
|
||||
this.props.tracks[track.uri]
|
||||
);
|
||||
}
|
||||
|
||||
tracks.push(track);
|
||||
}
|
||||
// We have the track in the index, so merge the track objects
|
||||
if (this.props.tracks[track.uri] !== undefined) {
|
||||
track = {
|
||||
|
||||
return (
|
||||
<div className="view queue-history-view">
|
||||
<Header options={options} uiActions={this.props.uiActions}>
|
||||
<Icon name="play_arrow" type="material" />
|
||||
...track,
|
||||
...this.props.tracks[track.uri],
|
||||
};
|
||||
}
|
||||
|
||||
tracks.push(track);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="view queue-history-view">
|
||||
<Header options={options} uiActions={this.props.uiActions}>
|
||||
<Icon name="play_arrow" type="material" />
|
||||
Playback history
|
||||
</Header>
|
||||
<section className="content-wrapper">
|
||||
<TrackList
|
||||
className="queue-history-track-list"
|
||||
track_context="history"
|
||||
tracks={tracks}
|
||||
show_source_icon={true}
|
||||
/>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
</Header>
|
||||
<section className="content-wrapper">
|
||||
<TrackList
|
||||
className="queue-history-track-list"
|
||||
track_context="history"
|
||||
tracks={tracks}
|
||||
show_source_icon
|
||||
/>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -85,23 +85,19 @@ class QueueHistory extends React.Component{
|
||||
* Export our component
|
||||
*
|
||||
* We also integrate our global store, using connect()
|
||||
**/
|
||||
* */
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
tracks: (state.core.tracks ? state.core.tracks : {}),
|
||||
queue_history: (state.mopidy.queue_history ? state.mopidy.queue_history : [])
|
||||
}
|
||||
}
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
tracks: (state.core.tracks ? state.core.tracks : {}),
|
||||
queue_history: (state.mopidy.queue_history ? state.mopidy.queue_history : []),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
uiActions: bindActionCreators(uiActions, dispatch),
|
||||
pusherActions: bindActionCreators(pusherActions, dispatch),
|
||||
spotifyActions: bindActionCreators(spotifyActions, dispatch),
|
||||
mopidyActions: bindActionCreators(mopidyActions, dispatch)
|
||||
}
|
||||
}
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
uiActions: bindActionCreators(uiActions, dispatch),
|
||||
pusherActions: bindActionCreators(pusherActions, dispatch),
|
||||
spotifyActions: bindActionCreators(spotifyActions, dispatch),
|
||||
mopidyActions: bindActionCreators(mopidyActions, dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(QueueHistory)
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(QueueHistory);
|
||||
|
||||
Reference in New Issue
Block a user