Skip to content
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

add loading animation to upload doc modal #654

Open
wants to merge 6 commits into
base: Development
Choose a base branch
from

Conversation

russfraze
Copy link
Contributor

@russfraze russfraze commented Jun 11, 2024

This PR:

Resolves #(654)

Screenshots (if applicable):

Add any screenshots/videos here.

Additional Context (optional):

I've implemented this and you can see the loading animation for a split second when uploading a document. I uploaded a 12MB image and it still only takes a split second. I'm wondering if that is because I am using the local pod server?

I think this loading animation makes for a better user experience if the file is large enough to take a couple of seconds, for sure.

Future Steps/PRs Needed to Finish This Work (optional):

This needs further styling to match the Figma file.

Issues needing discussion/feedback (optional):

Currently, the loadingAnimation component delivers an indeterminant progress bar which is fine, but the Figma file shows a determinate progress bar with a percentage of the upload progress. Let me know if we intend to have a determinate progress bar here and I can look into how to make that work.

@russfraze russfraze linked an issue Jun 11, 2024 that may be closed by this pull request
@russfraze russfraze marked this pull request as draft June 11, 2024 18:21
@russfraze russfraze self-assigned this Jun 11, 2024
@russfraze russfraze requested a review from andycwilliams June 11, 2024 18:43
@andycwilliams
Copy link
Member

Just to make sure, is this still a draft or are you looking for a review already?

@russfraze
Copy link
Contributor Author

@andycwilliams this is still a draft, for sure. I should have just pinged you instead of requesting a review.

@@ -222,6 +223,7 @@ const UploadDocumentModal = ({ showModal, setShowModal }) => {
</DialogActions>
</FormControl>
</form>
{processing && <LoadingAnimation loadingItem={file.name} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than it being condition within the FormSection component, I think it should be wrapping it as part of a ternary:

{ processing ? <LoadingAnimation /> : <FormSection>modal content here</FormSection> }
Screen.Recording.2024-06-26.at.12.54.50.AM.mov

Copy link
Member

Choose a reason for hiding this comment

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

So it would fully replace all of the content with the animation?

I prefer to stay with the Figma design. I think it looks a bit nicer and is less jarring than taking over the whole modal.

Copy link
Contributor

Choose a reason for hiding this comment

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

The previous animation that's dangling at the bottom of the modal does not seem any better either. Might want to use a different kind of animation if not the full content

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could look at a solution where the size of the modal does not change, which is jarring, and the loading animation displays over top of the modal with the content greyed out or removed. I don't mind the content being removed as long as the size of the modal doesn't change.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could look at a solution where the size of the modal does not change, which is jarring, and the loading animation displays over top of the modal with the content greyed out or removed. I don't mind the content being removed as long as the size of the modal doesn't change.

We could try that. Or else the animation could temporarily replace one of the buttons (while retaining the size). Maybe "Upload File".

Thinking farther ahead, in #642 I mention possibly breaking down this whole process into several steps. That may or may not affect what we decide here.

Copy link
Contributor Author

@russfraze russfraze Jun 29, 2024

Choose a reason for hiding this comment

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

@andycwilliams @leekahung this is the clip I tried to post. I'm not sure why it wasn't working before.

Screen.Recording.2024-06-28.at.7.08.32.PM.mov

Copy link
Member

Choose a reason for hiding this comment

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

Ah, well that's pretty different! I'll take a closer look tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

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

@andycwilliams @leekahung this is the clip I tried to post. I'm not sure why it wasn't working before.

Screen.Recording.2024-06-28.at.7.08.32.PM.mov

I like this one 👍

Copy link
Member

@andycwilliams andycwilliams Jul 1, 2024

Choose a reason for hiding this comment

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

I don't know why, but it's still displaying the way it does in my screenshot. It's not appearing as an overlay in either desktop or mobile modes even after pulling the latest version of the branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andycwilliams Apologies - I did not push the changes I made to the code until just now.

@andycwilliams andycwilliams added the enhancement Enhancement of existing features label Jun 27, 2024
Copy link
Member

@andycwilliams andycwilliams left a comment

Choose a reason for hiding this comment

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

Since this is still a draft I'm not doing a full on review, just adding a couple of thoughts.

Looking pretty nice though!

</FormSection>
<Backdrop open={processing}>
<LoadingAnimation loadingItem="file name" />
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't loadingItem="file name" still be loadingItem={file.name}?

Comment on lines 36 to 44
<Paper
elevation={2}
sx={{
display: 'inline-block',
mx: '2px',
padding: '20px',
backgroundColor: 'background.tint'
}}
>
Copy link
Member

Choose a reason for hiding this comment

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

While this works for this animation, it consequently affects other uses of this animation as well, such as when loading contacts or documents.

2024-07-01 (1)

The box is now gray rather than white. Not a huge deal or anything, just an unintended side effect.

Best practice would be to carve out an exception for this. However, I'd like to do #643, which would refactor animations a tad anyway.

@andycwilliams
Copy link
Member

Any updates @russfraze?

@andycwilliams
Copy link
Member

Without any updates this PR might need to be closed or reassigned.

@russfraze
Copy link
Contributor Author

@andycwilliams I forgot about this, but back on it. I passed an isModal prop to the LoadIngAnimation component so that the background tint color is only if the LoadingAnimation is being used in a modal. The rest of the time it remains white.

@andycwilliams
Copy link
Member

Thanks for continuing work on this!

Looks like this branch has not been merged with the latest version of Development so it's behind a bit. Could you update it, please?

@russfraze russfraze marked this pull request as ready for review December 20, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discovery] - Add loading animation to modals
3 participants