Skip to content

refactor: extract row cell alignment into GenericTableRow#41442

Closed
Pr241singh wants to merge 4 commits into
RocketChat:developfrom
Pr241singh:refactor/41439-row-cell-alignment
Closed

refactor: extract row cell alignment into GenericTableRow#41442
Pr241singh wants to merge 4 commits into
RocketChat:developfrom
Pr241singh:refactor/41439-row-cell-alignment

Conversation

@Pr241singh

@Pr241singh Pr241singh commented Jul 17, 2026

Copy link
Copy Markdown

Proposed changes (including videos or screenshots)

This refactoring removes duplicated row cell alignment styles from the Omnichannel directory table rows by moving the behavior into GenericTableRow.

Changes made

  • Added an optional cellVerticalAlign prop to GenericTableRow
  • Replaced duplicated customAlignTop styles in:
    • ChatsTableRow
    • ContactTableRow
  • Removed the duplicated CSS from both components

This keeps the alignment logic centralized and avoids repeating the same custom styling across multiple table row implementations.

Issue(s)

Ref #41439

Steps to test or reproduce

  1. Start the application.
  2. Navigate to Omnichannel → Directory → Chats.
  3. Verify that the table renders correctly and the row cells remain vertically aligned to the top.
  4. Navigate to Omnichannel → Directory → Contacts.
  5. Verify that the table renders correctly and the row cells remain vertically aligned to the top.

Further comments

This change is a small refactoring that centralizes the row cell alignment behavior in GenericTableRow, removing duplicated custom CSS while preserving the existing appearance of the Omnichannel directory tables.

Review in cubic

Summary by CodeRabbit

  • Style
    • Improved table row consistency by standardizing top alignment for table cells.
    • Updated chat and contact directory tables to display multi-line cell content more cleanly.
    • Added optional top-alignment support to shared table rows for consistent presentation across the interface.

@Pr241singh
Pr241singh requested a review from a team as a code owner July 17, 2026 13:11
@dionisio-bot

dionisio-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: feace77

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

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

GenericTableRow centralizes optional top cell alignment, and omnichannel chat and contact rows use the new prop instead of local CSS classes.

Changes

Generic table alignment

Layer / File(s) Summary
GenericTableRow alignment support
packages/ui-client/src/components/GenericTable/GenericTableRow.tsx
Adds cellVerticalAlign?: 'top' and conditionally applies top alignment CSS while preserving the provided class name.
Directory row adoption
apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx, apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx
Replaces local alignment styling with cellVerticalAlign='top' and removes unused CSS imports and definitions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: feature

Suggested reviewers: tassoevan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving row cell alignment logic into GenericTableRow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jul 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx (1)

16-20: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Remove unused customAlignTop definition and fix css reference error.

The css import from @rocket.chat/css-in-js was removed, but the customAlignTop variable definition using css was left behind. This will cause a compilation/reference error for css and leaves customAlignTop as an unused variable. Please remove this block completely.

🐛 Proposed fix to remove the unused code
-const customAlignTop = css`
-	td {
-		vertical-align: top;
-	}
-`;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx`
around lines 16 - 20, Remove the unused customAlignTop styled definition from
ContactTableRow, including its css template block, so no unresolved css
reference or unused variable remains.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx`:
- Around line 16-20: Remove the unused customAlignTop styled definition from
ContactTableRow, including its css template block, so no unresolved css
reference or unused variable remains.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 993a9b53-1055-4abc-b50f-eb71c670a3ac

📥 Commits

Reviewing files that changed from the base of the PR and between 65a366e and acd7472.

📒 Files selected for processing (3)
  • apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableRow.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer
🧰 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:

  • packages/ui-client/src/components/GenericTable/GenericTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx
🧠 Learnings (2)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • packages/ui-client/src/components/GenericTable/GenericTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/ui-client/src/components/GenericTable/GenericTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx
  • apps/meteor/client/views/omnichannel/directory/contacts/ContactTableRow.tsx
🔇 Additional comments (2)
apps/meteor/client/views/omnichannel/directory/chats/ChatsTable/ChatsTableRow.tsx (1)

56-56: LGTM!

packages/ui-client/src/components/GenericTable/GenericTableRow.tsx (1)

15-28: 🎯 Functional Correctness

Verify TableRow accepts array className values. React className expects a string; if @rocket.chat/fuselage forwards [className, alignTop] directly, the DOM will get a comma-separated class string and the top-alignment styling will break.

@dougfabris dougfabris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually it has to be made on fuselage side

@Pr241singh

Pr241singh commented Jul 17, 2026

Copy link
Copy Markdown
Author

@dougfabris Thanks for the review!

I understand that this should be implemented in Fuselage instead of GenericTableRow.

Should I open a PR in the Fuselage repository to add the alignment support there, and then update this PR to use the new API?

@dougfabris

Copy link
Copy Markdown
Member

The fix on fuselage is enough for me

@Pr241singh

Copy link
Copy Markdown
Author

@dougfabris Thanks for the feedback! I've moved the implementation into Fuselage as suggested and opened a corresponding PR:

RocketChat/fuselage##2101

Once that change is reviewed and merged, I'll update this PR accordingly. Could you please take another look when you have a chance? Thanks!

@Pr241singh
Pr241singh requested a review from dougfabris July 17, 2026 14:48
@dougfabris

Copy link
Copy Markdown
Member

I will take a look as soon as possible, for now we can close this one

@dougfabris dougfabris closed this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants