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
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/components/Modals/UploadDocumentModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useTheme } from '@mui/material/styles';
// Context Imports
import { DocumentListContext } from '@contexts';
// Component Imports
import { LoadingAnimation } from '@components/Notification';
import ModalBase from './ModalBase';
import { DocumentSelection, FormSection } from '../Form';
import UploadButtonGroup from './UploadButtonGroup';
Expand Down Expand Up @@ -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.

</FormSection>
</ModalBase>
);
Expand Down
10 changes: 9 additions & 1 deletion src/components/Notification/LoadingAnimation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ const LoadingAnimation = ({ loadingItem, children }) => (
padding: '20px'
}}
>
<Paper elevation={2} sx={{ display: 'inline-block', mx: '2px', padding: '20px' }}>
<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.

<Typography variant="h5" component="h2" mb={2} align="center">
Loading {loadingItem}...
</Typography>
Expand Down
Loading