Browse Source

fix(dashboard): align active sessions panel height with metric cards

修复活跃 Session 组件高度对齐问题,消除底部留白:
- 使用 flex 布局让容器填充整个可用高度
- 标题区域设置为 flex-shrink-0 防止被压缩
- 内容区域使用 flex-1 占据所有剩余空间
- 移除固定高度限制,改为自适应父容器高度

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
ding113 3 months ago
parent
commit
86bafbf83e
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/components/customs/overview-panel.tsx

+ 5 - 5
src/components/customs/overview-panel.tsx

@@ -231,8 +231,8 @@ export function OverviewPanel({ currencyCode = "USD", isAdmin = false }: Overvie
 
       {/* 右侧:活跃 Session 列表 */}
       <div className="lg:col-span-9">
-        <div className="border rounded-lg bg-card">
-          <div className="px-4 py-3 border-b flex items-center justify-between">
+        <div className="border rounded-lg bg-card h-full flex flex-col">
+          <div className="px-4 py-3 border-b flex items-center justify-between flex-shrink-0">
             <div className="flex items-center gap-2">
               <Activity className="h-4 w-4 text-primary" />
               <h3 className="font-semibold text-sm">活跃 Session</h3>
@@ -248,14 +248,14 @@ export function OverviewPanel({ currencyCode = "USD", isAdmin = false }: Overvie
             </button>
           </div>
 
-          <div className="max-h-[200px] overflow-y-auto">
+          <div className="flex-1 overflow-y-auto min-h-0">
             {isLoading && metrics.recentSessions.length === 0 ? (
-              <div className="flex items-center justify-center h-[200px] text-muted-foreground text-sm">
+              <div className="flex items-center justify-center h-full text-muted-foreground text-sm">
                 <Loader2 className="h-4 w-4 animate-spin mr-2" />
                 加载中...
               </div>
             ) : metrics.recentSessions.length === 0 ? (
-              <div className="flex items-center justify-center h-[200px] text-muted-foreground text-sm">
+              <div className="flex items-center justify-center h-full text-muted-foreground text-sm">
                 暂无活跃 Session
               </div>
             ) : (