flushingtech / Votte_Frontend

Enables users to submit, view, and vote on ideas, fostering collaboration and innovation within the community.
0 stars 3 forks source link

Replace “Vote” Button with “Like” Button #11

Closed gent1999 closed 1 week ago

gent1999 commented 1 week ago

Objective: Update the voting mechanism by changing the "Vote" button on ideas to a "Like" button to provide a more familiar and intuitive user experience.

  1. Frontend:

    • [x] Change the button label from "Vote" to "Like" on all idea components where voting is currently implemented.
    • [x] Ensure the button visually reflects whether the user has "liked" the idea (e.g., with a color change or icon toggle).
  2. Backend:

    • [x] Update any relevant API endpoints to use terminology consistent with "Like" instead of "Vote" for clarity.
    • [x] Ensure the database and backend logic correctly handle the "like" action and that existing votes are counted as likes.
gent1999 commented 1 week ago

Database Changes:

Renamed votes table to likes. Renamed votes column in the ideas table to likes. Updated SQL references in database setup scripts to reflect the renaming. Frontend Component Updates:

LikeButton.jsx: Changed component from VoteButton to LikeButton with a heart icon for like/unlike functionality. IdeasList.jsx: Updated to use LikeButton instead of VoteButton. LikedIdeas.jsx: Updated component to display ideas liked by the user, previously VotedIdeas. API Changes (api.js):

Renamed functions to reflect "like" terminology, e.g., voteForIdea to likeIdea, unvoteForIdea to unlikeIdea. Updated getVotedIdeas and similar functions to getLikedIdeas for consistency. Backend API Routes:

Updated endpoint routes to use "like" terminology, e.g., /like/:id and /unlike/:id. Modified backend logic to handle likes instead of votes, including changes to the likes table and corresponding functions. This list provides a concise overview of the changes for easier tracking and understanding.