Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 734cf3f

Browse files
zsioclaude
andcommitted
docs: 完善部署文档和修复 UI 问题
- 在 README 中添加 .env 文件配置示例,解决用户部署时环境变量配置不清晰的问题 - 修复统计图表 tooltip 显示空值数据的问题,提升数据可视化体验 - 添加全局 Footer 组件,完善页面布局 - 更新 MCP 工具配置,添加 shadcn 支持 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a0cdc00 commit 734cf3f

File tree

6 files changed

+62
-11
lines changed

6 files changed

+62
-11
lines changed

.mcp.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
"command": "npx",
66
"args": ["@bytebase/dbhub"],
77
"env": {}
8+
},
9+
"shadcn": {
10+
"command": "npx",
11+
"args": [
12+
"shadcn@latest",
13+
"mcp"
14+
]
815
}
916
}
1017
}

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## 项目简介
33

44
Claude Code Hub 是一个 Claude Code API 代理中转服务平台,用于统一管理多个 CC 服务提供商,提供智能负载均衡、用户权限管理和使用统计功能。
5+
使用中文和用户沟通。
56

67
## 常用命令
78

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,19 @@ docker compose logs -f
123123
确保两个容器都是 `healthy``running` 状态
124124

125125

126-
### 环境变量说明
126+
### 环境变量配置
127+
128+
在项目根目录创建 `.env` 文件:
129+
130+
```bash
131+
# 管理员登录令牌(必须修改为强密码)
132+
ADMIN_TOKEN=!!!change-me-to-a-strong-password!!!
133+
134+
# 数据库配置(可选,已有默认值)
135+
DB_USER=postgres
136+
DB_PASSWORD=!!!change-me!!!
137+
DB_NAME=claude_code_hub
138+
```
127139

128140
<details>
129141
<summary><b>📝 完整环境变量配置说明</b></summary>
@@ -136,12 +148,6 @@ docker compose logs -f
136148
| `DB_NAME` || `claude_code_hub` | 数据库名称 |
137149
| `AUTO_MIGRATE` || `true` | 启动时自动执行数据库迁移 |
138150

139-
**生产环境安全建议**
140-
- ⚠️ 必须修改 `ADMIN_TOKEN` 为强密码(≥20 字符,包含大小写字母、数字、特殊符号)
141-
- ⚠️ 建议修改 `DB_PASSWORD` 为强密码
142-
- 🔒 如果暴露到公网,建议配置反向代理(Nginx)+ HTTPS
143-
- 🔒 限制数据库端口 `35432` 的外部访问
144-
145151
</details>
146152

147153
### 管理命令

src/app/dashboard/_components/statistics/chart.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,31 @@ export function UserStatisticsChart({ data, onTimeRangeChange, loading = false }
354354
content={({ active, payload, label }) => {
355355
if (!active || !payload || !payload.length) return null
356356

357+
const filteredPayload = payload.filter(entry => {
358+
const value =
359+
typeof entry.value === "number"
360+
? entry.value
361+
: Number(entry.value ?? 0)
362+
return !Number.isNaN(value) && value !== 0
363+
})
364+
365+
if (!filteredPayload.length) {
366+
return <div className="hidden" />
367+
}
368+
357369
return (
358370
<div className="rounded-lg border bg-background p-3 shadow-sm min-w-[200px]">
359371
<div className="grid gap-2">
360372
<div className="font-medium text-center">
361373
{formatTooltipDate(label)}
362374
</div>
363375
<div className="grid gap-1.5">
364-
{payload
365-
.sort((a, b) => (b.value as number) - (a.value as number))
376+
{[...filteredPayload]
377+
.sort((a, b) => (Number(b.value ?? 0) || 0) - (Number(a.value ?? 0) || 0))
366378
.map((entry, index) => {
367379
const baseKey = entry.dataKey?.toString().replace(`_${activeChart}`, '') || ''
368380
const displayUser = userMap.get(baseKey)
369-
const value = entry.value as number
381+
const value = typeof entry.value === "number" ? entry.value : Number(entry.value ?? 0)
370382
const color = entry.color
371383

372384
return (

src/app/layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Metadata } from "next";
22
import "./globals.css";
33
import { Toaster } from "@/components/ui/sonner";
4+
import { Footer } from "@/components/customs/footer";
45
import { AppProviders } from "./providers";
56
import { getSystemSettings } from "@/repository/system-config";
67

@@ -33,7 +34,10 @@ export default function RootLayout({
3334
<html lang="en">
3435
<body className="antialiased">
3536
<AppProviders>
36-
{children}
37+
<div className="flex min-h-screen flex-col bg-background text-foreground">
38+
<main className="flex-1">{children}</main>
39+
<Footer />
40+
</div>
3741
<Toaster />
3842
</AppProviders>
3943
</body>

src/components/customs/footer.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Link from "next/link";
2+
3+
export function Footer() {
4+
const year = new Date().getFullYear();
5+
6+
return (
7+
<footer className="border-t border-border bg-background/80">
8+
<div className="mx-auto flex w-full max-w-7xl flex-col items-center justify-between gap-2 px-6 py-6 text-sm text-muted-foreground sm:flex-row">
9+
<p className="text-center sm:text-left">© {year} Claude Code Hub</p>
10+
<Link
11+
href="https://github.com/zsio/claude-code-hub"
12+
target="_blank"
13+
rel="noopener noreferrer"
14+
className="transition-colors hover:text-primary"
15+
>
16+
GitHub
17+
</Link>
18+
</div>
19+
</footer>
20+
);
21+
}

0 commit comments

Comments
 (0)