From 24135cf037085f2ae7d70e48f023614435e29b3f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 29 May 2018 19:27:20 +0200 Subject: le file list --- app/client/modules/samplernn/samplernn.reducer.js | 56 +++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'app/client/modules/samplernn/samplernn.reducer.js') diff --git a/app/client/modules/samplernn/samplernn.reducer.js b/app/client/modules/samplernn/samplernn.reducer.js index 6a461a4..ba429ee 100644 --- a/app/client/modules/samplernn/samplernn.reducer.js +++ b/app/client/modules/samplernn/samplernn.reducer.js @@ -7,6 +7,10 @@ const samplernnInitialState = { folders: [], files: [], results: [], + upload: { + loading: true, + status: 'Loading...', + }, } const samplernnReducer = (state = samplernnInitialState, action) => { @@ -47,15 +51,59 @@ const samplernnReducer = (state = samplernnInitialState, action) => { files: [action.data].concat(this.files) } return + case types.folder.upload_loading: + return { + ...state, + upload: { + loading: true, + status: 'Loading...', + }, + } case types.folder.upload_error: - console.log(action) - return state + return { + ...state, + upload: { + loading: false, + status: 'Error uploading :(', + }, + } case types.folder.upload_progress: console.log(action) - return state + return { + ...state, + upload: { + loading: true, + status: 'Upload progress ' + action.percent + '%', + }, + } + case types.folder.upload_waiting: + console.log(action) + return { + ...state, + upload: { + loading: true, + status: 'Waiting for server to finish processing...', + }, + } case types.folder.upload_complete: console.log(action) - return state + if (state.folder.id === action.folder) { + return { + ...state, + files: state.files.concat(state.file), // sort here also + upload: { + loading: false, + }, + } + } else { + return { + ...state, + upload: { + loading: false, + status: 'Upload complete', + }, + } + } case types.socket.status: return samplernnSocket(state, action.data) default: -- cgit v1.2.3-70-g09d2