DEV Community

Cover image for Enhancing User Experience with Dislike and Undo Features in a Freelancer-Client Matching App
Arash Jangali
Arash Jangali

Posted on

Enhancing User Experience with Dislike and Undo Features in a Freelancer-Client Matching App

Day 102 of #365DaysOfCode
Today's work focused on implementing the dislike functionality and adding an undo button for instances when a user accidentally dislikes a freelancer. This enhancement allows users to reverse their decision and reconsider their choices, thereby improving the overall user experience of the application.

Step 1: Creating an array of disliked users

The first step in implementing the undo feature was to create an array of disliked users in the database. This array would store the user IDs of the freelancers that the client did not want to work with.

Step 2: Implementing the 'dislike' button

Next, I implemented the 'dislike' button functionality. When a user clicks the 'dislike' button, the disliked freelancer's ID is added to the user's array of disliked freelancers. The current index is then updated and the disliked freelancer is added to the swiped cards array.

Step 3: Adding the 'undo' button functionality

The 'undo' button functionality is the core of this blog post. When a user clicks the 'undo' button, the last swiped card is removed from the swiped cards array, and the current index is reset to the last swiped card's index. If the last swiped card was 'liked', the freelancer is removed from the liked array; if it was 'disliked', the freelancer is removed from the disliked array.

Top comments (0)