-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In amazon s3 #55
In amazon s3 #55
Conversation
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just some readability and rewriting some repeated code comments.
in addition looks like you're disabling a lot of eslint warnings - what is currently the warning?
setImgSrc(src); | ||
const { updateSnackBarMessage } = useSnackBar(); | ||
const handleImageUpload = (event: ChangeEvent<HTMLInputElement>): void => { | ||
if (userState.background === '' && event.target.files?.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe store event.target.files
in a variable - you're accessing it multiple times in this block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do that.
if (userState.background === '' && event.target.files?.length) { | ||
const background = URL.createObjectURL(event.target.files[0]); | ||
dispatchUserContext({ type: 'UPLOAD_BACKGROUND', background }); | ||
// eslint-disable-next-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is currently the eslint issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is resolved when I store event.target.files
in a variable.
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
// eslint-disable-next-line | ||
const handleTabIndexChange = (event: any, newValue: number): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to assume you are disabling the 'no-implicit-any' warning here. I would suggest to add a type to that event and remove the eslint warning that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn't specify type of this is because this is backlog issue with material-ui. However, I guess I can specify this type ChangeEvent<{}>
but then this type gives me these errors:
Line 46:52: Don't use `{}` as a type. `{}` actually means "any non-nullish value".
- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.
- If you want a type meaning "any value", you probably want `unknown` instead.
- If you want a type meaning "empty object", you probably want `Record<string, never>` instead @typescript-eslint/ban-types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would take a look at where you are firing the event and it generally gives you an idea of what the type should look like. Event types are tricky in React, I tend to just start at the source of where I am firing this event and then copy what I see in my editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you seen the MUI contributors comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I have tried the SyntheticEvent
but it doesn't work. But following your advise, I looked at the console.log of event and found out that the event type is BaseSyntheticEvent
. Thank you for your help.
// store locationUrl in Database; | ||
const locationUrl = data.Location; | ||
locationUrls.push({ locationUrl, key: data.key }) | ||
if (locationUrls.length === fieldNames.length) { | ||
return res.status(201).json({ | ||
locationUrls, | ||
success: "File are saved successfully." | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a comment about adding it to the database but there is no persisting the location urls to the profile model. Also, what if a user wants to just upload a profile photo? Right now on the front-end it requires them to upload a background image then a profile image. For a UX perspective this is not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have handle the usecase for location urls in #57 pr.
Also, I understand that this is not a very good UX experience. Initially, I wanted to do something like this. But material ui doesn't support this right now. What I can do is provide a radio button to user to choose which image they want to upload. It's not very good UX, but it will decent one. What are your thoughts on this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's something that can be addressed later, I would do some further research into potential solution here. I will say, Material UI is not blocking this feature from happening. But, feel free to visit this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking good, I left some comments on your PR to address.
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
@moffatethan I have made the changes. Please let me know about them. |
@@ -30,6 +30,7 @@ export default function Dashboard(): JSX.Element { | |||
return ( | |||
<Grid container component="main" className={`${classes.root} ${classes.dashboard}`}> | |||
<CssBaseline /> | |||
<Link to="/settings">Profile</Link> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be in the AuthNavbar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me, before merging if you could take a look into the placement of the settings link and move it to a more suitable file such as AuthNavbar. Thank you!
Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
What this PR does (required):
Screenshots / Videos (required):
Any information needed to test this feature (required):
/settings
url and navigate to Profile Photo tab to test this feature.Any issues with the current functionality (optional):
No