Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

roger - no ticket - Multiple file upload #428

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

roggc
Copy link
Contributor

@roggc roggc commented Jan 2, 2022

multiple file upload in parallel

@ralph-dev
Copy link
Member

Two things

  1. I should be able to see both files uploaded at the same time (Progress of Each individually) because it looked liked the second file didn't get uploaded until it suddenly appeared

  2. Can't we upload two simultaneously?

}

export interface IFileUploadState {
height: number | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean optional instead of undefined?

case SET_INITIAL_HEIGHT_PLUS_VALUES:
return {
...state,
height: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just default height? Or don't set it at all?

@roggc
Copy link
Contributor Author

roggc commented Jan 2, 2022

Two things

  1. I should be able to see both files uploaded at the same time (Progress of Each individually) because it looked liked the second file didn't get uploaded until it suddenly appeared
  2. Can't we upload two simultaneously?

so you mean to process files in parallel?

@ralph-dev
Copy link
Member

Two things

  1. I should be able to see both files uploaded at the same time (Progress of Each individually) because it looked liked the second file didn't get uploaded until it suddenly appeared
  1. Can't we upload two simultaneously?

so you mean to process files in parallel?

Correct. No need to do step by step.

Copy link
Member

@ralph-dev ralph-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code quality

src/Containers/FileUpload/FileUpload.tsx Show resolved Hide resolved
src/Containers/FileUpload/FileUpload.tsx Show resolved Hide resolved
Comment on lines 194 to 207
return {
...value_,
isSuccess: {
...value_.isSuccess,
value: false,
},
isFailure: {
...value_.isFailure,
value: true,
},
isUploading: {
...value_.isUploading,
value: false,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code with piece below abstract to function to reduce code duplicate. Use parameters for function to solve issue

Comment on lines 253 to 265
...value_,
isSuccess: {
...value_.isSuccess,
value: true,
},
isFailure: {
...value_.isFailure,
value: false,
},
isUploading: {
...value_.isUploading,
value: false,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate as above

src/Containers/FileUpload/FileUpload.tsx Show resolved Hide resolved
Comment on lines 506 to 521
<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}
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use one Return Statement and just edit the Props Object since duplicate JSX

Comment on lines +618 to +627
opacity={
value.isUploading.opacity ||
value.isSuccess.opacity ||
value.isFailure.opacity
}
position={
value.isUploading.isPosition &&
value.isFailure.isPosition &&
value.isSuccess.isPosition
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do

Const {isFailure, IsSuccees} = value
So we don't right value. 100 times

@roggc roggc requested a review from ralph-dev January 3, 2022 21:03
Comment on lines 335 to 336
if(index===action.index)return false
return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove duplicate code @roggc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why not

return A == B

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is A!==B, because I want all elements except the one for which A===B

Copy link
Member

@ralph-dev ralph-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More code quality

@@ -1,16 +1,16 @@
import React, { useState, useEffect } from 'react';
import { TextLayout } from '@Layouts';
import { StyledIcon } from '@styled-icons/styled-icon';
import { Container, Icon } from './StyledComponents';
import { Container, Icon, IContainerProps } from './StyledComponents';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this component have its own story? Where is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I don't have a story for this styled component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a story for this component

src/Containers/FileUpload/FileUpload.tsx Show resolved Hide resolved
doWithBase64StringFile(base64StringFile);
setInformativePanelsState((prev) => ({
...prev,
values: prev.values.map((value_) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value_ is an unclear name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's because there exists already a value in scope. both value and value_ are of the same type (IValue)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is one the previous value? And old value. Etc

Comment on lines 495 to 496
if(value_.name===value.name)return false
return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return A == B?
Or !(A == B)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

ref={loadingContainerRef}
overflow="hidden"
width={
value.isFailure.value || value.isSuccess.value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is duplicated in the next few lines why not make a function called

IsSuccessOrError?

@roggc roggc requested a review from ralph-dev January 3, 2022 23:09
@@ -19,6 +20,8 @@ export interface IContainerProps {
margin?: string;
positionTop?: number;
flexGrow?: boolean;
/** transition duration in ms; applied on height and opacity properties; */
transitionDuration:number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transition of what duration??

/** 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animation fo what duration?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ...null work?

[],
);

/** cancel uploading; terminate worker and remove informative panel */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use JSDOC format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is jsdoc

Comment on lines +119 to +120
/** 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed.

Comment on lines +167 to +169
/**
* load array of informative panels (values) and send order to start workers
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDOC missing Doc for Paramters / Return Type

Comment on lines +191 to +195
/**
* 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
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing paramter / return

@roggc roggc requested a review from ralph-dev January 12, 2022 09:02
Copy link
Member

@ralph-dev ralph-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect

@roggc roggc requested a review from ralph-dev January 12, 2022 17:54
@roggc
Copy link
Contributor Author

roggc commented Jan 12, 2022

@ralph-dev, what is incorrect?

@ralph-dev
Copy link
Member

@ralph-dev, what is incorrect?

Create a NeW PR should be doing two work in same PR

@roggc
Copy link
Contributor Author

roggc commented Jan 12, 2022

@ralph-dev, what is incorrect?

Create a NeW PR should be doing two work in same PR

but it is related work

@ralph-dev
Copy link
Member

@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

@ralph-dev
Copy link
Member

Let's close this PR if we don't need it @roggc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants