From 3faf960f351ef1421f13f083253bc5725d6ee968 Mon Sep 17 00:00:00 2001 From: feiezha Date: Tue, 29 Sep 2026 11:34:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=B1=E5=BA=A6=E4=BC=98=E5=8C=96=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + README.md | 15 + app/admin/admin-nav.tsx | 16 +- app/admin/audits/page.tsx | 96 +- app/admin/dashboard/page.tsx | 93 +- app/admin/layout.tsx | 9 +- app/admin/nodes/page.tsx | 508 ++- app/admin/subscriptions/page.tsx | 87 +- .../subscriptions/proxy-group-editor.tsx | 515 ++- app/admin/users/page.tsx | 347 +- app/globals.css | 2415 ++++------- app/login/page.tsx | 22 +- app/me/page.tsx | 34 +- bun.lock | 175 + components.json | 20 + components/action-form.tsx | 66 + components/copy-button.tsx | 30 + components/filter-list.tsx | 97 + components/submit-button.tsx | 65 + components/ui/alert-dialog.tsx | 196 + components/ui/button.tsx | 63 + components/ui/input.tsx | 20 + lib/utils.ts | 6 + package-lock.json | 3583 ++++++++++++++++- package.json | 12 +- playwright.config.ts | 25 + tests/ui.spec.ts | 223 + 27 files changed, 6510 insertions(+), 2232 deletions(-) create mode 100644 components.json create mode 100644 components/action-form.tsx create mode 100644 components/copy-button.tsx create mode 100644 components/filter-list.tsx create mode 100644 components/submit-button.tsx create mode 100644 components/ui/alert-dialog.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/input.tsx create mode 100644 lib/utils.ts create mode 100644 playwright.config.ts create mode 100644 tests/ui.spec.ts diff --git a/.gitignore b/.gitignore index bc41405..26cc9bc 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,7 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# Browser checks +/test-results/ +/playwright-report/ diff --git a/README.md b/README.md index fa45ea0..8081d02 100644 --- a/README.md +++ b/README.md @@ -144,3 +144,18 @@ sudo systemctl reload nginx 如果你当前的 hy2 节点仍然直接访问 `http://38.246.237.36:3000/api/hy2/...` 作为鉴权地址,可以继续保留这一入口。上面的 Nginx 只接管 `80/443` 上的域名访问,不会替换或中断现有的 `:3000` 直连。 面板内部生成链接时会优先使用反代传入的 `X-Forwarded-Host` / `X-Forwarded-Proto`,如果是直接访问 `http://38.246.237.36:3000`,则会自动退回到当前请求的 `Host`。 + +## UI 与交互 + +界面使用 shadcn/ui(本地组件位于 `components/ui`),以列表、行内展开和中性色分隔线为主。代理组节点排序使用 dnd-kit,支持鼠标、触屏,以及空格开始、方向键移动、空格放下、Escape 取消的键盘操作。修改排序后点击保存,也可撤销。 + +用户、节点和最近 100 条审计记录支持本页即时搜索和状态筛选。用户、节点与模板表单支持 Ctrl/Cmd + Enter 提交,保存失败会保留输入;删除操作通过确认对话框执行。 + +运行浏览器回归: + +```bash +npx playwright install chromium +npm run test:e2e +``` + +测试自动启动 3106 端口的开发服务,使用 `/tmp` 中独立的临时数据库并关闭节点轮询,不访问现有数据库。覆盖排序持久化、鼠标/键盘/模拟触屏、列表筛选、用户编辑、复制链接、删除确认、失败保留输入和移动端溢出检查。截图输出在 `test-results/`。运行前请停止同一工作目录的其他 Next 开发服务。 diff --git a/app/admin/admin-nav.tsx b/app/admin/admin-nav.tsx index 351ada1..d54d03a 100644 --- a/app/admin/admin-nav.tsx +++ b/app/admin/admin-nav.tsx @@ -1,5 +1,12 @@ "use client"; +import { + LayoutDashboard, + Users, + Server, + Radio, + ScrollText, +} from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; @@ -10,18 +17,23 @@ type NavItem = { export function AdminNav({ items }: { items: NavItem[] }) { const pathname = usePathname(); + const icons = [LayoutDashboard, Users, Server, Radio, ScrollText]; return (