This week I was able to use ChatGPT to help me create two buttons, Follow and Unfollow, one for each table in our user-home page: Users and Following. After the buttons were created, GPT struggled with adding new functions to the existing web page. I’m still learning how to write my queries to GPT but after an hour of struggling I had to revert to the old method – manual function creation. I was able to utilize some existing patterns our codebase has to create these new functions to add data to the “followers” table, as well as querying the data to update the tables in our web page.
Overall, I got the followers table to show up to show who the user is following for the user who is logged in. I also got a new “follow” button working that follows/subscribes to a user in the user table. I added a placeholder “unfollow” button that I will work on next week. Below explains the features I implemented this week:
Feature: I added a “Follow” button to the Users table.
- When pressed, the new “Following table” that I created is populated with the users you follow (no page refresh needed).
- I also have an alert that pops up if you try to follow a user more than once (duplicate prevention).
- I added the subscriber/publisher ids to the table just to be helpful for debugging and whatnot.
Limitations/known issues of this feature:
- The “follow” button is hard coded and does not dynamically update to show if you already follow that user. So even if you follow that user, it still says “follow”. I could look into doing a join next week to get that working dynamically if we want.
Feature: I also added a “unfollow” button on the “Following table”
- Doesn’t work quite yet but I do have an alert that says “coming soon” when it’s tapped. I will work on this functionality next week.
Leave a Reply