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

Adding Guitars Delete Action + Corresponding UI #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LiorKGOW
Copy link
Owner

@LiorKGOW LiorKGOW commented Jan 12, 2023

Now users can delete guitars from the UI
They will need to refresh the page in order to see their changes, but the DB is updated

TODO:

  • Fix broken test - GuitarGallery.test.js

Added an 'X' button in each GalleryItem (+ status of the Gallery before the deletion of "LikeSea" guitar):
Added an 'X' button in each GalleryItem (+ status of the Gallery before the deletion of "LikeSea" guitar)

Clicking the 'X' button opens a deleteModal (for instance here for the guitar with a name of "LikeSea"):
Clicking on the button opens a deleteModal (delete action)

DB before delete of 28, using rails console:
DB before delete of 28, using rails console

Server output after confirming the deletion of "LikeSea":
Server output after confirming the deletion

Gallery after "LikeSea" was deleted from the DB:
Gallery after "LikeSea" was deleted from the DB

Search fails after trying to find guitar with id of 28 (corresponding to the guitar with the name "LikeSea") in the DB using rails console:
Search fails after trying to find guitar with id of 28 (corresponding to the guitar with the name "LikeSea") in the DB using rails console

@LiorKGOW LiorKGOW self-assigned this Jan 12, 2023
@LiorKGOW LiorKGOW added the Ready for Review This PR is ready for reviews label Jan 12, 2023
@LiorKGOW LiorKGOW force-pushed the delete-operation branch 2 times, most recently from ac06bff to 7f10073 Compare January 16, 2023 18:12
<CardTitle>{name}</CardTitle>
<CardBody>Price: {price}</CardBody>
<CardFooter>Description: {description}</CardFooter>
</GridItem>
</Grid>
</Card>

{isDeleteModalOpen && (
Copy link
Owner Author

Choose a reason for hiding this comment

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

isDeleteModalOpen is used here to keep the DOM from being over packed with elements
(each GuitarInfo had a Modal as a subcomponent, while now only the one DeleteModal who is open would be loaded to the DOM)
Thank you @MariaAga for mentioning it 🙏🏼
https://reactjs.org/docs/conditional-rendering.html#inline-if-with-logical--operator

@LiorKGOW LiorKGOW force-pushed the delete-operation branch 8 times, most recently from 36874a6 to ae00753 Compare January 18, 2023 16:07
Now users can delete guitars from the UI
The DB & the Presented Gallery is Updated immediately after submitting the changes.
@LiorKGOW LiorKGOW force-pushed the delete-operation branch from ae00753 to 526b947 Compare May 17, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Review This PR is ready for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant