2017-02-10 09:06:41 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
import React from 'react';
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
|
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';
|
2020-07-17 22:12:47 +12:00
|
|
|
import { i18n, I18n } from '../locale';
|
2020-08-16 20:00:10 +12:00
|
|
|
import Button from '../components/Button';
|
2020-09-22 06:59:15 +12:00
|
|
|
import { queueHistorySelector } from '../util/selectors';
|
2019-09-05 15:36:11 +12:00
|
|
|
|
2020-03-03 16:39:37 +13:00
|
|
|
class QueueHistory extends React.Component {
|
2019-09-05 15:36:11 +12:00
|
|
|
componentDidMount() {
|
2020-07-17 22:12:47 +12:00
|
|
|
const { uiActions: { setWindowTitle } } = this.props;
|
|
|
|
|
setWindowTitle(i18n('queue_history.title'));
|
2019-09-05 15:36:11 +12:00
|
|
|
this.loadHistory();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 21:05:36 +12:00
|
|
|
loadHistory = () => {
|
2020-07-17 22:12:47 +12:00
|
|
|
const {
|
2020-08-11 21:05:36 +12:00
|
|
|
mopidyActions: {
|
|
|
|
|
getQueueHistory,
|
|
|
|
|
},
|
2020-07-17 22:12:47 +12:00
|
|
|
} = this.props;
|
|
|
|
|
|
2020-08-11 21:05:36 +12:00
|
|
|
getQueueHistory();
|
2019-09-05 15:36:11 +12:00
|
|
|
}
|
|
|
|
|
|
2020-07-17 22:12:47 +12:00
|
|
|
onBack = () => {
|
|
|
|
|
const { history: { push } } = this.props;
|
|
|
|
|
push('/queue');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render = () => {
|
|
|
|
|
const {
|
2020-09-20 21:04:40 +12:00
|
|
|
tracks,
|
2020-07-17 22:12:47 +12:00
|
|
|
uiActions,
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
const options = (
|
2020-08-16 20:00:10 +12:00
|
|
|
<Button
|
|
|
|
|
onClick={this.onBack}
|
|
|
|
|
noHover
|
|
|
|
|
tracking={{ category: 'QueueHistory', action: 'Back' }}
|
|
|
|
|
>
|
2020-07-17 22:12:47 +12:00
|
|
|
<I18n path="actions.back">
|
|
|
|
|
<Icon name="keyboard_backspace" />
|
|
|
|
|
{' '}
|
|
|
|
|
</I18n>
|
2020-08-16 20:00:10 +12:00
|
|
|
</Button>
|
2019-09-05 15:36:11 +12:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="view queue-history-view">
|
2020-07-17 22:12:47 +12:00
|
|
|
<Header options={options} uiActions={uiActions}>
|
|
|
|
|
<I18n path="queue_history.title">
|
|
|
|
|
<Icon name="play_arrow" type="material" />
|
|
|
|
|
</I18n>
|
2019-09-05 15:36:11 +12:00
|
|
|
</Header>
|
2020-11-11 20:50:31 +13:00
|
|
|
{tracks.length > 0 && (
|
2020-09-20 21:04:40 +12:00
|
|
|
<section className="content-wrapper">
|
|
|
|
|
<TrackList
|
|
|
|
|
uri="iris:queue-history"
|
|
|
|
|
className="queue-history-track-list"
|
|
|
|
|
track_context="history"
|
|
|
|
|
tracks={tracks}
|
|
|
|
|
show_source_icon
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
2019-09-05 15:36:11 +12:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2017-02-10 09:06:41 +13:00
|
|
|
}
|
|
|
|
|
|
2020-09-22 06:59:15 +12:00
|
|
|
const mapStateToProps = (state) => ({
|
|
|
|
|
tracks: queueHistorySelector(state),
|
|
|
|
|
});
|
2019-09-05 15:36:11 +12:00
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
uiActions: bindActionCreators(uiActions, dispatch),
|
|
|
|
|
pusherActions: bindActionCreators(pusherActions, dispatch),
|
|
|
|
|
spotifyActions: bindActionCreators(spotifyActions, dispatch),
|
|
|
|
|
mopidyActions: bindActionCreators(mopidyActions, dispatch),
|
|
|
|
|
});
|
|
|
|
|
|
2020-03-03 16:39:37 +13:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(QueueHistory);
|