feat: update new learner display and logic for improved visibility#5
Merged
feat: update new learner display and logic for improved visibility#5
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new learner identification feature that displays visual indicators ("👋 Hi, I am a new learner" or "Learner") beneath usernames in discussion posts and comments. The implementation relies on backend API fields (is_new_learner and is_regular_learner) with fallback logic for legacy support.
Key Changes:
- Created two new hooks (
useLearnerStatusanduseIsNewLearner) to encapsulate learner status determination logic - Updated discussion components to pass
postDataprop through the component tree for learner status access - Added internationalized messages for new and regular learner indicators
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/discussions/posts/post/PostLink.jsx |
Extracts threadData and passes it to AuthorLabel via postData prop |
src/discussions/posts/post/PostHeader.jsx |
Adds postData prop to component signature and forwards it to AuthorLabel |
src/discussions/posts/post/Post.jsx |
Extracts threadData and passes it to child components |
src/discussions/posts/post-editor/PostEditor.test.jsx |
Adds missing key prop to Route mapping |
src/discussions/post-comments/comments/comment/Reply.jsx |
Extracts commentData and passes it to header and author components |
src/discussions/post-comments/comments/comment/CommentHeader.jsx |
Adds postData prop and forwards it to AuthorLabel |
src/discussions/post-comments/comments/comment/Comment.jsx |
Passes comment data to CommentHeader |
src/discussions/messages.js |
Defines internationalized messages for learner indicators |
src/discussions/data/hooks/useLearnerStatus.js |
New hook that determines learner status from API data with fallback logic |
src/discussions/data/hooks/useIsNewLearner.js |
Convenience wrapper around useLearnerStatus |
src/discussions/common/AuthorLabel.test.jsx |
Adds test coverage for learner message display logic |
src/discussions/common/AuthorLabel.jsx |
Implements learner message display below username |
src/discussions/common/AlertBar.jsx |
Adds postData prop and forwards it to AuthorLabel |
src/discussions/common/AlertBanner.jsx |
Adds postData prop and forwards it to AlertBar |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5c42e5f to
ac2f7b9
Compare
adad012 to
5219e3f
Compare
396902e to
aea6f1a
Compare
aea6f1a to
0e1d4fa
Compare
63bffbe to
2dab849
Compare
adbac96 to
9f8a570
Compare
cc7eeed to
23bb5bc
Compare
66abed4 to
73626e8
Compare
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.
Description
This update introduces a new feature that displays a "New Learner" message beneath usernames in discussion posts and comments for users identified as new learners. The feature helps learners and staff quickly recognize new participants, improving clarity and community interaction.
The implementation integrates backend API fields for learner status, with fallback logic to support legacy and edge cases. Core discussion components were updated to pass learner status data through the component tree, along with new hooks and test coverage to ensure consistent and reliable functionality.
Features
useLearnerStatus– encapsulates learner status logic and consumes API data.useIsNewLearner– determines whether a user qualifies as a new learner.AuthorLabel,CommentHeader,Reply, andPostto receive and propagate a newpostDataprop containing learner status.messages.js.Linked PRs
Screenshot
Jira Ticket
COSMO2-735