Skip to content

feat(storybook): add RoomHeader stories for slot variants and room types#39902

Open
Deepvamja wants to merge 1 commit into
RocketChat:developfrom
Deepvamja:feat/storybook-room-header
Open

feat(storybook): add RoomHeader stories for slot variants and room types#39902
Deepvamja wants to merge 1 commit into
RocketChat:developfrom
Deepvamja:feat/storybook-room-header

Conversation

@Deepvamja
Copy link
Copy Markdown

@Deepvamja Deepvamja commented Mar 27, 2026

Adds Storybook stories for the RoomHeader component to improve visual
documentation and establish a baseline for the Room Header Buttons Ordering feature.
Currently, RoomHeader has unit tests (RoomHeader.spec.tsx) but no Storybook
stories. This PR fills that gap, following the exact pattern of RoomInviteHeader.stories.tsx.

Stories Added

Story What it demonstrates
Default Channel header with default toolbox
WithToolboxHidden Header with toolbox hidden (invite view pattern)
WithCustomToolboxContent Slot-based toolbox content injection
WithToolboxPreAndPosSlots Pre and pos toolbox slot rendering
DirectMessage DM room type header variant

Summary by CodeRabbit

  • Tests & Documentation
    • Added Storybook stories for the RoomHeader component with various configuration scenarios, enabling improved development and design review workflows.

@Deepvamja Deepvamja requested a review from a team as a code owner March 27, 2026 14:15
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 27, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 27, 2026

⚠️ No Changeset found

Latest commit: 3f2376e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 27, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

Walkthrough

A new Storybook story file is added for the RoomHeader component, providing multiple test scenarios including default rendering, hidden toolbox, custom toolbox content, and direct message variations with both channel and DM room types.

Changes

Cohort / File(s) Summary
Storybook Stories
apps/meteor/client/views/room/Header/RoomHeader.stories.tsx
Added story file with five exported stories demonstrating RoomHeader rendering with various toolbox configurations and room types (channel and direct message).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding Storybook stories for the RoomHeader component with focus on slot variants and room types, which directly matches the file addition and story exports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/meteor/client/views/room/Header/RoomHeader.stories.tsx (2)

30-33: Remove block comments from this TSX implementation file.

Line [30], Line [36], Line [50], Line [68], and Line [91] add descriptive block comments; this repository rule asks to avoid code comments in implementation files.

As per coding guidelines, "Avoid code comments in the implementation".

Also applies to: 36-39, 50-53, 68-71, 91-93

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/room/Header/RoomHeader.stories.tsx` around lines 30
- 33, The file RoomHeader.stories.tsx contains multiple block comments (around
the Default RoomHeader story and others) that violate the rule against comments
in implementation files; remove those block comments (the multi-line /* ... */
blocks located near the Default RoomHeader story and the other comment blocks at
the indicated positions) so the TSX file contains only code and concise story
metadata (use story titles/args if descriptive text is needed), leaving the
component exports (e.g., the story definitions for RoomHeader) unchanged.

15-21: Unify room provider by deriving roomOverrides from context.args.room in the meta decorator.

The meta decorator at line 15 hardcodes roomOverrides={mockedChannel}, and DirectMessage at line 98 adds a separate decorator with roomOverrides={mockedDM}. This creates duplicate provider setup. Use context.args in the meta decorator to read the room value from story args, then remove the redundant DirectMessage.decorators block.

♻️ Proposed refactor
 const meta = {
 	component: RoomHeader,
 	args: {
 		room: mockedChannel,
 	},
 	decorators: [
-		(story) => (
-			<FakeRoomProvider roomOverrides={mockedChannel}>
-				{story()}
+		(Story, context) => (
+			<FakeRoomProvider roomOverrides={context.args.room}>
+				<Story />
 			</FakeRoomProvider>
 		),
 	],
 	parameters: {
 		layout: 'fullscreen',
@@
 export const DirectMessage: Story = {
 	args: {
 		room: mockedDM,
 	},
-	decorators: [
-		(story) => (
-			<FakeRoomProvider roomOverrides={mockedDM}>
-				{story()}
-			</FakeRoomProvider>
-		),
-	],
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/room/Header/RoomHeader.stories.tsx` around lines 15
- 21, Update the meta decorator to derive FakeRoomProvider's roomOverrides from
the story args (use context.args.room) instead of the hardcoded mockedChannel,
and then remove the redundant DirectMessage.decorators block that sets
roomOverrides={mockedDM}; specifically modify the meta decorator that currently
renders <FakeRoomProvider roomOverrides={mockedChannel}> to read room data from
context.args (so FakeRoomProvider gets roomOverrides={context.args.room}) and
delete the separate DirectMessage.decorators entry to unify provider setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/meteor/client/views/room/Header/RoomHeader.stories.tsx`:
- Around line 30-33: The file RoomHeader.stories.tsx contains multiple block
comments (around the Default RoomHeader story and others) that violate the rule
against comments in implementation files; remove those block comments (the
multi-line /* ... */ blocks located near the Default RoomHeader story and the
other comment blocks at the indicated positions) so the TSX file contains only
code and concise story metadata (use story titles/args if descriptive text is
needed), leaving the component exports (e.g., the story definitions for
RoomHeader) unchanged.
- Around line 15-21: Update the meta decorator to derive FakeRoomProvider's
roomOverrides from the story args (use context.args.room) instead of the
hardcoded mockedChannel, and then remove the redundant DirectMessage.decorators
block that sets roomOverrides={mockedDM}; specifically modify the meta decorator
that currently renders <FakeRoomProvider roomOverrides={mockedChannel}> to read
room data from context.args (so FakeRoomProvider gets
roomOverrides={context.args.room}) and delete the separate
DirectMessage.decorators entry to unify provider setup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee499f6d-ed6a-4914-a891-f1bd820cccbd

📥 Commits

Reviewing files that changed from the base of the PR and between 2103a7a and 3f2376e.

📒 Files selected for processing (1)
  • apps/meteor/client/views/room/Header/RoomHeader.stories.tsx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/room/Header/RoomHeader.stories.tsx
🔇 Additional comments (1)
apps/meteor/client/views/room/Header/RoomHeader.stories.tsx (1)

40-89: Good slot-variant story coverage.

Line [40], Line [54], and Line [72] correctly exercise toolbox.hidden, toolbox.content, toolbox.pre, and toolbox.pos, matching RoomHeader slot access paths and giving useful visual baselines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant