Moving tracks into 'items' database; in_library now pre-populated; Next to add/remove from library

This commit is contained in:
James Barnsley
2020-09-11 22:13:06 +12:00
parent 5953fc84cf
commit f254170b2f
23 changed files with 297 additions and 318 deletions

View File

@ -19,10 +19,6 @@ class QueueHistory extends React.Component {
this.loadHistory();
}
componentDidUpdate = () => {
this.loadHistory();
}
loadHistory = () => {
const {
mopidyActions: {
@ -30,6 +26,8 @@ class QueueHistory extends React.Component {
},
} = this.props;
console.log('get queue history');
getQueueHistory();
}
@ -41,7 +39,7 @@ class QueueHistory extends React.Component {
render = () => {
const {
queue_history,
tracks: tracksProp,
items,
uiActions,
} = this.props;
@ -58,9 +56,11 @@ class QueueHistory extends React.Component {
</Button>
);
if (!queue_history) return null;
const tracks = queue_history.map((item) => ({
...item,
...(tracksProp[item.uri] || {}),
...(items[item.uri] || {}),
}));
return (
@ -86,8 +86,8 @@ class QueueHistory extends React.Component {
}
const mapStateToProps = (state) => ({
tracks: (state.core.tracks ? state.core.tracks : {}),
queue_history: (state.mopidy.queue_history ? state.mopidy.queue_history : []),
items: state.core.items,
queue_history: state.mopidy.queue_history,
});
const mapDispatchToProps = (dispatch) => ({