Project-Chirp / chirp-frontend

Frontend of Chirp
2 stars 3 forks source link

T93, T112: Delete posts #109

Closed NasihNazeem closed 2 months ago

NasihNazeem commented 4 months ago

Related Issues

Closes #93 and closes #112

Summary

This branch includes two features. In this branch we create a post menu for each post item and expanded post item. This menu allows users to edit, delete posts and copy link of post. It is crucial that the author of the post is the only one with access to edit and delete the post. Copy link is public to anybody who has access to the post

The second feature is integrating deletion of the post functionality

Changes Made

To start, I created a new deletePost reducer in the store for posts. This allowed me to instantly make changes to the post list. I created a delete request to the backend that passes parameters such as the postId and the userId. To use on both the expanded post item and post items, I created a reusable component called PostMenu that encapsulates most of the functionality in this PR

Screenshots

Open Menu

Open Menu

Testing Instructions

No additional testing instructions

Special Notes for Your Reviewer(s)

The template is still up for debate so please do suggest any changes you think are appropriate

Dennull commented 3 months ago

If you're up for it, I'd love to see some extra improvements around confirmation too. Usually when you delete things on apps there's a confirmation dialog, so I think that'd be cool to add as an extra step right before the post deletes

We should also add a toast to display that the post was deleted, but I think there's a draft ticket for toasts in the backlog already