Conversation
|
Two things
|
| } | ||
|
|
||
| export interface IFileUploadState { | ||
| height: number | undefined; |
There was a problem hiding this comment.
Do you mean optional instead of undefined?
| case SET_INITIAL_HEIGHT_PLUS_VALUES: | ||
| return { | ||
| ...state, | ||
| height: undefined, |
There was a problem hiding this comment.
Isn't this just default height? Or don't set it at all?
so you mean to process files in parallel? |
Correct. No need to do step by step. |
| return { | ||
| ...value_, | ||
| isSuccess: { | ||
| ...value_.isSuccess, | ||
| value: false, | ||
| }, | ||
| isFailure: { | ||
| ...value_.isFailure, | ||
| value: true, | ||
| }, | ||
| isUploading: { | ||
| ...value_.isUploading, | ||
| value: false, | ||
| }, |
There was a problem hiding this comment.
Duplicate code with piece below abstract to function to reduce code duplicate. Use parameters for function to solve issue
| ...value_, | ||
| isSuccess: { | ||
| ...value_.isSuccess, | ||
| value: true, | ||
| }, | ||
| isFailure: { | ||
| ...value_.isFailure, | ||
| value: false, | ||
| }, | ||
| isUploading: { | ||
| ...value_.isUploading, | ||
| value: false, | ||
| }, |
| <IsFailureIsSuccessPanel | ||
| message={failureMessage} | ||
| iconColor={MainTheme.colors.statusColors.red} | ||
| IconToShow={TimesCircle} | ||
| transitionDuration={animationDuration} | ||
| /> | ||
| ); | ||
| } | ||
| if (value.isSuccess.value) { | ||
| return ( | ||
| <IsFailureIsSuccessPanel | ||
| message={successMessage} | ||
| iconColor={MainTheme.colors.statusColors.green} | ||
| IconToShow={CheckCircle} | ||
| transitionDuration={animationDuration} | ||
| /> |
There was a problem hiding this comment.
Use one Return Statement and just edit the Props Object since duplicate JSX
| opacity={ | ||
| value.isUploading.opacity || | ||
| value.isSuccess.opacity || | ||
| value.isFailure.opacity | ||
| } | ||
| position={ | ||
| value.isUploading.isPosition && | ||
| value.isFailure.isPosition && | ||
| value.isSuccess.isPosition | ||
| } |
There was a problem hiding this comment.
Do
Const {isFailure, IsSuccees} = value
So we don't right value. 100 times
src/Containers/FileUpload/reducer.ts
Outdated
| if(index===action.index)return false | ||
| return true |
There was a problem hiding this comment.
is A!==B, because I want all elements except the one for which A===B
| import { TextLayout } from '@Layouts'; | ||
| import { StyledIcon } from '@styled-icons/styled-icon'; | ||
| import { Container, Icon } from './StyledComponents'; | ||
| import { Container, Icon, IContainerProps } from './StyledComponents'; |
There was a problem hiding this comment.
Does this component have its own story? Where is it?
There was a problem hiding this comment.
no, I don't have a story for this styled component
There was a problem hiding this comment.
Add a story for this component
| doWithBase64StringFile(base64StringFile); | ||
| setInformativePanelsState((prev) => ({ | ||
| ...prev, | ||
| values: prev.values.map((value_) => { |
There was a problem hiding this comment.
it's because there exists already a value in scope. both value and value_ are of the same type (IValue)
There was a problem hiding this comment.
So is one the previous value? And old value. Etc
| if(value_.name===value.name)return false | ||
| return true |
| ref={loadingContainerRef} | ||
| overflow="hidden" | ||
| width={ | ||
| value.isFailure.value || value.isSuccess.value |
There was a problem hiding this comment.
This code is duplicated in the next few lines why not make a function called
IsSuccessOrError?
| positionTop?: number; | ||
| flexGrow?: boolean; | ||
| /** transition duration in ms; applied on height and opacity properties; */ | ||
| transitionDuration:number; |
| /** if true, failure message will appear even after success operation; its purpose is to test the appearance of the failure message during development */ | ||
| isTestIsFailure?: boolean; | ||
| /** height and fade in-fade out animation duration in ms; default value: 200 */ | ||
| animationDuration?: number; |
There was a problem hiding this comment.
<FileUpload
animationDuration - Affect The Secondary Componet that Appears when you upload a file.
/>
<FileUpload
onUploadShowComponent - {JSX.Element} It's own Animation
/>
| if (isFailureIsSuccessPanelProps) { | ||
| return ( | ||
| <IsFailureIsSuccessPanel | ||
| {...isFailureIsSuccessPanelProps} |
| [], | ||
| ); | ||
|
|
||
| /** cancel uploading; terminate worker and remove informative panel */ |
| /** if true, failure message will appear even after success operation; its purpose is to test the appearance of the failure message during development */ | ||
| isTestIsFailure?: boolean; |
| /** | ||
| * load array of informative panels (values) and send order to start workers | ||
| */ |
There was a problem hiding this comment.
JSDOC missing Doc for Paramters / Return Type
| /** | ||
| * terminate worker and set state of informative panel to success or failure and | ||
| * send order to remove informative panel in the future. also do whatever user | ||
| * wants to do with the file read in case of success | ||
| */ |
|
@ralph-dev, what is incorrect? |
Create a NeW PR should be doing two work in same PR |
but it is related work |
It is very difficult to review 15 files everytime when you are only changing a few. It's different work. One is modifying the existing, one is creating a new component entirely |
|
Let's close this PR if we don't need it @roggc |
multiple file upload in parallel