WS-2956 POC - FOllow topic module with UAS endpoints - #14274
Draft
jinidev wants to merge 4 commits into
Draft
Conversation
jinidev
commented
Jul 28, 2026
| @@ -0,0 +1,21 @@ | |||
| import { FOLLOWS_CONFIG } from '#app/lib/uasApi/uasUtility'; | |||
Contributor
Author
There was a problem hiding this comment.
This hook has significant structural duplication with useUASFetchSaveStatus hook, that could be unified.
So created a shared factory function (createUASStatusHook) that returns a hook for fetch functions
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a POC “Follow Topic” capability on Topic pages backed by UAS (User Activity Service), reusing existing UAS patterns (payload building + TanStack Query caching) and generalising status fetching across activities.
Changes:
- Introduces
FollowTopicButton(authenticated + guest experiences) and wires it intoTopicPage. - Adds a generic
useUASStatusHookfactory and refactors saved-article status fetching to use it; adds topic follow status + mutation hooks. - Extends UAS utilities/config and query keys to support a new
followsactivity type and topic metadata payloads.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/pages/TopicPage/TopicPage.jsx | Renders the Follow Topic button on topic pages and passes topic metadata. |
| src/app/models/types/translations.ts | Adds followTopicButton translation typing. |
| src/app/lib/uasApi/uasUtility.ts | Adds FOLLOWS_CONFIG, topic-follow payload + metadata helpers. |
| src/app/lib/uasApi/queryKeys.ts | Adds TanStack Query keys for follows status/list to avoid cache collisions. |
| src/app/lib/config/services/hindi.ts | Adds Hindi translations for Follow Topic button. |
| src/app/hooks/useUASStatusHook.ts | Introduces generic factory for UAS “status” queries (saved/followed). |
| src/app/hooks/useUASFetchSaveStatus/index.ts | Refactors saved-article status hook to use the generic status factory. |
| src/app/hooks/useTopicFollowStatus/index.ts | Adds a topic-specific wrapper hook for follow status. |
| src/app/hooks/useTopicFollowButton/index.ts | Adds follow/unfollow mutation hook with cache updates. |
| src/app/components/SaveButton/index.tsx | Adds TODO note about icon support for multiple button types. |
| src/app/components/FollowTopicButton/index.tsx | New feature component deciding between authenticated vs guest experiences. |
| src/app/components/FollowTopicButton/index.styles.ts | Layout styling for the Follow Topic button wrapper. |
| src/app/components/FollowTopicButton/FollowTopicButtonGuest/index.tsx | Guest follow CTA that opens sign-in modal and tracks clicks/views. |
| src/app/components/FollowTopicButton/FollowTopicButtonAuthenticated/lazy.tsx | Client-only lazy loading for authenticated follow button. |
| src/app/components/FollowTopicButton/FollowTopicButtonAuthenticated/index.tsx | Signed-in follow/unfollow UI with analytics and accessibility labels. |
jinidev
marked this pull request as draft
July 29, 2026 08:22
elvinasv
reviewed
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves JIRA: https://bbc.atlassian.net/browse/WS-2956
Summary
This pull request introduces a new "Follow Topic" button feature, allowing users to follow or unfollow topics, with personalized behavior for authenticated and guest users. The implementation leverages a new generic UAS (User Activity Service) status hook, adds new API utility functions and configuration. The changes also refactor and generalize UAS status fetching for both "favourites" and "follows" activities.
Code changes
Follow Topic Button Feature
FollowTopicButtoncomponent that conditionally renders an authenticated or guest version based on personalization availability and user status. The authenticated version allows following/unfollowing topics, while the guest version prompts sign-in.UAS Status Hook Refactor and Extension
useUASStatusHookfactory to handle fetching "status" (e.g., isSaved, isFollowed) for arbitrary UAS activities, reducing duplication and simplifying both "favourites" and "follows" logic.useUASFetchSaveStatusto use the new generic status hook.useTopicFollowStatushook using the generic status hook for topics.useTopicFollowButtonto handle follow/unfollow mutations and update TanStack Query cache.UAS API Utilities and Configuration
FOLLOWS_CONFIGfor the new "follows" activity type, mirroring the existing "favourites" config, and utility functions for topic follow payloads and metadata.Testing
Visit any topic page in localhost
Make sure user is signed in
Follow button would be visible at the top.
Can test follow and unfollow.
Can check REACT_QUERY_CACHE
Screen.Recording.2026-08-05.at.17.16.13.mov