Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-04-01 10:42:08 +02:00
parent 83bea4034b
commit d0ae68d742
7 changed files with 29 additions and 32 deletions

View File

@ -2,11 +2,11 @@ import styled from 'styled-components';
import ContainerFluid from '../ContainerFluid';
const Wrapper = styled(ContainerFluid)`
margin-bottom: 3px;
padding-top: 23px;
margin-bottom: 0.3rem;
padding-top: 2.3rem;
textarea {
height: 101px;
height: 10.1rem;
}
`;

View File

@ -106,7 +106,7 @@ const InputModalStepperProvider = ({
const handleClickNextButton = () => {
dispatch({
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: 'upload',
});
};

View File

@ -29,7 +29,7 @@ const reducer = (state, action) =>
// eslint-disable-next-line consistent-return
produce(state, draftState => {
switch (action.type) {
case 'ADD_URLS_TO_FILES_TO_DOWNLOAD': {
case 'ADD_URLS_TO_FILES_TO_UPLOAD': {
draftState.filesToUpload = [
...draftState.filesToUpload,
...createNewFilesToDownloadArray(draftState.filesToDownload, draftState.filesToUpload),
@ -43,15 +43,13 @@ const reducer = (state, action) =>
break;
}
case 'FILE_DOWNLOADED': {
draftState.filesToUpload.forEach((file, index) => {
if (file.tempId === action.fileTempId) {
draftState.filesToUpload[index] = {
...draftState.filesToUpload[index],
isDownloading: false,
file: action.blob,
};
}
});
const index = state.filesToUpload.findIndex(file => file.tempId === action.fileTempId);
draftState.filesToUpload[index] = {
...draftState.filesToUpload[index],
isDownloading: false,
file: action.blob,
};
break;
}
@ -210,16 +208,15 @@ const reducer = (state, action) =>
break;
}
case 'SET_FILE_TO_DOWNLOAD_ERROR': {
draftState.filesToUpload.forEach((file, index) => {
if (file.tempId === action.fileTempId) {
draftState.filesToUpload[index] = {
...draftState.filesToUpload[index],
isDownloading: false,
hasError: true,
errorMessage: draftState.filesToUpload[index].fileURL,
};
}
});
const index = state.filesToUpload.findIndex(file => file.tempId === action.fileTempId);
draftState.filesToUpload[index] = {
...draftState.filesToUpload[index],
isDownloading: false,
hasError: true,
errorMessage: draftState.filesToUpload[index].fileURL,
};
break;
}
case 'SET_FORM_DISABLED': {

View File

@ -170,10 +170,10 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
});
});
describe('ADD_URLS_TO_FILES_TO_DOWNLOAD', () => {
describe('ADD_URLS_TO_FILES_TO_UPLOAD', () => {
it('should add the files to the empty filesToUpload array and update the current step', () => {
const action = {
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: 'test',
};
const state = {
@ -267,7 +267,7 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
],
};
const action = {
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: 'test',
};

View File

@ -169,7 +169,7 @@ const ModalStepper = ({
const handleClickNextButton = () => {
// Navigate to next step
dispatch({
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: next,
});
};

View File

@ -19,7 +19,7 @@ const reducer = (state, action) => {
.map((data, index) => data.set('originalIndex', index))
)
.update('currentStep', () => action.nextStep);
case 'ADD_URLS_TO_FILES_TO_DOWNLOAD':
case 'ADD_URLS_TO_FILES_TO_UPLOAD':
return state
.update('filesToUpload', list =>
list

View File

@ -184,10 +184,10 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
});
});
describe('ADD_URLS_TO_FILES_TO_DOWNLOAD', () => {
describe('ADD_URLS_TO_FILES_TO_UPLOAD', () => {
it('should add the files to the empty filesToUpload array and update the current step', () => {
const action = {
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: 'test',
};
const state = fromJS({
@ -281,7 +281,7 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
],
});
const action = {
type: 'ADD_URLS_TO_FILES_TO_DOWNLOAD',
type: 'ADD_URLS_TO_FILES_TO_UPLOAD',
nextStep: 'test',
};