mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Fix PR feedback
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
83bea4034b
commit
d0ae68d742
@ -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;
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@ -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',
|
||||
});
|
||||
};
|
||||
|
||||
@ -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': {
|
||||
|
||||
@ -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',
|
||||
};
|
||||
|
||||
|
||||
@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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',
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user