Progress
new MediaAttachment video style :playable for mp4 to make videojs work with multiple files, hiding albums, hiding bookmark collections. may need tweaks on mediaattachment for mov and other formats : todo :
This commit is contained in:
@@ -47,6 +47,7 @@ export default function album_lists(state = initialState, action) {
|
||||
case ALBUMS_EXPAND_REQUEST:
|
||||
return state.setIn([action.accountId, 'isLoading'], true)
|
||||
case ALBUMS_FETCH_SUCCESS:
|
||||
console.log("ALBUMS_FETCH_SUCCESS:", action)
|
||||
return normalizeList(state, action.accountId, action.albums, action.next)
|
||||
case ALBUMS_EXPAND_SUCCESS:
|
||||
return appendToList(state, action.accountId, action.albums, action.next)
|
||||
|
||||
@@ -2,45 +2,26 @@ import {
|
||||
ALBUMS_FETCH_REQUEST,
|
||||
ALBUMS_FETCH_SUCCESS,
|
||||
ALBUMS_FETCH_FAIL,
|
||||
ALBUMS_CREATE_SUCCESS,
|
||||
ALBUMS_REMOVE_REQUEST,
|
||||
ALBUM_CREATE_SUCCESS,
|
||||
ALBUM_REMOVE_REQUEST,
|
||||
} from '../actions/albums'
|
||||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
items: ImmutableList(),
|
||||
isLoading: false,
|
||||
isFetched: false,
|
||||
isError: false,
|
||||
})
|
||||
const importAlbum = (state, album) => state.set(album.id, fromJS(album))
|
||||
|
||||
const importAlbums = (state, albums) =>
|
||||
state.withMutations((mutable) => albums.forEach((album) => importAlbum(mutable, album)))
|
||||
|
||||
const initialState = ImmutableMap()
|
||||
|
||||
export default function albums(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case ALBUMS_FETCH_REQUEST:
|
||||
return state.withMutations((map) => {
|
||||
map.set('isLoading', true)
|
||||
map.set('isFetched', false)
|
||||
map.set('isError', false)
|
||||
})
|
||||
case ALBUMS_FETCH_SUCCESS:
|
||||
return state.withMutations((map) => {
|
||||
map.set('items', fromJS(action.albums))
|
||||
map.set('isLoading', false)
|
||||
map.set('isFetched', true)
|
||||
map.set('isError', false)
|
||||
})
|
||||
case ALBUMS_FETCH_FAIL:
|
||||
return state.withMutations((map) => {
|
||||
map.set('isLoading', false)
|
||||
map.set('isFetched', true)
|
||||
map.set('isError', true)
|
||||
})
|
||||
case ALBUMS_CREATE_SUCCESS:
|
||||
return state.update('items', list => list.push(fromJS(action.albums)))
|
||||
case ALBUMS_REMOVE_REQUEST:
|
||||
return state.update('items', list => list.filterNot((item) => {
|
||||
return item.get('id') === action.albumId
|
||||
}))
|
||||
return importAlbums(state, action.albums)
|
||||
case ALBUM_CREATE_SUCCESS:
|
||||
return importAlbum(state, action.album)
|
||||
case ALBUM_REMOVE_REQUEST:
|
||||
return state.delete(action.albumId)
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ import user_lists from './user_lists'
|
||||
const reducers = {
|
||||
accounts,
|
||||
accounts_counters,
|
||||
// albums,
|
||||
// album_lists,
|
||||
albums,
|
||||
album_lists,
|
||||
bookmark_collections,
|
||||
chats,
|
||||
chat_conversation_lists,
|
||||
|
||||
Reference in New Issue
Block a user