Proof-of-concept pinned playlist
This commit is contained in:
@ -424,3 +424,24 @@ export function getLibraryArtists() {
|
||||
type: 'GET_LIBRARY_ARTISTS',
|
||||
};
|
||||
}
|
||||
|
||||
export function addPinned(uri) {
|
||||
return {
|
||||
type: 'ADD_PINNED',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function removePinned(uri) {
|
||||
return {
|
||||
type: 'REMOVE_PINNED',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function updatePinned(pinned) {
|
||||
return {
|
||||
type: 'UPDATE_PINNED',
|
||||
pinned,
|
||||
};
|
||||
}
|
||||
|
||||
@ -807,6 +807,21 @@ const CoreMiddleware = (function () {
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'ADD_PINNED':
|
||||
store.dispatch(coreActions.updatePinned([
|
||||
...store.getState().core.pinned,
|
||||
action.uri,
|
||||
]));
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'REMOVE_PINNED':
|
||||
store.dispatch(coreActions.updatePinned(
|
||||
store.getState().core.pinned.filter((item) => item !== action.uri),
|
||||
));
|
||||
next(action);
|
||||
break;
|
||||
|
||||
// This action is irrelevant to us, pass it on to the next middleware
|
||||
default:
|
||||
return next(action);
|
||||
|
||||
@ -294,6 +294,11 @@ export default function reducer(core = {}, action) {
|
||||
},
|
||||
};
|
||||
|
||||
case 'UPDATE_PINNED':
|
||||
return {
|
||||
...core,
|
||||
pinned: action.pinned,
|
||||
};
|
||||
|
||||
default:
|
||||
return core;
|
||||
|
||||
@ -221,6 +221,13 @@ const localstorageMiddleware = (function () {
|
||||
);
|
||||
break;
|
||||
|
||||
case 'UPDATE_PINNED':
|
||||
storage.set(
|
||||
'core',
|
||||
{ pinned: action.pinned },
|
||||
);
|
||||
break;
|
||||
|
||||
case 'UI_SET':
|
||||
storage.set(
|
||||
'ui',
|
||||
|
||||
Reference in New Issue
Block a user