Reels - april1703/SpotiReels GitHub Wiki

Reels page

Page in which the user can look to see which songs other users have posted. They can interact with posts by liking, disliking, commenting, or adding that song to their liked songs page.

Creating posts

The right-hand sidebar includes a post composer, allowing users to create new posts by searching for a song and adding an optional caption. At the end of the feed, users also see recommended accounts to follow.

Liking/Disliking

In each post, the user is given the option to like or dislike using either button. The like count is kept track of.

Functionality

  • When Like button is pressed, toggleLike(postId) checks to see if the post is already liked, adds it to likedByMe.
  • The numeric count is increased by 1.

Recommended Users Section

At the bottom of the users feed, there is a section of 5 users that the app has chosen to show that user. There is a follow button next to the account name. These accounts are recommended at random.

Functionality

  • The client side calls fetchRecommendedUsers({ username, limit }) which then does a GET request to recommend/users?username=<me>&limit=<limit>.
  • The server normalizes to lowercase and then runs a SQL SELECT that excludes you and other users you already follow.
  • It then gives you 5 random users to follow.
⚠️ **GitHub.com Fallback** ⚠️