All changes were made within components > liveFeed
The purpose of this pull request is to make it so when users scroll to the top of the container, it would load an additional 10 posts. This would keep going until the max posts for that container is reached.
Feature Breakdown (Scroll down for video)
queries.ts: previously we had a function grab 10 posts be it either Moderator or general posts, and then we would filter and separate it, however this mean scrolling up would grab either moderator or general posts. I wanted to separate these two types of posts so I created 2 new supabase query functions to grab moderator posts and general posts separately
useScroll.ts: previously useScrollToBottom.ts, I found that it was appropriate to merge this hook into a general useScroll.ts hook. In addition to the scroll to bottom functionality, I added a scroll to top feature as well (to induce pagination)
usePagination.ts: this hook handles the pagination for both the moderator container and the general posts container
useFetchPosts.ts: this hook is a helper hook for useLiveFeed.ts. I just broke down the fetch for both moderator posts and other posts
Pull Request Checklist
Please make sure you've checked the following items before submitting your pull request:
npm run build
)?npm run format
)?console.log
statements?Additional Technical Comments
All changes were made within
components > liveFeed
The purpose of this pull request is to make it so when users scroll to the top of the container, it would load an additional 10 posts. This would keep going until the max posts for that container is reached.
Feature Breakdown (Scroll down for video)
queries.ts
: previously we had a function grab 10 posts be it either Moderator or general posts, and then we would filter and separate it, however this mean scrolling up would grab either moderator or general posts. I wanted to separate these two types of posts so I created 2 new supabase query functions to grab moderator posts and general posts separatelyuseScroll.ts
: previouslyuseScrollToBottom.ts
, I found that it was appropriate to merge this hook into a generaluseScroll.ts
hook. In addition to the scroll to bottom functionality, I added a scroll to top feature as well (to induce pagination)usePagination.ts
: this hook handles the pagination for both the moderator container and the general posts containeruseFetchPosts.ts
: this hook is a helper hook foruseLiveFeed.ts
. I just broke down the fetch for both moderator posts and other postsFeature Demonstration
https://github.com/Firm-Collective/One-Accord/assets/63488152/ba324c76-3134-4be2-a140-dc497d1d928f