Repository navigation
feat(ChannelHeader): add a Title slot and export the default subtitle - #3367
MartinCupela wants to merge 2 commits into
Conversation
ChannelHeader takes a Title component that replaces only the title and receives the channel and its display title, so an app can render the title as a button without rebuilding the header. The default, ChannelHeaderTitle, renders the same markup as before. ChannelHeaderSubtitle and useChannelHeaderOnlineStatus are exported, so a custom header keeps the translated Online/Offline for direct messages and the typing transition.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Override API and rendering src/components/ChannelHeader/ChannelHeader.tsx, src/components/ChannelHeader/index.ts, src/components/ChannelHeader/hooks/useChannelHeaderOnlineStatus.ts, src/components/ChannelHeader/__tests__/ChannelHeader.test.tsx, ai-docs/ai-migration-v14-v15.md |
ChannelHeader accepts Title and Subtitle overrides. The default title receives the channel and display title. The default subtitle retains typing and online-status behavior. Tests cover custom components, online-status text, and accessibility. The migration guide documents the API. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Suggested reviewers: oliverlaz, nikolagorannaumovski
Merge Risk: 
Minimal Β· up to 088c1
-
No merge-blocking risk was identified for the new header slots and exports.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the main change: a new Title slot on ChannelHeader, plus exporting the default subtitle. It follows the conventional commit style and matches the changeset, which adds Title and Subtitle props, exports ChannelHeaderSubtitle and useChannelHeaderOnlineStatus, and adds tests and docs. The title mentions the Title slot and the subtitle export but not the Subtitle slot, which is a minor gap, not a mismatch.
Full details: Description check
-
Explanation
The description follows the template. The Goal section explains why the change is needed: the title cannot be swapped without rebuilding the header, and the default subtitle was not exported. The Implementation details section covers the Title and Subtitle props, the exports, the unchanged default markup, the tests, and the migration guide. The UI Changes section states that there are no default UI changes. It includes a code example and a list of getstream.io docs to update. The description is complete and clear.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
π Generate docstrings
-
- Commit to this branch
- Create a new PR
π§ͺ Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
ChannelHeader takes a Subtitle component that replaces only the subtitle. The default stays ChannelHeaderSubtitle.
|
Size Change: +519 B (+0.06%) Total Size: 905 kB π¦ View Changed
βΉοΈ View Unchanged
|
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3367 +/- ##
==========================================
+ Coverage 88.63% 88.86% +0.23%
==========================================
Files 563 563
Lines 17138 17159 +21
Branches 5246 5255 +9
==========================================
+ Hits 15190 15249 +59
+ Misses 1948 1910 -38 β View full report in Codecov by Harness. π New features to boost your workflow:
|
Ticket: https://linear.app/stream/issue/REACT-1442
π― Goal
ChannelHeaderlets an app swapAvatar,StartContentandEndContent, but not the title, so making the title clickable (for example, to open channel details) meant rebuilding the whole header. A rebuilt header also lost the default subtitle, because it wasn't exported: a direct message showed "2 members Β· N online" instead of Online/Offline, and the typing transition was gone.π Implementation details
ChannelHeadertakes aTitleprop that replaces only the title. It receives{ channel, displayTitle }(ChannelHeaderTitleProps), wheredisplayTitlealready includes thetitleoverride. The subtitle stays below it.ChannelHeadertakes aSubtitleprop that replaces only the subtitle, defaulting toChannelHeaderSubtitle. A custom subtitle reads the channel withuseChannel()and the status text withuseChannelHeaderOnlineStatus().ChannelHeaderTitle, renders the samediv.str-chat__channel-header__data__titleas before, so the default markup is unchanged.ChannelHeaderSubtitleanduseChannelHeaderOnlineStatusare exported from the package root, with JSDoc.<button>title (its props, rendering, click, and axe), a custom subtitle replacing the default (with axe), andChannelHeaderSubtitleshowing Online and Offline for a direct message.ai-docs/ai-migration-v14-v15.md, section 8: one bullet onTitle,Subtitleand the subtitle exports.Docs needed on getstream.io (v15)
TitleandSubtitleprops and theChannelHeaderTitlePropstable, and listChannelHeaderTitle,ChannelHeaderSubtitleanduseChannelHeaderOnlineStatus.Titlethat renders a<button>), and mentionChannelHeaderSubtitlefor custom headers.TitleandSubtitlenext toAvatar,StartContentandEndContentas aChannelHeaderprop slot.π¨ UI Changes
None by default.
Summary by CodeRabbit