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

implement and style modal #1552

Merged
merged 5 commits into from
Dec 13, 2023
Merged

Conversation

bkmorgan3
Copy link
Member

@bkmorgan3 bkmorgan3 commented Dec 5, 2023

Fixes #1391

What changes did you make and why did you make them ?

  • Create ChangesModal Component
  • trigger modal in New Project Form before discarding changes
  • ensure functionality

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

Visuals before changes are applied

image

Visuals after changes are applied

Screenshot 2023-12-04 at 5 47 58 PM

Copy link

github-actions bot commented Dec 5, 2023

Want to review this pull request? Take a look at this documentation for a step by step guide!

From your project repository, check out a new branch and test the changes.

git checkout -b bkmorgan3-1391/onClose-modal development
git pull https://github.com/bkmorgan3/VRMS.git 1391/onClose-modal

@bkmorgan3 bkmorgan3 requested a review from trillium December 5, 2023 01:55
Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

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

Thanks for getting this ball rolling. We need this Modal!

Requesting a few changes. This is great work so far!

client/src/components/ProjectForm.js Outdated Show resolved Hide resolved
client/src/components/ChangesModal.js Outdated Show resolved Hide resolved
client/src/components/ChangesModal.js Outdated Show resolved Hide resolved
<Typography sx={{textAlign: 'center'}} id="modal-modal-title" variant="h4" component="h4">
Wait! You made some changes.
</Typography>
<Typography id="modal-modal-description" sx={{ mt: 2 }}>
Copy link
Member

Choose a reason for hiding this comment

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

Please center this text

Copy link
Member Author

Choose a reason for hiding this comment

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

@spiteless All changes are made and ready for review

Copy link
Member

Choose a reason for hiding this comment

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

There's an error somewhere with the icon imports:

[0] Mongoose connected from runServer() and is listening on 4000
[1] Browserslist: caniuse-lite is outdated. Please run:
[1]   npx update-browserslist-db@latest
[1]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[1] Failed to compile.
[1] 
[1] ./src/components/ChangesModal.js
[1] Module not found: Can't resolve '@mui/icons-material/WarningAmberRounded' in '/Users/trilliumsmith/code/VRMS/VRMS3/client/src/components'
[1] Compiling...
[1] Failed to compile.
[1] 
[1] ./src/components/ChangesModal.jsx
[1] Module not found: Can't resolve '@mui/icons-material/WarningAmberRounded' in '/Users/trilliumsmith/code/VRMS/VRMS3/client/src/components'

Not sure what's causing that, it was happening too with the react icon you used earlier and I just added it to the package.json to test.

This is on top of navigating to ./client/ and running yarn install again

client/src/components/ChangesModal.js Outdated Show resolved Hide resolved
variant="contained"
cursor="pointer"
onClick={handleOpen}
Copy link
Member

Choose a reason for hiding this comment

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

The open/close logic needs a bit more work.

Right the modal is opens warning of changes even if no changes were made.

Modal should open if:

  • Changes were made to the form the modal is referencing and
    • The user tries to navigate away from the current page
    • The user presses the Close button

The Modal should not open if:

  • The user tries to navigate away from then page and no changes were made
  • The user presses the close button and no changes were made

Some sort of ModalShouldTrigger prop might help so that the parent component can determine when the modal should mess with user navigation.

const backToSearch = () => {
setUserToEdit({});
};
// const backToSearch = () => {
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure changes to this file were a mistake, please undo changes to UserAdmin.js.

package.json Outdated
@@ -20,7 +20,8 @@
"concurrently": "^5.3.0",
"cross-env": "^7.0.2",
"cross-var": "^1.1.0",
"dotenv-cli": "^3.2.0"
"dotenv-cli": "^3.2.0",
"react-icons": "^4.12.0"
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer if we kept our icon usage in MUI's icon library if possible so we don't have to take on other dependencies.

Alternate icon suggestion:
https://mui.com/material-ui/material-icons/?query=warn&theme=Rounded

Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

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

Good job on this one Brad, thank youq

@@ -17,6 +17,7 @@
"test:all": "cross-env NODE_ENV=test npm run test:client && npm run test:client-mvp && npm run test:backend && npm run test:cy"
},
"dependencies": {
"@mui/icons-material": "^5.14.19",
Copy link
Member

Choose a reason for hiding this comment

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

Lol, I thought we would not have to add another dependency. At least sits in the MUI ecosystem

onClose={handleClose}
destination={'/projects'}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
Copy link
Member

Choose a reason for hiding this comment

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

Please remove these two props, they're already added to the model

variant="contained"
cursor="pointer"
onClick={Object.keys(dirtyFields).length > 0 ? handleOpen: checkFields}
Copy link
Member

Choose a reason for hiding this comment

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

Suggests renaming checkFields to something related to navigation. It makes sense after looking at it for a minute, but if it was something like ? openModel : continueNavigation it might be easier for the next person who has to maintain it.

Copy link
Member

Choose a reason for hiding this comment

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

Which is very weird because your PR adds "@mui/icons-material": "^5.14.19", to ./client/package.json

<Typography sx={{textAlign: 'center'}} id="modal-modal-title" variant="h4" component="h4">
Wait! You made some changes.
</Typography>
<Typography id="modal-modal-description" sx={{ mt: 2 }}>
Copy link
Member

Choose a reason for hiding this comment

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

There's an error somewhere with the icon imports:

[0] Mongoose connected from runServer() and is listening on 4000
[1] Browserslist: caniuse-lite is outdated. Please run:
[1]   npx update-browserslist-db@latest
[1]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[1] Failed to compile.
[1] 
[1] ./src/components/ChangesModal.js
[1] Module not found: Can't resolve '@mui/icons-material/WarningAmberRounded' in '/Users/trilliumsmith/code/VRMS/VRMS3/client/src/components'
[1] Compiling...
[1] Failed to compile.
[1] 
[1] ./src/components/ChangesModal.jsx
[1] Module not found: Can't resolve '@mui/icons-material/WarningAmberRounded' in '/Users/trilliumsmith/code/VRMS/VRMS3/client/src/components'

Not sure what's causing that, it was happening too with the react icon you used earlier and I just added it to the package.json to test.

This is on top of navigating to ./client/ and running yarn install again

@trillium trillium merged commit 82f608a into hackforla:development Dec 13, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prompt user to consent to discarding form info on Close click
2 participants