From fbbff669a36877337fd6b347b132d09a77291d9d Mon Sep 17 00:00:00 2001 From: RhenCloud Date: Sat, 3 Oct 2026 22:54:32 +0800 Subject: [PATCH] feat(ui): migrate to @recloudstudio/ui, add theme toggle and polish console UX --- .env.example | 1 + AGENTS.md | 12 +- README.md | 5 +- README.zh.md | 5 +- app/assets/css/main.css | 233 ++++++------- app/components/AdminHome.vue | 208 +++--------- app/components/AppLogo.vue | 30 ++ app/components/AppToasts.vue | 27 +- app/components/AuditLog.vue | 35 +- app/components/ConsolePage.vue | 263 ++++++--------- app/components/FilterNodeEditor.vue | 59 ++-- app/components/GroupEditor.vue | 491 +++++++++++++++------------- app/components/LegalLayout.vue | 83 ++--- app/components/MembersPanel.vue | 69 ++-- app/components/MetricsPanel.vue | 62 ++-- app/components/RouteCard.vue | 57 ++-- app/components/RouteEditor.vue | 484 ++++++++++++++------------- app/components/SendLogs.vue | 75 +++-- app/components/TagInput.vue | 69 +--- app/components/ThemeToggle.vue | 79 +++++ app/components/WebhookPanel.vue | 28 +- app/composables/useI18n.ts | 12 + app/composables/useTheme.ts | 88 +++++ app/pages/index.vue | 216 +++++------- app/pages/privacy.vue | 4 + app/pages/terms.vue | 4 + bun.lock | 61 ++++ docs/.vitepress/config.ts | 4 +- docs/api/admin.md | 2 +- docs/api/overview.md | 2 +- docs/contributing.md | 2 +- docs/guide/configuration.md | 3 + docs/guide/introduction.md | 2 +- docs/zh/api/admin.md | 2 +- docs/zh/api/overview.md | 2 +- docs/zh/contributing.md | 2 +- docs/zh/guide/configuration.md | 3 + docs/zh/guide/introduction.md | 2 +- nuxt.config.ts | 11 +- package.json | 1 + server/lib/types.ts | 1 + server/lib/web/admin.ts | 6 +- server/lib/web/auth.ts | 8 +- server/lib/web/session.ts | 12 + tests/admin.test.ts | 7 + 45 files changed, 1489 insertions(+), 1343 deletions(-) create mode 100644 app/components/AppLogo.vue create mode 100644 app/components/ThemeToggle.vue create mode 100644 app/composables/useTheme.ts diff --git a/.env.example b/.env.example index 3f9a46c..71852f2 100644 --- a/.env.example +++ b/.env.example @@ -24,6 +24,7 @@ FEISHU_APP_SECRET=your-app-secret # Admin ADMIN_USER_IDS=your-github-id,your-github-login +# DEBUG_MODE=true # local development only: bypasses all admin authentication # ALLOW_SELF_SIGNUP=1 # non-admin GitHub users get a personal group on first login (default off) # AUDIT_RETENTION_DAYS=90 # audit log retention for the scheduled cleanup (default 90) diff --git a/AGENTS.md b/AGENTS.md index cce49e2..674bb56 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,8 +9,8 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord ## Key Decisions - Runtime: Cloudflare Workers via the Nitro `cloudflare_module` preset (`_worker.js`), H3 event handlers in `server/routes/` -- UI: Vue 3 + Tailwind CSS v4 (`@tailwindcss/vite`); admin console is a client-side SPA (`routeRules: "/admin/**": { ssr: false }`), home/legal pages render server-side -- Styling: all theme colors are RGB-triplet CSS variables in `app/assets/css/main.css` declared as `@theme inline` tokens (so `bg-accent/10` opacity modifiers work); the design tokens switch with `prefers-color-scheme` (unless ``); repeated control patterns are `@apply` component classes in the CSS `@layer components` +- UI: Vue 3 + Tailwind CSS v4 (`@tailwindcss/vite`) + `@recloudstudio/ui` (Nuxt module, `Rc` prefix); admin console is a client-side SPA (`routeRules: "/admin/**": { ssr: false }`), home/legal pages render server-side +- Styling: ReCloud UI supplies semantic components and blue theme tokens; `app/assets/css/main.css` retains `--wh-*` RGB-triplet aliases for app-specific Tailwind utilities and bespoke layouts (avoiding collision with ReCloud's `--surface`/`--text`/`--border` hex tokens); theme switching supports auto/light/dark via `useTheme` / `ThemeToggle`, toggling `.dark` with inline anti-flash head script - Discord interactions: HTTPS Interactions Endpoint (`POST /discord/interactions`, Ed25519-signed) — no Discord Gateway / Durable Object; bot stays offline, messages always sent via REST - Storage: D1 is the source of truth for config (routes/groups via `d1_routes`/`d1_groups`, see `server/lib/storage/config-store.ts`), send/audit logs, dedup (`dedup_keys`), delivery state (`delivery_state`) and message tracking (`message_tracking` via `server/lib/storage/d1.ts` `canUseD1` gate). KV keeps only cache + short-lived/ephemeral state (tokens, OAuth state, admin sessions, `msg:*`-adjacent locks, per-group secrets `tenant:*`, invites, i18n overrides) with explicit TTLs. R2 parks oversized queue payloads (`webhooks/YYYY/MM/DD/*.json`, `server/lib/storage/payload.ts`) instead of KV. A `storage-prune` scheduled task cleans up expired dedup/delivery/message-tracking rows - Signature verification: Web Crypto API (HMAC-SHA256 for GitHub/Gitea, Ed25519 for Discord, timing-safe secret-token compare for Telegram) @@ -18,7 +18,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord - Per-group webhook ingress: optional `POST /webhook/{groupId}` with a per-group secret in KV (`tenant:{groupId}`) — Gitea/classic-GitHub/custom webhooks are verified against the group's secret instead of the operator's global ones; only that group's routes fire. The legacy `POST /webhook` (global secrets, all routes) stays untouched - GitHub App tenant isolation: `Group.installationId` binds a group to one GitHub App installation; events whose `payload.installation.id` differs are rejected at dispatch (hard isolation on top of the optional `owners` list). The App's Setup URL points at `GET /auth/github/install`, which renders a choice page (create `inst-{installationId}` or bind to a group the signed-in user owns, verified by role); `POST /auth/github/install/bind` performs the provisioning. `installation.created` webhook events auto-provision as a fallback (create `inst-{installationId}` or bind existing groups whose `owners` match the installing account) - GitHub OAuth: octokit (token is stored hashed for reverse lookup) -- Admin WebUI: `/admin` config console, OAuth-session protected via `ADMIN_USER_IDS` whitelist; left sidebar navigation (Overview / Groups / Send Logs / Audit / Stats) + topbar, deep-linkable routes (`/admin` overview · `/admin/groups` · `/admin/logs` · `/admin/audit` · `/admin/metrics`); the overview dashboard (`AdminHome.vue`) aggregates delivery KPIs, a routes table and recent send logs; the stats page (`MetricsPanel.vue`) renders KPI cards plus per-platform/per-event ok/failed bar legends and a per-status breakdown, and filters by group (`?groupId=`); the route/group editors (`RouteEditor.vue` / `GroupEditor.vue`) are slide-in drawers with an eyebrow header and sectioned form bodies +- Admin WebUI: `/admin` config console, OAuth-session protected via `ADMIN_USER_IDS` whitelist (local-only `DEBUG_MODE=true` bypasses authentication); left sidebar navigation (Overview / Groups / Send Logs / Audit / Stats) + topbar, deep-linkable routes (`/admin` overview · `/admin/groups` · `/admin/logs` · `/admin/audit` · `/admin/metrics`); the overview dashboard (`AdminHome.vue`) aggregates delivery KPIs, a routes table and recent send logs; the stats page (`MetricsPanel.vue`) renders KPI cards plus per-platform/per-event ok/failed bar legends and a per-status breakdown, and filters by group (`?groupId=`); the route/group editors (`RouteEditor.vue` / `GroupEditor.vue`) are centered, scrollable `RcDialog` forms with an eyebrow header and sectioned bodies - Access control: every group has role-based members (`owner` / `admin` / `viewer`); super admins bypass; legacy `adminIds` are read as owners (backward compatible); owners manage members + invites; `owners` field stays super-only - Invites: single-use 7-day links (`invite:{token}`) for joining a group as admin/viewer; `ALLOW_SELF_SIGNUP=1` gives access-less users a personal group on first login (self-service SaaS entry) - Audit log: every admin operation (logins, group/route/member/invite changes) recorded in D1 `audit_logs`; pruned by the scheduled trigger after `AUDIT_RETENTION_DAYS` (default 90) @@ -34,7 +34,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord ```text app/ # Vue 3 UI (Nuxt app dir) ├── app.vue # root component (NuxtPage) -├── assets/css/main.css # Tailwind v4 entry: @import "tailwindcss" + @theme inline tokens (RGB-triplet vars) + @layer components (@apply) + Vue transition glue +├── assets/css/main.css # Tailwind v4 entry: ReCloud-compatible RGB aliases + bespoke layout classes + Vue transition glue ├── pages/ # index (landing), terms, privacy, admin/[...slug] (console SPA) ├── components/ # ConsolePage (sidebar shell + topbar), AdminHome (overview dashboard), │ # RouteCard/Editor (RouteEditor has FilterNodeEditor AST builder + TagInput chips), @@ -258,7 +258,7 @@ Rule: no functional change ships without its documentation; docs and code must n - **D1 database**: Binding `DB` (database `webhooker`, id `214a0104-3235-47c0-b7bf-ddda95f3c8ac`) for `send_logs` + `audit_logs` + `discord_links` + `telegram_links` + `d1_groups` + `d1_routes` + `d1_fragments` + `dedup_keys` + `delivery_state` + `message_tracking` tables - **Queue**: optional `QUEUE` producer binding plus consumers `webhooker-delivery` and its DLQ `webhooker-delivery-dlq` (declared in `wrangler.jsonc`); when absent, webhook dispatch stays inline - **R2**: optional `PAYLOAD` binding (bucket `webhooker-payloads`) for oversized queue payloads; without it, oversized payloads fall back to KV `queue:payload:*` -- **Access control**: `ADMIN_USER_IDS` (super admins), `ALLOW_SELF_SIGNUP` (optional personal group on first login), `AUDIT_RETENTION_DAYS` (default 90) — all plain env vars, not secrets +- **Access control**: `ADMIN_USER_IDS` (super admins), `DEBUG_MODE=true` (local-only authentication bypass), `ALLOW_SELF_SIGNUP` (optional personal group on first login), `AUDIT_RETENTION_DAYS` (default 90) — all plain env vars, not secrets - **Discord**: `DISCORD_PUBLIC_KEY` (Interactions Endpoint signature verification, from Discord Developer Portal) and `DISCORD_APPLICATION_ID` (optional, auto-resolved via `GET /oauth2/applications/@me` when omitted) are required for interactions - **Telegram**: `TELEGRAM_TOKEN` (Bot API token from BotFather) required for Telegram routes; `TELEGRAM_WEBHOOK_SECRET` (optional secret token for `POST /telegram/webhook` verification); avatars are sent as a link-preview card via the built-in `GET /api/richheader` (overridable with `TELEGRAM_RICH_HEADER_HOST`) - **Webhook providers**: `GITEA_WEBHOOK_SECRET` (required to receive Gitea webhooks; Gitea signs `X-Gitea-Signature` with the hex HMAC-SHA256 of the body) @@ -284,7 +284,7 @@ bunx wrangler deploy Full list of secrets used: `GITHUB_WEBHOOK_SECRET`, `GITEA_WEBHOOK_SECRET`, `GITHUB_APP_ID`, `GITHUB_PRIVATE_KEY` (PKCS#8 PEM), `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `DISCORD_TOKEN`, -`DISCORD_PUBLIC_KEY`, `TELEGRAM_TOKEN`, `TELEGRAM_WEBHOOK_SECRET`, `ADMIN_USER_IDS`, +`DISCORD_PUBLIC_KEY`, `TELEGRAM_TOKEN`, `TELEGRAM_WEBHOOK_SECRET`, `ADMIN_USER_IDS`, `DEBUG_MODE`, plus optional `BASE_URL`, `DISCORD_APPLICATION_ID`, `TELEGRAM_RICH_HEADER_HOST`, `NUXT_PUBLIC_DOCS_URL`, `NUXT_PUBLIC_REPO_URL`, `NUXT_PUBLIC_LEGAL_CONTACT`. See `.env.example` and `docs/guide/configuration.md`. diff --git a/README.md b/README.md index 71436f4..b3587e0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ GitHub / Gitea webhook → Discord / Telegram / Feishu dispatcher. Receives webh - `workflow_run` / `check_run` progress is edited **in place** (single message updated as the run advances) on Discord, Telegram, and Feishu — `check_run` tracks by check name + commit SHA so deployments that issue a fresh run id per phase (e.g. Cloudflare Pages) still edit the same message; `workflow_run` embeds a colored per-job code block (🟢 success, 🔴 failure, running/queued inline) - **Per-group webhook log channel** — point a group at a Discord channel/thread, Telegram chat/topic, or Feishu chat and every webhook the group's routes dispatch is summarized there (✅/❌ per route × target) - GitHub OAuth for user actions (comment, edit comment, delete comment, merge, close, react) -- **Web UI config console** (`/admin`) — manage routes and groups with GitHub OAuth + admin whitelist, view send logs +- **Web UI config console** (`/admin`) — ReCloud UI-based console with centered route/group dialogs; manage routes and groups with GitHub OAuth + admin whitelist, view send logs - **Discord Interactions Endpoint** (Ed25519-verified) for `/gh` slash commands, message context-menu commands, PR merge/close buttons, and comment modals - **Telegram `/gh` commands** (login/logout/comment/merge/close) via the Telegram webhook, with avatar link-preview cards - Cloudflare D1 for config (routes/groups), send logs, platform account links, dedup, delivery state and message tracking + KV for ephemeral state/cache/security tokens, + optional R2 for oversized payloads @@ -74,6 +74,7 @@ bunx wrangler dev # Start local dev server | `FEISHU_APP_SECRET` | Feishu app secret — required for Feishu routes | | `BASE_URL` | Public URL for OAuth callbacks and the Telegram webhook sync | | `ADMIN_USER_IDS` | Comma-separated GitHub user IDs (or logins) allowed to access `/admin` | +| `DEBUG_MODE` | Local development only: set to exact `true` to bypass all `/admin` authentication | | `ALLOW_SELF_SIGNUP` | `1` to give access-less GitHub users a personal group on first login (default off) | | `AUDIT_RETENTION_DAYS` | Audit-log retention in days for the scheduled cleanup (default 90) | | `NUXT_PUBLIC_DOCS_URL` | Optional docs site URL used by the landing page | @@ -112,6 +113,8 @@ The built-in config console lets you manage routes and groups in the browser (ad 2. Visit `/admin` and sign in with GitHub. Users with no access get `403` — unless `ALLOW_SELF_SIGNUP=1` (they receive a personal group) or they follow a group invite link. 3. Changes are written to D1 immediately, the config cache is invalidated, and the webhook pipeline picks them up on the next run. +For local-only debugging, `DEBUG_MODE=true` bypasses GitHub OAuth and grants full console access. Never set it in a deployed environment. + Sign out at `/admin/logout`. Every group has `members` with a role (`owner` / `admin` / `viewer`); all admin operations are recorded in the D1 `audit_logs` table. ### Filter Types diff --git a/README.zh.md b/README.zh.md index accca7d..fb19e3e 100644 --- a/README.zh.md +++ b/README.zh.md @@ -16,7 +16,7 @@ GitHub / Gitea webhook → Discord / Telegram / 飞书 分发服务。通过 Clo - `workflow_run` / `check_run` 进度**原地编辑**同一条消息(运行推进时更新),Discord、Telegram 与飞书均支持 —— `check_run` 以 check 名 + commit SHA 追踪,因此每个阶段都换新 run id 的部署(如 Cloudflare Pages)仍会编辑同一条消息;`workflow_run` 内嵌带颜色的逐作业代码块(🟢 成功、🔴 失败、运行中/排队中不着色) - **分组级 Webhook 日志频道** —— 为分组指定一个 Discord 频道/子区、Telegram 群组/话题或飞书群聊,该分组路由每次分发 webhook 都会向其中发送摘要(每条「路由 × 目标」一行,✅/❌ 结果) - GitHub OAuth 用户授权(评论、编辑评论、删除评论、合并、关闭、反应) -- **Web 配置控制台**(`/admin`)— 通过 GitHub OAuth + 管理员白名单管理路由与分组、查看发送日志 +- **Web 配置控制台**(`/admin`)— 基于 ReCloud UI,使用居中路由/分组对话框;通过 GitHub OAuth + 管理员白名单管理路由与分组、查看发送日志 - **Discord Interactions Endpoint**(Ed25519 验签)支持 `/gh` 斜杠命令、消息右键菜单命令、PR 合并/关闭按钮与评论 modal - **Telegram `/gh` 命令**(login/logout/comment/merge/close),通过 Telegram webhook 接收,头像以链接预览卡片呈现 - Cloudflare D1 存储配置(路由/分组)、发送日志、平台账号绑定、去重、投递状态与消息更新追踪 + KV 存储临时状态/缓存/安全令牌 + 可选 R2 存储超大负载 @@ -74,6 +74,7 @@ bunx wrangler dev # 启动本地开发服务器 | `FEISHU_APP_SECRET` | 飞书应用密钥 —— 飞书路由必需 | | `BASE_URL` | 公网地址(用于 OAuth 回调与 Telegram webhook 同步) | | `ADMIN_USER_IDS` | 允许访问 `/admin` 的 GitHub 用户 ID(或登录名),逗号分隔 | +| `DEBUG_MODE` | 仅本地开发:精确设为 `true` 时跳过全部 `/admin` 身份验证 | | `ALLOW_SELF_SIGNUP` | 设为 `1` 时,无权限的 GitHub 用户首次登录自动获得个人分组(默认关闭) | | `AUDIT_RETENTION_DAYS` | 定时清理时审计日志的保留天数(默认 90) | | `NUXT_PUBLIC_DOCS_URL` | 可选;落地页使用的文档站点 URL | @@ -112,6 +113,8 @@ bunx wrangler dev # 启动本地开发服务器 2. 访问 `/admin` 并用 GitHub 登录。无任何权限的用户收到 `403`——除非开启 `ALLOW_SELF_SIGNUP=1`(自动获得个人分组)或通过分组邀请链接加入。 3. 修改会立即写入 D1,配置缓存随之失效,webhook 管线随即生效。 +仅限本地调试时,可设 `DEBUG_MODE=true` 跳过 GitHub OAuth 并获得完整控制台权限。部署环境切勿设置此变量。 + 在 `/admin/logout` 退出登录。每个分组都有带角色的 `members`(`owner` / `admin` / `viewer`);所有管理操作(登录、分组/路由/成员/邀请变更)都会写入 D1 `audit_logs` 表。 ### 过滤器类型 diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 56dc389..f496192 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -1,10 +1,6 @@ @import "tailwindcss"; -/* --------------------------------------------------------------------------- - * Theme tokens — RGB triplets so Tailwind opacity modifiers (bg-accent/10) - * work against them; values switch automatically with prefers-color-scheme - * (unless an explicit data-theme="light" is set on ). - * ------------------------------------------------------------------------- */ +/* ReCloud UI-compatible RGB aliases for app-specific Tailwind utilities. */ @theme inline { --font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; @@ -12,35 +8,34 @@ --radius: 12px; --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06); --shadow-card-hover: 0 8px 24px -12px rgba(15, 23, 42, 0.25); - --shadow-accent-lg: 0 12px 28px -10px rgb(var(--accent)); - --shadow-drawer: -16px 0 48px rgba(15, 23, 42, 0.12); + --shadow-accent-lg: 0 12px 28px -10px rgb(var(--wh-accent)); --shadow-modal: 0 12px 40px rgba(15, 23, 42, 0.25); --animate-rise: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both; - --color-bg: rgb(var(--bg)); - --color-surface: rgb(var(--surface)); - --color-surface-2: rgb(var(--surface-2)); - --color-surface-3: rgb(var(--surface-3)); - --color-border: rgb(var(--border)); - --color-border-strong: rgb(var(--border-strong)); - --color-text: rgb(var(--text)); - --color-muted: rgb(var(--muted)); - --color-faint: rgb(var(--faint)); - --color-accent: rgb(var(--accent)); - --color-accent-strong: rgb(var(--accent-strong)); - --color-accent-dim: rgb(var(--accent-dim)); - --color-accent-text: rgb(var(--accent-text)); - --color-accent-border: rgb(var(--accent-border)); - --color-ok: rgb(var(--ok)); - --color-ok-dim: rgb(var(--ok-dim)); - --color-warn: rgb(var(--warn)); - --color-warn-dim: rgb(var(--warn-dim)); - --color-bad: rgb(var(--bad)); - --color-bad-dim: rgb(var(--bad-dim)); - --color-info: rgb(var(--info)); - --color-info-dim: rgb(var(--info-dim)); - --color-body-text: rgb(var(--body-text)); - --color-code-bg: rgb(var(--code-bg)); + --color-bg: rgb(var(--wh-bg)); + --color-surface: rgb(var(--wh-surface)); + --color-surface-2: rgb(var(--wh-surface-2)); + --color-surface-3: rgb(var(--wh-surface-3)); + --color-border: rgb(var(--wh-border)); + --color-border-strong: rgb(var(--wh-border-strong)); + --color-text: rgb(var(--wh-text)); + --color-muted: rgb(var(--wh-muted)); + --color-faint: rgb(var(--wh-faint)); + --color-accent: rgb(var(--wh-accent)); + --color-accent-strong: rgb(var(--wh-accent-strong)); + --color-accent-dim: rgb(var(--wh-accent-dim)); + --color-accent-text: rgb(var(--wh-accent-text)); + --color-accent-border: rgb(var(--wh-accent-border)); + --color-ok: rgb(var(--wh-ok)); + --color-ok-dim: rgb(var(--wh-ok-dim)); + --color-warn: rgb(var(--wh-warn)); + --color-warn-dim: rgb(var(--wh-warn-dim)); + --color-bad: rgb(var(--wh-bad)); + --color-bad-dim: rgb(var(--wh-bad-dim)); + --color-info: rgb(var(--wh-info)); + --color-info-dim: rgb(var(--wh-info-dim)); + --color-body-text: rgb(var(--wh-body-text)); + --color-code-bg: rgb(var(--wh-code-bg)); } @keyframes rise { @@ -56,72 +51,71 @@ :root { color-scheme: light; - --header-bg: rgba(255, 255, 255, 0.82); - --scrim: rgba(15, 23, 42, 0.4); - --knob: #ffffff; - --dot: rgba(15, 23, 42, 0.05); - --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06); + --wh-header-bg: rgba(255, 255, 255, 0.82); + --wh-scrim: rgba(15, 23, 42, 0.4); + --wh-knob: #ffffff; + --wh-dot: rgba(15, 23, 42, 0.05); + --wh-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06); - --bg: 246 247 249; - --surface: 255 255 255; - --surface-2: 243 244 246; - --surface-3: 236 238 242; - --border: 230 232 236; - --border-strong: 212 216 222; - --text: 15 23 42; - --muted: 91 100 114; - --faint: 154 163 178; - --accent: 79 70 229; - --accent-strong: 67 56 202; - --accent-dim: 238 242 255; - --accent-text: 55 48 163; - --accent-border: 224 231 255; - --ok: 22 163 74; - --ok-dim: 236 253 243; - --warn: 180 83 9; - --warn-dim: 254 243 199; - --bad: 220 38 38; - --bad-dim: 254 242 242; - --info: 37 99 235; - --info-dim: 239 246 255; - --body-text: 48 54 61; - --code-bg: 240 241 243; + --wh-bg: 248 250 252; + --wh-surface: 255 255 255; + --wh-surface-2: 248 250 252; + --wh-surface-3: 241 245 249; + --wh-border: 226 232 240; + --wh-border-strong: 203 213 225; + --wh-text: 15 23 42; + --wh-muted: 71 85 105; + --wh-faint: 100 116 139; + --wh-accent: 37 99 235; + --wh-accent-strong: 29 78 216; + --wh-accent-dim: 239 246 255; + --wh-accent-text: 30 64 175; + --wh-accent-border: 191 219 254; + --wh-ok: 22 163 74; + --wh-ok-dim: 240 253 244; + --wh-warn: 217 119 6; + --wh-warn-dim: 255 251 235; + --wh-bad: 220 38 38; + --wh-bad-dim: 254 242 242; + --wh-info: 37 99 235; + --wh-info-dim: 239 246 255; + --wh-body-text: 48 54 61; + --wh-code-bg: 240 241 243; } -@media (prefers-color-scheme: dark) { - :root:not([data-theme="light"]) { - color-scheme: dark; - --header-bg: rgba(15, 20, 28, 0.82); - --scrim: rgba(2, 6, 12, 0.6); - --knob: #dfe4ee; - --dot: rgba(148, 163, 184, 0.08); - --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5); +:root.dark, +:root[data-theme="dark"] { + color-scheme: dark; + --wh-header-bg: rgba(15, 20, 28, 0.82); + --wh-scrim: rgba(2, 6, 12, 0.6); + --wh-knob: #dfe4ee; + --wh-dot: rgba(148, 163, 184, 0.08); + --wh-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5); - --bg: 11 15 23; - --surface: 19 26 36; - --surface-2: 26 34 48; - --surface-3: 35 45 61; - --border: 39 49 67; - --border-strong: 56 70 96; - --text: 230 233 239; - --muted: 154 166 184; - --faint: 107 119 137; - --accent: 99 102 241; - --accent-strong: 129 140 248; - --accent-dim: 28 33 64; - --accent-text: 199 210 254; - --accent-border: 47 55 102; - --ok: 34 197 94; - --ok-dim: 16 36 26; - --warn: 251 191 36; - --warn-dim: 42 36 16; - --bad: 240 82 82; - --bad-dim: 42 22 24; - --info: 59 130 246; - --info-dim: 23 37 84; - --body-text: 195 202 214; - --code-bg: 26 34 48; - } + --wh-bg: 2 6 23; + --wh-surface: 15 23 42; + --wh-surface-2: 30 41 59; + --wh-surface-3: 51 65 85; + --wh-border: 51 65 85; + --wh-border-strong: 71 85 105; + --wh-text: 241 245 249; + --wh-muted: 148 163 184; + --wh-faint: 100 116 139; + --wh-accent: 96 165 250; + --wh-accent-strong: 147 197 253; + --wh-accent-dim: 30 58 138; + --wh-accent-text: 191 219 254; + --wh-accent-border: 30 64 175; + --wh-ok: 34 197 94; + --wh-ok-dim: 16 36 26; + --wh-warn: 251 191 36; + --wh-warn-dim: 42 36 16; + --wh-bad: 240 82 82; + --wh-bad-dim: 42 22 24; + --wh-info: 59 130 246; + --wh-info-dim: 23 37 84; + --wh-body-text: 195 202 214; + --wh-code-bg: 26 34 48; } @layer base { @@ -140,7 +134,7 @@ inset: 0; z-index: 0; pointer-events: none; - background-image: radial-gradient(var(--dot) 1px, transparent 1px); + background-image: radial-gradient(var(--wh-dot) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 40%); } @@ -154,7 +148,7 @@ .header { @apply sticky top-0 z-20 flex items-center justify-between gap-4 px-8 py-3.5 border-b border-border; - background: var(--header-bg); + background: var(--wh-header-bg); backdrop-filter: blur(12px); } @@ -426,7 +420,7 @@ width: 16px; height: 16px; border-radius: 50%; - background: var(--knob); + background: var(--wh-knob); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2); transition: transform 0.18s; } @@ -506,19 +500,38 @@ @apply rounded-[5px] bg-accent-dim px-1.5 py-px font-mono text-accent; } - /* ---- Drawer / overlay ---- */ - .overlay { - @apply fixed inset-0 z-40 backdrop-blur-[2px]; - background: var(--scrim); + /* ---- Modal editors (RcDialog wrapper) ---- */ + .editor-dialog { + display: flex !important; + flex-direction: column !important; + gap: 0 !important; + max-height: calc(100dvh - 2rem) !important; + overflow: hidden !important; + padding: 0 !important; } - .editor { - @apply fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-surface shadow-drawer; + .editor-dialog > div:first-child { + margin-bottom: 0 !important; + flex-shrink: 0 !important; + } + + .editor-dialog > div:nth-child(2) { + flex: 1 1 0% !important; + min-height: 0 !important; + display: flex !important; + flex-direction: column !important; + padding: 0 !important; + } + + .editor-dialog > div:nth-child(3) { + margin-top: 0 !important; + flex-shrink: 0 !important; + padding: 0 !important; } .editor-head { @apply flex items-center justify-between gap-3 border-b border-border px-6 py-4; - background: var(--header-bg); + background: var(--wh-header-bg); backdrop-filter: blur(12px); } @@ -541,7 +554,7 @@ .editor-body { @apply flex-1 overflow-y-auto px-6 py-5; scrollbar-width: thin; - scrollbar-color: var(--scrim) transparent; + scrollbar-color: var(--wh-scrim) transparent; } .editor-section { @@ -972,7 +985,7 @@ .modal-overlay { @apply fixed inset-0 z-[60] flex items-center justify-center p-6 backdrop-blur-[2px]; - background: var(--scrim); + background: var(--wh-scrim); } .detail-head { @@ -1264,13 +1277,3 @@ .fade-leave-to { opacity: 0; } - -.slide-enter-active, -.slide-leave-active { - transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1); -} - -.slide-enter-from, -.slide-leave-to { - transform: translateX(100%); -} diff --git a/app/components/AdminHome.vue b/app/components/AdminHome.vue index cd710e5..fc6613d 100644 --- a/app/components/AdminHome.vue +++ b/app/components/AdminHome.vue @@ -1,6 +1,5 @@ diff --git a/app/components/AppLogo.vue b/app/components/AppLogo.vue new file mode 100644 index 0000000..6b1e7cc --- /dev/null +++ b/app/components/AppLogo.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/app/components/AppToasts.vue b/app/components/AppToasts.vue index b2bf9da..0958a77 100644 --- a/app/components/AppToasts.vue +++ b/app/components/AppToasts.vue @@ -1,13 +1,32 @@ + + diff --git a/app/components/AuditLog.vue b/app/components/AuditLog.vue index 91f7da4..9372dcf 100644 --- a/app/components/AuditLog.vue +++ b/app/components/AuditLog.vue @@ -4,25 +4,25 @@ {{ t("audit.title") }}
- + @update:model-value="onGroupFilter" + />
- +

{{ error }}

-

{{ t("audit.empty") }}

+
@@ -57,7 +57,7 @@ import type { AuditEntry, Group } from "~/types"; const { t } = useI18n(); -defineProps<{ +const props = defineProps<{ entries: AuditEntry[]; loading: boolean; error: string; @@ -74,8 +74,13 @@ function refresh(): void { emit("refresh"); } -function onGroupFilter(e: Event): void { - emit("update:selectedGroupId", (e.target as HTMLSelectElement).value); +const groupOptions = computed(() => [ + { label: t("audit.allGroups"), value: "all" }, + ...props.groups.map((g) => ({ label: g.name || g.id, value: g.id })), +]); + +function onGroupFilter(value: string): void { + emit("update:selectedGroupId", value === "all" ? "" : value); emit("filter"); } diff --git a/app/components/ConsolePage.vue b/app/components/ConsolePage.vue index 9045dab..05033bc 100644 --- a/app/components/ConsolePage.vue +++ b/app/components/ConsolePage.vue @@ -1,122 +1,65 @@