Skip to content

fix(web): normalize model detail tabs layout#4938

Open
yyhhyyyyyy wants to merge 1 commit into
QuantumNous:mainfrom
yyhhyyyyyy:fix/model-details-tabs-layout
Open

fix(web): normalize model detail tabs layout#4938
yyhhyyyyyy wants to merge 1 commit into
QuantumNous:mainfrom
yyhhyyyyyy:fix/model-details-tabs-layout

Conversation

@yyhhyyyyyy
Copy link
Copy Markdown
Contributor

@yyhhyyyyyy yyhhyyyyyy commented May 18, 2026

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
修复模型详情页 Tabs 使用满宽 flex 滚动容器导致的布局异常,改为 grid 三等分并使用方向态高度覆盖,避免撑高或出现滚动条。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
未修改前:
image
修改后:
image

Summary by CodeRabbit

  • Style
    • Refined responsive styling for tab components across the application, improving layout consistency in dashboard, models, pricing, profile, and usage logs sections
    • Enhanced tab label display with improved text truncation and spacing to prevent overflow
    • Updated tab container styling for better visual alignment and responsiveness

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Walkthrough

Five feature pages update tab component styling to use responsive group-based height variants and improve layout handling. Dashboard, models, profile settings, and usage-logs swap static height classes for responsive group-data-horizontal/tabs selectors. Model details additionally adopts a grid layout with text truncation for tab triggers.

Changes

Tab UI Responsive Styling

Layer / File(s) Summary
Responsive height variants for TabsList
web/default/src/features/dashboard/index.tsx, web/default/src/features/models/index.tsx, web/default/src/features/profile/components/profile-settings-card.tsx, web/default/src/features/usage-logs/index.tsx
Dashboard, models, profile-settings, and usage-logs update TabsList className to use group-data-horizontal/tabs:h-auto or group-data-horizontal/tabs:h-10 responsive selectors, replacing fixed static height classes while preserving flex/wrapping behavior.
Grid-based tab layout and text truncation
web/default/src/features/pricing/components/model-details.tsx
ModelDetailsContent updates TabsList to a grid-based layout with rounded/padded styling and responsive height override, and TabsTrigger adds min-w-0 with text truncation to prevent label overflow.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 Tabs now dance in grids so bright,
Responsive heights take flight!
Grid layouts flow, text truncates clean,
The smoothest tab bar ever seen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(web): normalize model detail tabs layout' directly describes the main change: fixing and normalizing the tabs layout on the model details page.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@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: 1

🤖 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.

Inline comments:
In `@web/default/src/features/pricing/components/model-details.tsx`:
- Line 923: The Tabs component currently emits data-orientation which doesn't
match the Tailwind selectors; update the Tabs implementation (where props like
orientation are handled) to set data-horizontal="true" when orientation ===
"horizontal" and data-vertical="true" when orientation === "vertical" (or set
both attributes accordingly for backward compatibility) so selectors like
group-data-horizontal/tabs:... and group-data-vertical/tabs:... will match;
ensure this change affects the Tabs root (used by TabsList and related
components such as the TabsList class in model-details.tsx) so all files using
group-data-horizontal/tabs: selectors work.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 39376428-0ac0-48cc-bc48-60689be515cc

📥 Commits

Reviewing files that changed from the base of the PR and between 5dd0d3b and 4f3edd6.

📒 Files selected for processing (5)
  • web/default/src/features/dashboard/index.tsx
  • web/default/src/features/models/index.tsx
  • web/default/src/features/pricing/components/model-details.tsx
  • web/default/src/features/profile/components/profile-settings-card.tsx
  • web/default/src/features/usage-logs/index.tsx


<Tabs defaultValue='overview' className='gap-4'>
<TabsList className='bg-muted/60 h-auto w-full justify-start gap-1 overflow-x-auto rounded-lg p-1'>
<TabsList className='bg-muted/60 grid w-full grid-cols-3 gap-1 rounded-lg p-1 group-data-horizontal/tabs:h-auto'>
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.

⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Tabs component has group/tabs class and data-horizontal attribute support

echo "=== Searching for Tabs component definition ==="
rg -n -A 20 "export.*Tabs.*=" web/default/src/components/ui/ --type tsx

echo ""
echo "=== Checking for group/tabs class in Tabs component ==="
rg -n "group/tabs" web/default/src/components/ui/ --type tsx

echo ""
echo "=== Checking for data-horizontal attribute ==="
rg -n "data-horizontal" web/default/src/components/ui/ --type tsx

echo ""
echo "=== Verifying TabsList receives orientation context ==="
ast-grep --pattern $'const TabsList = $$$' web/default/src/components/ui/

Repository: QuantumNous/new-api

Length of output: 375


🏁 Script executed:

#!/bin/bash
# Find Tabs component files
echo "=== Finding Tabs-related component files ==="
fd -e ts -e tsx "tabs" web/default/src/components/ui/ 2>/dev/null | head -20

echo ""
echo "=== Listing all files in components/ui ==="
ls -la web/default/src/components/ui/ 2>/dev/null | grep -i tab

Repository: QuantumNous/new-api

Length of output: 310


🏁 Script executed:

#!/bin/bash
# Search for Tabs component definition without --type flag
echo "=== Searching for Tabs export ==="
rg -n "export.*Tabs" web/default/src/components/ui/ -A 5

echo ""
echo "=== Searching for group/tabs usage in codebase ==="
rg "group/tabs" web/default/src/

echo ""
echo "=== Searching for data-horizontal attribute ==="
rg "data-horizontal" web/default/src/

Repository: QuantumNous/new-api

Length of output: 4596


🏁 Script executed:

#!/bin/bash
# Read the actual Tabs component if found
echo "=== Checking tabs.tsx or similar ==="
find web/default/src/components/ui -name "*tabs*" -o -name "*Tabs*" | head -5 | xargs -I {} sh -c 'echo "File: {}"; wc -l {}'

Repository: QuantumNous/new-api

Length of output: 187


🏁 Script executed:

#!/bin/bash
# Read the Tabs component implementation
cat -n web/default/src/components/ui/tabs.tsx

Repository: QuantumNous/new-api

Length of output: 4965


🏁 Script executed:

#!/bin/bash
# Check Tailwind configuration for custom data attribute handling
echo "=== Looking for tailwind config ==="
find web/default -name "tailwind.config.*" -o -name "tailwind.ts" -o -name "tailwind.js" | head -5

echo ""
echo "=== Checking if there's a cva or class generation for orientation ==="
rg "data-orientation" web/default/src/components/ui/tabs.tsx -B 5 -A 5

echo ""
echo "=== Check for any preprocessor or transformer ==="
rg "data-horizontal|data-vertical" web/default -l | head -10

Repository: QuantumNous/new-api

Length of output: 960


🏁 Script executed:

#!/bin/bash
# Search more broadly for tailwind config
echo "=== Find tailwind config files ==="
find web/default -name "*tailwind*" -type f 2>/dev/null

echo ""
echo "=== Check root directory for config ==="
ls -la web/default/*.config.* 2>/dev/null || echo "No config files in root"

echo ""
echo "=== Check package.json for tailwind config location ==="
rg '"tailwind"' web/default/package.json -B 2 -A 2

echo ""
echo "=== Check for CSS files that might contain tailwind directives ==="
find web/default/src -name "*.css" | head -5

Repository: QuantumNous/new-api

Length of output: 684


🏁 Script executed:

#!/bin/bash
# Check rsbuild config for Tailwind configuration
echo "=== Reading rsbuild.config.ts ==="
cat -n web/default/rsbuild.config.ts

echo ""
echo "=== Reading postcss.config.mjs ==="
cat web/default/postcss.config.mjs

echo ""
echo "=== Check for Tailwind config in plugin options ==="
rg "tailwind|data-orientation|data-horizontal" web/default/rsbuild.config.ts

Repository: QuantumNous/new-api

Length of output: 4058


🏁 Script executed:

#!/bin/bash
# Check if there's a tailwind config in package.json or tsconfig
echo "=== Search package.json for tailwind ==="
rg "tailwind" web/default/package.json -B 2 -A 2

echo ""
echo "=== Check if data-orientation attribute matches Tailwind selectors ==="
rg "`@tailwindcss/postcss`" web/default -r --type json

echo ""
echo "=== Look for tsconfig or other config files ==="
cat -n web/default/tsconfig.json 2>/dev/null | head -30

echo ""
echo "=== Search for any custom Tailwind theme config ==="
rg "theme:|corePlugins:|matchVariant" web/default/src -l

Repository: QuantumNous/new-api

Length of output: 2270


🏁 Script executed:

#!/bin/bash
# Search for any custom Tailwind CSS configuration or plugin
echo "=== Check main CSS file ==="
cat web/default/src/styles/index.css

echo ""
echo "=== Check theme CSS ==="
head -50 web/default/src/styles/theme.css

echo ""
echo "=== Look for any `@layer` or theme customization ==="
rg "`@layer`|`@tailwind`|matchVariant" web/default/src/styles/ -A 3

Repository: QuantumNous/new-api

Length of output: 16232


🏁 Script executed:

#!/bin/bash
# Check what Base UI Tabs renders - look at node_modules or understand how data-orientation works
echo "=== Check if `@base-ui/react/tabs` might be setting data-horizontal ==="
rg "data-horizontal" web/default/node_modules/@base-ui 2>/dev/null | head -5 || echo "Node modules not available or no match"

echo ""
echo "=== Check actual usage in model-details to understand context ==="
head -100 web/default/src/features/pricing/components/model-details.tsx | tail -50

echo ""
echo "=== Look at lines around 923 in model-details ==="
sed -n '910,935p' web/default/src/features/pricing/components/model-details.tsx

Repository: QuantumNous/new-api

Length of output: 3072


🏁 Script executed:

#!/bin/bash
# Verify how other components use data-horizontal/data-vertical
echo "=== Check toggle-group for data-horizontal pattern ==="
head -60 web/default/src/components/ui/toggle-group.tsx | tail -30

echo ""
echo "=== Check slider component ==="
sed -n '1,80p' web/default/src/components/ui/slider.tsx | tail -50

Repository: QuantumNous/new-api

Length of output: 2762


🏁 Script executed:

#!/bin/bash
# Check if there's any transformation from data-orientation to data-horizontal
echo "=== Search for any middleware/wrapper that might transform attributes ==="
rg "data-orientation|data-horizontal" web/default/src/lib/ -B 2 -A 2

echo ""
echo "=== Check how toggle-group actual renders in built output ==="
rg -A 10 "ToggleGroupPrimitive" web/default/src/components/ui/toggle-group.tsx | head -30

echo ""
echo "=== Verify Base UI doesn't automatically set data-horizontal ==="
rg "`@base-ui`" web/default/package.json

Repository: QuantumNous/new-api

Length of output: 1317


🏁 Script executed:

#!/bin/bash
# Final verification: Does Base UI's Tabs primitive automatically transform data-orientation?
echo "=== Check `@base-ui/react/tabs` implementation in node_modules ==="
find web/default/node_modules/@base-ui/react -name "*.d.ts" -path "*/tabs*" 2>/dev/null | head -3 | xargs -I {} sh -c 'echo "=== {} ==="; head -50 {}'

echo ""
echo "=== Look for transform or data attribute handling in TabsPrimitive ==="
rg "data-orientation|data-horizontal" web/default/node_modules/@base-ui 2>/dev/null | head -5

Repository: QuantumNous/new-api

Length of output: 200


🏁 Script executed:

#!/bin/bash
# Since we can't access node_modules reliably, let's verify the actual impact
# Check if there are any issues or TODOs related to this
echo "=== Look for any comments about attribute or styling issues ==="
rg "TODO|FIXME|BUG|data-orientation|data-horizontal" web/default/src/components/ui/tabs.tsx

echo ""
echo "=== Count how many places use group-data-horizontal/tabs styling ==="
rg "group-data-horizontal/tabs" web/default/src --count-matches

echo ""
echo "=== Verify the actual attribute that gets rendered ==="
echo "Looking at the Tabs wrapper code again:"
sed -n '23,39p' web/default/src/components/ui/tabs.tsx

Repository: QuantumNous/new-api

Length of output: 1673


Fix attribute mismatch: Tabs component sets data-orientation but CSS selectors expect data-horizontal/data-vertical.

The Tabs component correctly applies the group/tabs class for grouping context, but it sets the data-orientation attribute instead of data-horizontal/data-vertical. Tailwind selectors like group-data-horizontal/tabs:h-8 and group-data-vertical/tabs:h-fit won't match because they look for data-horizontal or data-vertical attributes, not data-orientation.

Update the Tabs component to set the appropriate data attribute:

Fix for tabs.tsx
function Tabs({
  className,
  orientation = 'horizontal',
  ...props
}: TabsPrimitive.Root.Props) {
  return (
    <TabsPrimitive.Root
      data-slot='tabs'
-     data-orientation={orientation}
+     data-horizontal={orientation === 'horizontal'}
+     data-vertical={orientation === 'vertical'}
      className={cn(
        'group/tabs flex gap-2 data-horizontal:flex-col',
        className
      )}
      {...props}
    />
  )
}

This affects all five files using group-data-horizontal/tabs: selectors (model-details.tsx lines 923, profile-settings-card.tsx line 239, usage-logs/index.tsx line 145, models/index.tsx line 72, dashboard/index.tsx line 130).

🤖 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 `@web/default/src/features/pricing/components/model-details.tsx` at line 923,
The Tabs component currently emits data-orientation which doesn't match the
Tailwind selectors; update the Tabs implementation (where props like orientation
are handled) to set data-horizontal="true" when orientation === "horizontal" and
data-vertical="true" when orientation === "vertical" (or set both attributes
accordingly for backward compatibility) so selectors like
group-data-horizontal/tabs:... and group-data-vertical/tabs:... will match;
ensure this change affects the Tabs root (used by TabsList and related
components such as the TabsList class in model-details.tsx) so all files using
group-data-horizontal/tabs: selectors work.

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