Skip to content

fix: prevents table layout shift with fixed column widths #936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yashhhguptaaa
Copy link
Contributor

@yashhhguptaaa yashhhguptaaa commented Aug 16, 2025

Ref :- #930

Problem

  • Table headers shift when cell content changes (typing, dropdowns)
  • Long text causes inconsistent column widths
  • "Support role" header wraps to 2 lines

Solution

  • Fixed column widths (250px email, 200px name) to prevent layout shifts
  • Text truncation with hover tooltips for overflow content
  • Adjusted header widths to prevent text wrapping

Changes

  • Added fixed widths to email/name columns in table cells
  • Implemented text truncation with title tooltips
  • Optimized column header widths

Before

Screen.Recording.2025-08-16.at.8.27.26.PM.mov

After

Screen.Recording.2025-08-16.at.8.26.27.PM.mov

Summary by CodeRabbit

  • New Features

    • Hover tooltips display full email and name in the Team list.
    • Settings sections support custom layout styling for improved flexibility.
  • Style

    • Standardized column widths in the Team table (Email, Name, Support role) for consistent alignment.
    • Improved truncation and readability of member details; inputs adjust to full width when editing.
    • Settings section adopts a cleaner vertical layout with better spacing on large screens.
    • Minor typography tweak for section descriptions.
  • Documentation

    • None.

Copy link

vercel bot commented Aug 16, 2025

@yashhhguptaaa is attempting to deploy a commit to the Antiwork Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Aug 16, 2025

Walkthrough

Introduces an optional sectionClassName prop to SectionWrapper and updates its usage. Adjusts team settings table layout: sets explicit column widths, adds title tooltips, ensures truncation styling, and tweaks input widths. No behavioral or data-flow changes.

Changes

Cohort / File(s) Summary
SectionWrapper API update
app/(dashboard)/settings/sectionWrapper.tsx
Adds optional prop sectionClassName; applies it via cn to the outer section; switches description container from div to p.
Team settings layout and cell widths
app/(dashboard)/settings/team/teamSetting.tsx, app/(dashboard)/settings/team/teamMemberRow.tsx
Passes sectionClassName="lg:flex-col gap-8" to SectionWrapper; specifies email/name/support role column widths; adds title tooltips for email and displayName; maintains truncation; adjusts input width to w-full.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • binary-koan

Poem

In rows and cells I hop with care,
A tweak of width, more space to spare.
Tooltips whisper what’s unseen,
Names and emails crisp and clean.
A wrapper dons a classy coat—
Flexing softly, note by note.
Bun-approved UI, remote! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yashhhguptaaa yashhhguptaaa marked this pull request as ready for review August 16, 2025 15:04
Copy link
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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
app/(dashboard)/settings/sectionWrapper.tsx (1)

32-32: Avoid always rendering a <p> for arbitrary nodes and when description is empty

  • Rendering a <p> around an arbitrary ReactNode can produce invalid HTML if the node is block-level (e.g., a <div>).
  • The empty <p> still participates in the gap-* layout, adding unwanted spacing when description is undefined.

Recommend rendering the description conditionally and wrapping with a <div> to safely support any node type.

Apply this diff:

-          <p className="w-full text-sm text-muted-foreground">{description}</p>
+          {description && (
+            <div className="w-full text-sm text-muted-foreground">{description}</div>
+          )}
app/(dashboard)/settings/team/teamMemberRow.tsx (2)

225-231: Ensure truncation works reliably in a flex row

Text truncation in flex layouts often needs min-w-0 on the flex item (or its parent) so it can shrink, and truncate works best on block/inline-block. Also, avoid a redundant “No email” tooltip when there’s no email.

Apply this diff:

-      <TableCell className="w-[250px]">
-        <div className="flex items-center gap-3">
+      <TableCell className="w-[250px]">
+        <div className="flex items-center gap-3 min-w-0">
           <Avatar fallback={getAvatarFallback(member)} size="sm" />
-          <span className="truncate" title={member.email || "No email"}>
-            {member.email || "No email"}
-          </span>
+          <span className="truncate block min-w-0" title={member.email || undefined}>
+            {member.email || "No email"}
+          </span>
         </div>
       </TableCell>

233-245: Name column width change aligns with header and prevents layout shifts

  • w-[200px] on the cell matches the header width from the table, which helps keep consistent column sizing.
  • Admin input className="w-full" is appropriate now that the column width is constrained.
  • Non-editing path uses truncate block with a title for full value—good for UX.

Minor nit: you can mirror the email change and avoid showing a “No display name” tooltip by omitting the title when absent.

Apply this diff:

-          <span className="truncate block" title={member.displayName || "No display name"}>
-            {member.displayName || "No display name"}
-          </span>
+          <span className="truncate block" title={member.displayName || undefined}>
+            {member.displayName || "No display name"}
+          </span>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 196245c and 1a3a861.

📒 Files selected for processing (3)
  • app/(dashboard)/settings/sectionWrapper.tsx (1 hunks)
  • app/(dashboard)/settings/team/teamMemberRow.tsx (1 hunks)
  • app/(dashboard)/settings/team/teamSetting.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.tsx

📄 CodeRabbit Inference Engine (.cursorrules)

Name component files in lowerCamelCase, e.g. conversationList.tsx

Files:

  • app/(dashboard)/settings/team/teamMemberRow.tsx
  • app/(dashboard)/settings/sectionWrapper.tsx
  • app/(dashboard)/settings/team/teamSetting.tsx
🧬 Code Graph Analysis (3)
app/(dashboard)/settings/team/teamMemberRow.tsx (4)
components/ui/table.tsx (1)
  • TableCell (57-57)
components/ui/avatar.tsx (1)
  • Avatar (41-56)
lib/data/user.ts (1)
  • isAdmin (56-56)
components/ui/input.tsx (1)
  • Input (39-39)
app/(dashboard)/settings/sectionWrapper.tsx (1)
packages/marketing/lib/utils.ts (1)
  • cn (4-6)
app/(dashboard)/settings/team/teamSetting.tsx (1)
components/ui/table.tsx (1)
  • TableHead (57-57)
🔇 Additional comments (5)
app/(dashboard)/settings/sectionWrapper.tsx (3)

15-16: New prop sectionClassName — API extension looks good

Adding sectionClassName?: string is a clean way to style the outer section without affecting the content column. No breaking change since it’s optional.


18-26: Prop destructuring updated correctly

sectionClassName is properly destructured and typed. No issues.


28-28: Composition order will correctly override lg:flex-row

Using cn("... lg:flex-row", sectionClassName) ensures sectionClassName wins on conflicts (e.g., lg:flex-col). This aligns with the intended override behavior via twMerge.

app/(dashboard)/settings/team/teamSetting.tsx (2)

34-34: Passing sectionClassName to flip layout on lg screens is correct

Because SectionWrapper composes classes with cn(base, sectionClassName), your lg:flex-col gap-8 overrides the base lg:flex-row as intended.


52-56: Header widths match row cells — reduces column jitter

  • Email w-[250px] matches the row’s first TableCell.
  • Name w-[200px] matches the row’s second TableCell.
  • Support role w-[120px] constrains header text to one line.

This should significantly reduce layout shifts during edits and long content cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant