Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(ui): redesign setup wizard, dashboard, and settings

cyhc3c93f95798f
diff --git a/docker-compose.three-regression.yml b/docker-compose.three-regression.yml
index dbc38e67e..d455d66d3 100644
--- a/docker-compose.three-regression.yml
+++ b/docker-compose.three-regression.yml
@@ -6,10 +6,11 @@ services:
dockerfile: Dockerfile
target: integration
command: ["full"]
+ network_mode: host
environment:
VIBE_REMOTE_HOME: /data/vibe_remote
VIBE_DEPLOYMENT_ENV: regression
- VIBE_UI_PORT: 5123
+ VIBE_UI_PORT: ${THREE_REGRESSION_PORT:-15130}
PYTHONUNBUFFERED: "1"
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
ANTHROPIC_BASE_URL: ${ANTHROPIC_BASE_URL:-}
@@ -17,13 +18,11 @@ services:
CLAUDE_CODE_ATTRIBUTION_HEADER: ${THREE_REGRESSION_CLAUDE_ATTRIBUTION_HEADER:-0}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
healthcheck:
- test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5123/health', timeout=3)"]
+ test: ["CMD", "python", "-c", "import urllib.request, os; urllib.request.urlopen(f\"http://localhost:{os.environ['VIBE_UI_PORT']}/health\", timeout=3)"]
interval: 3s
timeout: 5s
retries: 20
start_period: 30s
- ports:
- - "${THREE_REGRESSION_PORT:-15130}:5123"
volumes:
- ./_tmp/three-regression/vibe:/data/vibe_remote
- ./_tmp/three-regression/shared-home/.claude:/root/.claude
diff --git a/docs/plans/web-ui-redesign.md b/docs/plans/web-ui-redesign.md
new file mode 100644
index 000000000..bdc80ddc7
--- /dev/null
+++ b/docs/plans/web-ui-redesign.md
@@ -0,0 +1,308 @@
+# Vibe Remote Web UI Redesign Plan
+
+> **Branch**: `feature/web-ui-redesign`
+> **Status**: In progress
+> **Design source**: `design.pen` top-level `vibe-remote` screens and `VR/*` reusable components
+> **Reference frontend**: `../avibe-bot-backend` UI architecture and theme primitives
+
+## Summary
+
+Vibe Remote's current Web UI is functionally useful but structurally behind the
+new product design.
+
+The redesign will:
+
+- rebuild the Web UI around the new `design.pen` console and wizard flows
+- support desktop, mobile, light, and dark variants from the start
+- align frontend architecture with `avibe-bot-backend` without migrating the
+ runtime from Vite SPA to Next.js
+- move the UI to a reusable token + primitive + feature architecture so future
+ work across `vibe-remote` and `avibe.bot` feels like one product family
+
+## Goals
+
+- Deliver a high-fidelity implementation of the new Vibe Remote Web UI from
+ `design.pen`
+- Keep Vibe Remote on `React + Vite + TypeScript + Tailwind v4`
+- Align visual tokens, component primitives, naming, and layout semantics with
+ `avibe-bot-backend`
+- Make light theme and mobile first-class architectural concerns instead of
+ post-hoc patches
+- Simplify future maintenance by separating page rendering from API and config
+ persistence logic
+
+## Non-Goals
+
+- Do not migrate `vibe-remote/ui` to Next.js
+- Do not proxy local Web UI traffic through `avibe.bot`
+- Do not preserve the current route tree if it conflicts with the new
+ information architecture
+- Do not preserve the current page markup when a clean rewrite is simpler
+
+## Constraints and Product Decisions
+
+- Vibe Remote remains a locally served Web UI bundled by the Python project.
+- New architecture should be UI-homologous with `avibe-bot-backend`, not
+ framework-identical.
+- `Remote Access` is absorbed into `Settings -> Service` in the new design.
+- The redesign is allowed to introduce a new route hierarchy and shell.
+- Frontend user-facing strings must continue to go through
+ `ui/src/i18n/en.json` and `ui/src/i18n/zh.json`.
+
+## Current State
+
+Current frontend stack in `vibe-remote/ui`:
+
+- React 19 + Vite 7 + TypeScript 5
+- Tailwind CSS v4
+- React Router 7
+- partial shadcn-style building blocks (`cn`, `popover`, `command`,
+ `combobox`)
+- page-level components still own too much fetch/save behavior
+
+Current gaps vs. design:
+
+- route map is flatter and narrower than the new console IA
+- shell/navigation does not match the new desktop/mobile layouts
+- theme tokens do not match the new product family tokens
+- light/mobile are not built as first-class layout concerns
+- there is no full primitive layer for cards, buttons, badges, tables, dialogs,
+ settings rows, wizard progress, and console navigation
+
+## Reference Architecture Alignment
+
+The new Vibe Remote UI should align with `avibe-bot-backend` in these areas:
+
+- semantic theme tokens and naming
+- Tailwind v4 token exposure via CSS custom properties
+- shadcn/ui-style primitive layer
+- `class-variance-authority`-based variant composition where it reduces class
+ duplication
+- component naming, spacing language, border/radius system, and page shell
+ vocabulary
+
+The new Vibe Remote UI should intentionally differ in these areas:
+
+- keep Vite SPA routing instead of Next.js App Router
+- keep client-side API access to the local Vibe Remote Web UI backend
+- avoid server-component or server-action assumptions
+
+## Target Information Architecture
+
+### Main routes
+
+- `/dashboard`
+- `/groups`
+- `/users`
+- `/logs`
+- `/settings/service`
+- `/settings/platforms`
+- `/settings/backends`
+- `/settings/messaging`
+- `/settings/diagnostics`
+
+### Setup routes
+
+- `/setup`
+- `/setup/:step`
+
+### Mapping from old UI
+
+- old `/doctor` concepts split into `Settings -> Diagnostics` and `Logs`
+- old `/doctor/logs` moves to `/logs`
+- old `/remote-access` moves into `Settings -> Service`
+
+## Design Source Mapping
+
+Primary top-level screen families detected in `design.pen`:
+
+- Dashboard
+- Channels
+- Users
+- Logs
+- Settings: Service / Platforms / Backends / Messaging / Diagnostics
+- Wizard: Welcome / Backends / Platforms / Slack creds / Channels / Summary
+
+Primary reusable `VR/*` design components:
+
+- `VR/Sidebar`
+- `VR/RoutingConfig`
+- `VR/CM/Backends`
+- `VR/CM/Service`
+- `VR/CM/Platforms`
+- `VR/CM/Messaging`
+- `VR/CM/Diagnostics`
+
+These should drive implementation structure rather than be treated as mere
+visual references.
+
+### Reuse Interpretation from Design
+
+The design intentionally reuses the same configuration modules across setup and
+settings. Do not fork business UI just because a module appears in two flows.
+
+Shared module surfaces:
+
+- platform choice and platform credential setup share the `VR/CM/Platforms`
+ interaction model across Wizard and `Settings -> Platforms`
+- backend detection, CLI path editing, default backend selection, and install
+ affordances share `VR/CM/Backends` across Wizard and `Settings -> Backends`
+- messaging rows, diagnostics checks, routing configuration, and service runtime
+ controls should map to their `VR/CM/*` modules wherever the same controls
+ appear
+
+Container-specific surfaces:
+
+- Wizard owns setup chrome: progress bar, step badge, Back/Next/Skip actions,
+ and first-run guidance copy
+- Settings owns console chrome: sidebar, settings tabs, save/autosave actions,
+ and persistent management copy
+- Dashboard, Groups, Users, and Logs should not reuse Wizard containers; they
+ reuse only lower-level rows, badges, buttons, routing controls, and data
+ display primitives
+
+Implementation rule: extract reusable configuration modules first, then render
+them through Wizard or Settings adapters. Avoid copying save/validation logic,
+but also avoid embedding a whole Wizard step inside Settings unchanged.
+
+## Target Frontend Structure
+
+```text
+ui/src/
+ app/
+ AppProviders.tsx
+ router.tsx
+ shell/
+ api/
+ client.ts
+ config.ts
+ settings.ts
+ users.ts
+ logs.ts
+ doctor.ts
+ remote-access.ts
+ components/
+ ui/
+ shared/
+ features/
+ dashboard/
+ groups/
+ users/
+ logs/
+ settings/
+ setup/
+ context/
+ hooks/
+ i18n/
+ lib/
+ theme/
+ utils/
+ routes/
+ platforms/
+ layout/
+```
+
+## Execution Plan
+
+### Phase 0: Foundation and Safety
+
+- create isolated git worktree
+- write plan and lock route + architecture decisions
+- inspect current API surface and preserve working behaviors
+
+### Phase 1: Theme and Primitive Alignment
+
+- replace current global tokens with the new shared product token system
+- add light/dark theme support based on `data-theme`
+- align fonts, radii, border strengths, surfaces, gradients, and focus rings
+- add missing primitives inspired by `avibe-bot-backend`:
+ - button
+ - badge
+ - card
+ - input
+ - label
+ - separator
+ - dialog
+ - table/list building blocks
+
+### Phase 2: App Shell and Routing Rewrite
+
+- rebuild route tree around the new IA
+- replace the current shell with the design-driven desktop sidebar and mobile
+ bottom navigation
+- add shared page header, section, stats, status, and settings-row primitives
+
+### Phase 3: Setup Wizard Rewrite
+
+- implement the new wizard layout and step flow
+- map current setup state and persistence logic into the new feature structure
+- keep API behavior correct while replacing page markup and routing
+
+### Phase 4: Console Pages Rewrite
+
+- implement Dashboard
+- implement Channels
+- implement Users
+- implement Logs
+- implement Settings pages:
+ - Service
+ - Platforms
+ - Backends
+ - Messaging
+ - Diagnostics
+
+### Phase 5: Mobile and Light Polish
+
+- verify all routes for mobile layout correctness
+- verify light theme semantic contrast and component parity
+- fix page-specific overflow, density, and interaction issues
+
+### Phase 6: Validation and Packaging
+
+- `npm run build` in `ui/`
+- targeted manual preview of new routes
+- Docker regression when user-facing behavior needs end-to-end confirmation
+- ensure built assets still package correctly through the existing Python flow
+
+## Architectural Rules During Implementation
+
+- Pages should not own raw fetch orchestration when a feature-level hook or API
+ module can own it.
+- Visual primitives should be reusable across pages; avoid one-off page-only
+ button/card/input variants unless the design truly requires it.
+- Mobile and light theme support must be validated while building each feature,
+ not deferred until the very end.
+- Existing backend API contracts should remain intact unless a separate backend
+ change is explicitly required.
+- Prefer replacing whole legacy page implementations when incremental patching
+ would leave structural debt behind.
+
+## Initial Implementation Order
+
+1. Theme tokens + primitive layer
+2. New app shell + route map
+3. Setup wizard screens
+4. Dashboard
+5. Settings pages
+6. Channels / Users / Logs
+7. Mobile/light cleanup and QA
+
+## Risks
+
+- Large route and layout rewrite may temporarily break navigation if done in the
+ wrong order.
+- Current components mix rendering and data writes; careless migration can cause
+ silent config regression.
+- Font parity and gradients matter to perceived fidelity; token alignment alone
+ is not enough.
+- Mobile table/list behavior likely needs design-aware reinterpretation rather
+ than literal desktop compression.
+
+## Success Criteria
+
+- New console visually matches the design direction across desktop/mobile and
+ light/dark.
+- Vibe Remote and `avibe.bot` look and feel like one product family.
+- The UI codebase is easier to maintain because primitives, theme, routing, and
+ feature logic are clearly separated.
+- The local packaging model remains intact.
diff --git a/tests/test_sentry_integration.py b/tests/test_sentry_integration.py
index 44d1c8e93..7afd799ca 100644
--- a/tests/test_sentry_integration.py
+++ b/tests/test_sentry_integration.py
@@ -200,6 +200,29 @@ def test_run_ui_server_skips_sentry_when_config_load_fails(monkeypatch):
assert sentry_calls == []
+def test_run_ui_server_reconciles_remote_access_after_binding(monkeypatch):
+ from vibe import ui_server
+ from vibe import remote_access
+ from werkzeug import serving
+
+ class DummyServer:
+ def serve_forever(self):
+ return None
+
+ reconcile_calls = []
+ config = _config()
+
+ monkeypatch.setattr(ui_server.paths, "ensure_data_dirs", lambda: None)
+ monkeypatch.setattr(ui_server.V2Config, "load", lambda *args, **kwargs: config)
+ monkeypatch.setattr(ui_server, "init_sentry", lambda *args, **kwargs: None)
+ monkeypatch.setattr(serving, "make_server", lambda *args, **kwargs: DummyServer())
+ monkeypatch.setattr(remote_access, "reconcile", lambda next_config=None: reconcile_calls.append(next_config) or {"ok": True})
+
+ ui_server.run_ui_server("127.0.0.1", 0)
+
+ assert reconcile_calls == [config]
+
+
def test_ui_error_handler_does_not_explicitly_capture_exceptions():
source = Path("vibe/ui_server.py").read_text(encoding="utf-8")
module = ast.parse(source)
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 0bca37922..3235ae95e 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -509,3 +509,97 @@ def test_remote_callback_sanitizes_protocol_relative_next(monkeypatch, tmp_path)
assert response.status_code == 302
assert response.headers["Location"] == "/"
+
+
+def _save_config_with_setup_host(tmp_path, host: str) -> V2Config:
+ config = _save_config(tmp_path)
+ config.ui.setup_host = host
+ config.save()
+ return config
+
+
+def test_setup_host_lan_request_is_treated_as_local(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "192.168.2.3")
+
+ response = app.test_client().get(
+ "/health",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.5"},
+ )
+
+ assert response.status_code == 200
+
+
+def test_setup_host_request_from_self_is_treated_as_local(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "192.168.2.3")
+
+ response = app.test_client().get(
+ "/health",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.3"},
+ )
+
+ assert response.status_code == 200
+
+
+def test_setup_host_with_public_peer_is_not_local(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "192.168.2.3")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "8.8.8.8"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
+def test_setup_host_mismatched_host_header_is_not_local(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "192.168.2.3")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://10.0.0.5:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.5"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
+def test_setup_host_wildcard_does_not_grant_local_trust(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "0.0.0.0")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.5"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
+def test_setup_host_with_cloudflare_metadata_is_not_local(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "192.168.2.3")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.5"},
+ headers=_cloudflare_headers(),
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
diff --git a/ui/package-lock.json b/ui/package-lock.json
index f6c4ab3ec..7cea79b88 100644
--- a/ui/package-lock.json
+++ b/ui/package-lock.json
@@ -8,7 +8,13 @@
"name": "ui",
"version": "0.0.0",
"dependencies": {
+ "@radix-ui/react-dialog": "^1.1.15",
+ "@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-popover": "^1.1.15",
+ "@radix-ui/react-separator": "^1.1.8",
+ "@radix-ui/react-slot": "^1.2.4",
+ "agentation": "^3.0.2",
+ "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"framer-motion": "^12.26.2",
@@ -20,7 +26,8 @@
"react-dom": "^19.2.0",
"react-i18next": "^16.5.3",
"react-router-dom": "^7.12.0",
- "tailwind-merge": "^3.4.0"
+ "tailwind-merge": "^3.4.0",
+ "tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
@@ -1180,6 +1187,24 @@
}
}
},
+ "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz",
+ "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-dismissable-layer": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz",
@@ -1265,6 +1290,52 @@
}
}
},
+ "node_modules/@radix-ui/react-label": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.8.tgz",
+ "integrity": "sha512-FmXs37I6hSBVDlO4y764TNz1rLgKwjJMQ0EGte6F3Cb3f4bIuHB/iLa/8I9VKkmOy+gNHq8rql3j686ACVV21A==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-primitive": "2.1.4"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-label/node_modules/@radix-ui/react-primitive": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.4.tgz",
+ "integrity": "sha512-9hQc4+GNVtJAIEPEqlYqW5RiYdrr8ea5XQ0ZOnD6fgru+83kqT15mq2OCcbe8KnjRZl5vF3ks69AKz3kh1jrhg==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-slot": "1.2.4"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-popover": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.15.tgz",
@@ -1302,6 +1373,24 @@
}
}
},
+ "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz",
+ "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-popper": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz",
@@ -1405,7 +1494,7 @@
}
}
},
- "node_modules/@radix-ui/react-slot": {
+ "node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz",
"integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==",
@@ -1423,6 +1512,70 @@
}
}
},
+ "node_modules/@radix-ui/react-separator": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.8.tgz",
+ "integrity": "sha512-sDvqVY4itsKwwSMEe0jtKgfTh+72Sy3gPmQpjqcQneqQ4PFmr/1I0YA+2/puilhggCe2gJcx5EBAYFkWkdpa5g==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-primitive": "2.1.4"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.4.tgz",
+ "integrity": "sha512-9hQc4+GNVtJAIEPEqlYqW5RiYdrr8ea5XQ0ZOnD6fgru+83kqT15mq2OCcbe8KnjRZl5vF3ks69AKz3kh1jrhg==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-slot": "1.2.4"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-slot": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.4.tgz",
+ "integrity": "sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-use-callback-ref": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz",
@@ -2585,6 +2738,24 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
+ "node_modules/agentation": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/agentation/-/agentation-3.0.2.tgz",
+ "integrity": "sha512-iGzBxFVTuZEIKzLY6AExSLAQH6i6SwxV4pAu7v7m3X6bInZ7qlZXAwrEqyc4+EfP4gM7z2RXBF6SF4DeH0f2lA==",
+ "license": "PolyForm-Shield-1.0.0",
+ "peerDependencies": {
+ "react": ">=18.0.0",
+ "react-dom": ">=18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/ajv": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
@@ -2785,6 +2956,18 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/class-variance-authority": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",
+ "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "clsx": "^2.1.1"
+ },
+ "funding": {
+ "url": "https://polar.sh/cva"
+ }
+ },
"node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
@@ -4555,6 +4738,15 @@
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
+ "node_modules/tw-animate-css": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/tw-animate-css/-/tw-animate-css-1.4.0.tgz",
+ "integrity": "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/Wombosvideo"
+ }
+ },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
diff --git a/ui/package.json b/ui/package.json
index 9bf84b85f..880ce3b40 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -10,7 +10,13 @@
"preview": "vite preview"
},
"dependencies": {
+ "@radix-ui/react-dialog": "^1.1.15",
+ "@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-popover": "^1.1.15",
+ "@radix-ui/react-separator": "^1.1.8",
+ "@radix-ui/react-slot": "^1.2.4",
+ "agentation": "^3.0.2",
+ "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"framer-motion": "^12.26.2",
@@ -22,7 +28,8 @@
"react-dom": "^19.2.0",
"react-i18next": "^16.5.3",
"react-router-dom": "^7.12.0",
- "tailwind-merge": "^3.4.0"
+ "tailwind-merge": "^3.4.0",
+ "tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
diff --git a/ui/src/App.tsx b/ui/src/App.tsx
index d566d242e..9b29ea623 100644
--- a/ui/src/App.tsx
+++ b/ui/src/App.tsx
@@ -4,12 +4,17 @@ import { AppShell } from './components/AppShell';
import { Dashboard } from './components/Dashboard';
import { ChannelList } from './components/steps/ChannelList';
import { UserList } from './components/steps/UserList';
-import { DoctorPanel } from './components/steps/DoctorPanel';
-import { LogsPanel } from './components/steps/LogsPanel';
-import { RemoteAccess } from './components/RemoteAccess';
+import { SettingsDiagnosticsPage } from './components/settings/SettingsDiagnosticsPage';
+import { SettingsBackendsPage } from './components/settings/SettingsBackendsPage';
+import { SettingsLogsPage } from './components/settings/SettingsLogsPage';
+import { SettingsMessagingPage } from './components/settings/SettingsMessagingPage';
+import { SettingsPlatformsPage } from './components/settings/SettingsPlatformsPage';
+import { SettingsServicePage } from './components/settings/SettingsServicePage';
import { StatusProvider } from './context/StatusContext';
import { ApiProvider, useApi } from './context/ApiContext';
import { ToastProvider } from './context/ToastContext';
+import { ThemeProvider } from './context/ThemeContext';
+import { AgentationToggle } from './components/AgentationToggle';
import { useEffect, useState } from 'react';
import { hasConfiguredPlatformCredentials } from './lib/platforms';
@@ -62,11 +67,20 @@ function AppRoutes() {
<Route path="/setup" element={<Wizard />} />
<Route element={<AuthGuard><AppShell /></AuthGuard>}>
<Route path="/dashboard" element={<Dashboard />} />
- <Route path="/channels" element={<ChannelList isPage />} />
+ <Route path="/groups" element={<ChannelList isPage />} />
+ <Route path="/channels" element={<Navigate to="/groups" replace />} />
<Route path="/users" element={<UserList />} />
- <Route path="/remote-access" element={<RemoteAccess />} />
- <Route path="/doctor" element={<DoctorPanel isPage />} />
- <Route path="/doctor/logs" element={<LogsPanel />} />
+ <Route path="/logs" element={<SettingsLogsPage standalone />} />
+ <Route path="/settings" element={<Navigate to="/settings/service" replace />} />
+ <Route path="/settings/service" element={<SettingsServicePage />} />
+ <Route path="/settings/platforms" element={<SettingsPlatformsPage />} />
+ <Route path="/settings/backends" element={<SettingsBackendsPage />} />
+ <Route path="/settings/messaging" element={<SettingsMessagingPage />} />
+ <Route path="/settings/diagnostics" element={<SettingsDiagnosticsPage />} />
+ <Route path="/settings/logs" element={<SettingsLogsPage />} />
+ <Route path="/remote-access" element={<Navigate to="/settings/service" replace />} />
+ <Route path="/doctor" element={<Navigate to="/settings/diagnostics" replace />} />
+ <Route path="/doctor/logs" element={<Navigate to="/logs" replace />} />
<Route path="/" element={<Navigate to="/dashboard" replace />} />
</Route>
</Routes>
@@ -75,15 +89,18 @@ function AppRoutes() {
function App() {
return (
- <StatusProvider>
- <ToastProvider>
- <ApiProvider>
- <BrowserRouter>
- <AppRoutes />
- </BrowserRouter>
- </ApiProvider>
- </ToastProvider>
- </StatusProvider>
+ <ThemeProvider>
+ <StatusProvider>
+ <ToastProvider>
+ <ApiProvider>
+ <BrowserRouter>
+ <AppRoutes />
+ </BrowserRouter>
+ <AgentationToggle />
+ </ApiProvider>
+ </ToastProvider>
+ </StatusProvider>
+ </ThemeProvider>
);
}
diff --git a/ui/src/components/AgentationToggle.tsx b/ui/src/components/AgentationToggle.tsx
new file mode 100644
index 000000000..42c312cac
--- /dev/null
+++ b/ui/src/components/AgentationToggle.tsx
@@ -0,0 +1,72 @@
+import { lazy, Suspense, useEffect, useState } from 'react';
+
+const STORAGE_KEY = 'vibe-remote:annotate';
+const HASH_ENABLE = '#ai';
+const HASH_DISABLE = '#ai-off';
+
+const Agentation = lazy(() =>
+ import('agentation').then((m) => ({ default: m.Agentation }))
+);
+
+// navigator.clipboard.writeText is unavailable on insecure contexts
+// (e.g. http:// LAN IPs like http://192.168.x.x:15130). Vibe Remote is
+// commonly accessed that way, so we fall back to execCommand('copy').
+const copyText = (text: string) => {
+ if (window.isSecureContext && navigator.clipboard?.writeText) {
+ navigator.clipboard.writeText(text).catch(() => execCommandCopy(text));
+ return;
+ }
+ execCommandCopy(text);
+};
+
+const execCommandCopy = (text: string) => {
+ const textarea = document.createElement('textarea');
+ textarea.value = text;
+ textarea.setAttribute('readonly', '');
+ textarea.style.position = 'fixed';
+ textarea.style.left = '-9999px';
+ textarea.style.top = '0';
+ document.body.appendChild(textarea);
+ textarea.select();
+ try {
+ document.execCommand('copy');
+ } catch {
+ // best-effort; nothing else to do
+ } finally {
+ document.body.removeChild(textarea);
+ }
+};
+
+export const AgentationToggle = () => {
+ const [enabled, setEnabled] = useState(false);
+
+ useEffect(() => {
+ const sync = () => {
+ const hash = window.location.hash;
+ if (hash === HASH_ENABLE) {
+ window.localStorage.setItem(STORAGE_KEY, '1');
+ setEnabled(true);
+ } else if (hash === HASH_DISABLE) {
+ window.localStorage.removeItem(STORAGE_KEY);
+ setEnabled(false);
+ } else {
+ setEnabled(window.localStorage.getItem(STORAGE_KEY) === '1');
+ }
+ };
+
+ sync();
+ window.addEventListener('hashchange', sync);
+ return () => window.removeEventListener('hashchange', sync);
+ }, []);
+
+ if (!enabled) return null;
+ return (
+ <Suspense fallback={null}>
+ <Agentation
+ copyToClipboard={false}
+ onCopy={copyText}
+ onSubmit={(output) => copyText(output)}
+ />
+ </Suspense>
+ );
+};
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index 73b95a070..d69cb315e 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -1,29 +1,65 @@
import React, { useEffect, useState } from 'react';
import { NavLink, Outlet, useLocation } from 'react-router-dom';
-import { LayoutDashboard, MessageSquare, Activity, Users, Globe2 } from 'lucide-react';
+import { Hash, LayoutDashboard, Settings, Users } from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import { useStatus } from '../context/StatusContext';
+import clsx from 'clsx';
+
import { useApi } from '../context/ApiContext';
+import { useStatus } from '../context/StatusContext';
import { LanguageSwitcher } from './LanguageSwitcher';
+import { ThemeToggle } from './ThemeToggle';
import { VersionBadge } from './VersionBadge';
-import clsx from 'clsx';
import logoImg from '../assets/logo.png';
import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms';
-const NavItem = ({ to, icon: Icon, children }: { to: string; icon: any; children: React.ReactNode }) => (
- <NavLink
- to={to}
- className={({ isActive }) =>
- clsx(
- 'flex items-center gap-3 px-3 py-2 rounded-md transition-colors',
- isActive ? 'bg-accent/10 text-accent font-medium' : 'text-muted hover:bg-neutral-100 hover:text-text'
- )
- }
- >
- <Icon className="w-5 h-5" />
- <span>{children}</span>
- </NavLink>
-);
+type ShellNavItem = {
+ to: string;
+ label: string;
+ icon: React.ComponentType<{ className?: string }>;
+ match?: (pathname: string) => boolean;
+};
+
+// Mirrors design.pen kSWgv (VR/Sidebar): 240px width, fill --surface,
+// right border, padding [20,16]. Mint-soft active state with mint glow.
+const ShellNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {
+ const location = useLocation();
+ const active = item.match ? item.match(location.pathname) : location.pathname === item.to;
+ const Icon = item.icon;
+
+ return (
+ <NavLink
+ to={item.to}
+ className={clsx(
+ 'group flex items-center gap-2.5 rounded-lg px-3 py-2.5 text-[13px] font-medium transition-colors',
+ active
+ ? 'border border-mint/30 bg-mint/[0.08] text-foreground shadow-[0_0_16px_-4px_rgba(91,255,160,0.5)]'
+ : 'border border-transparent text-muted hover:bg-white/[0.04] hover:text-foreground'
+ )}
+ >
+ <Icon className={clsx('size-4', active ? 'text-mint' : 'text-muted group-hover:text-foreground')} />
+ <span>{item.label}</span>
+ </NavLink>
+ );
+};
+
+const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {
+ const location = useLocation();
+ const active = item.match ? item.match(location.pathname) : location.pathname === item.to;
+ const Icon = item.icon;
+
+ return (
+ <NavLink
+ to={item.to}
+ className={clsx(
+ 'flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-lg px-1 py-2 text-[10px] transition-colors',
+ active ? 'bg-mint/[0.08] text-mint' : 'text-muted'
+ )}
+ >
+ <Icon className="size-4" />
+ <span className="max-w-full truncate">{item.label}</span>
+ </NavLink>
+ );
+};
export const AppShell: React.FC = () => {
const { t } = useTranslation();
@@ -38,63 +74,130 @@ export const AppShell: React.FC = () => {
setConfig(c);
setEnabledPlatforms(getEnabledPlatforms(c));
}).catch(() => {});
- }, []);
+ }, [api]);
- const isRunning = status.state === 'running';
const hasChannelPlatforms = enabledPlatforms.some((platform) => platformSupportsChannels(config, platform));
+ const isRunning = status.state === 'running';
if (location.pathname === '/setup') {
return <Outlet />;
}
+ const items: ShellNavItem[] = [
+ { to: '/dashboard', label: t('nav.dashboard'), icon: LayoutDashboard },
+ ...(hasChannelPlatforms ? [{ to: '/groups', label: t('nav.channels'), icon: Hash }] : []),
+ { to: '/users', label: t('nav.users'), icon: Users },
+ {
+ to: '/settings/service',
+ label: t('nav.settings'),
+ icon: Settings,
+ match: (pathname) => pathname.startsWith('/settings'),
+ },
+ ];
+
+ // Mobile nav uses the same routes as desktop; diagnostics lives under
+ // the Settings tab so we don't promote it to its own bottom-nav slot.
+ const mobileItems = items;
+
return (
- <div className="min-h-screen min-h-[100dvh] flex bg-bg text-text font-sans">
- {/* Sidebar */}
- <aside className="w-64 border-r border-border bg-panel hidden md:flex flex-col">
- <div className="p-6 border-b border-border">
- <div className="flex items-center gap-3">
- <img src={logoImg} alt="Vibe Remote Logo" className="w-10 h-10 rounded-lg" />
- <div className="flex flex-col">
- <h1 className="text-xl font-bold font-display tracking-tight leading-tight">
- {t('appShell.title')}
- </h1>
- <VersionBadge />
- </div>
+ <div className="min-h-screen min-h-[100dvh] bg-background text-foreground">
+ <aside className="fixed inset-y-0 left-0 hidden w-[240px] flex-col border-r border-border bg-surface md:flex">
+ <div className="flex h-full flex-col justify-between gap-6 px-4 py-5">
+ {/* Top: Brand + Workspace label + Nav list */}
+ <div className="flex flex-col gap-6">
+ <div className="flex items-center gap-2.5 px-1 py-2">
+ <img
+ src={logoImg}
+ alt="Vibe Remote Logo"
+ className="size-9 rounded-lg border border-mint/35 bg-mint/[0.08] object-cover shadow-[0_0_16px_-4px_rgba(91,255,160,0.5)]"
+ />
+ <div className="min-w-0">
+ <div className="truncate text-[13px] font-semibold text-foreground">{t('appShell.title')}</div>
+ <div className="truncate text-[11px] text-muted">{t('appShell.subtitle')}</div>
+ </div>
</div>
- </div>
- <nav className="flex-1 p-4 space-y-1">
- <NavItem to="/dashboard" icon={LayoutDashboard}>{t('nav.dashboard')}</NavItem>
- {hasChannelPlatforms && <NavItem to="/channels" icon={MessageSquare}>{t('nav.channels')}</NavItem>}
- <NavItem to="/users" icon={Users}>{t('nav.users')}</NavItem>
- <NavItem to="/remote-access" icon={Globe2}>{t('nav.remoteAccess')}</NavItem>
- <NavItem to="/doctor" icon={Activity}>{t('nav.doctor')}</NavItem>
- </nav>
-
- <div className="p-4 border-t border-border space-y-3">
- <LanguageSwitcher />
- <div className="flex items-center justify-between bg-neutral-50 p-3 rounded-lg border border-border">
- <div className="flex items-center gap-2">
- <div className={clsx("w-2.5 h-2.5 rounded-full", isRunning ? "bg-success" : "bg-muted")}></div>
- <span className="text-sm font-medium">{isRunning ? t('common.running') : t('common.stopped')}</span>
+ <div className="flex flex-col gap-2">
+ <div className="px-1 font-mono text-[10px] font-bold uppercase tracking-[0.18em] text-muted">
+ {t('appShell.workspaceLabel')}
+ </div>
+ <nav className="flex flex-col gap-0.5">
+ {items.map((item) => <ShellNavLink key={item.to} item={item} />)}
+ </nav>
+ </div>
+ </div>
+
+ {/* Bottom: Status (with embedded version badge) + toggles + hostname */}
+ <div className="flex flex-col gap-3">
+ <div
+ className={clsx(
+ 'flex items-center gap-2.5 rounded-lg border px-3 py-2.5',
+ isRunning
+ ? 'border-mint/30 bg-mint/[0.08]'
+ : 'border-border bg-white/[0.02]'
+ )}
+ >
+ <span
+ className={clsx(
+ 'size-2 shrink-0 rounded-full',
+ isRunning ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.9)]' : 'bg-muted'
+ )}
+ />
+ <div className="min-w-0 flex-1">
+ <div className="text-[12px] font-medium text-foreground">
+ {isRunning ? t('common.running') : t('common.stopped')}
</div>
- </div>
+ <div className="text-[10px] text-muted">{t('appShell.statusLabel')}</div>
+ </div>
+ <VersionBadge openUpward />
+ </div>
+
+ <div className="flex items-center gap-2">
+ <LanguageSwitcher openUpward />
+ <ThemeToggle />
+ </div>
+
+ {config?.runtime?.hostname && (
+ <div className="truncate font-mono text-[10px] text-muted">
+ {config.runtime.hostname}
+ </div>
+ )}
+ </div>
</div>
</aside>
- {/* Main Content */}
- <main className="flex-1 overflow-auto p-4 pb-[calc(6rem+env(safe-area-inset-bottom))] md:p-8">
- <Outlet />
+ <header className="sticky top-0 z-40 flex h-16 items-center justify-between gap-2 border-b border-border bg-background/92 px-4 backdrop-blur md:hidden">
+ <div className="flex min-w-0 items-center gap-2">
+ <img
+ src={logoImg}
+ alt="Vibe Remote Logo"
+ className="size-6 shrink-0 rounded-md border border-mint/30 bg-mint/[0.08] object-cover"
+ />
+ <span className="truncate text-[13px] font-semibold">{t('appShell.title')}</span>
+ </div>
+ <div className="flex shrink-0 items-center gap-1.5">
+ <VersionBadge />
+ <LanguageSwitcher />
+ <ThemeToggle />
+ </div>
+ </header>
+
+ <main
+ className={clsx(
+ 'min-h-screen pb-[calc(5.5rem+env(safe-area-inset-bottom))] md:ml-[240px] md:pb-0',
+ location.pathname.startsWith('/settings') ? 'page-glow-settings' : 'page-glow-console'
+ )}
+ >
+ <div className="mx-auto w-full px-4 py-5 md:px-10 md:py-8">
+ <Outlet />
+ </div>
</main>
- {/* Mobile Nav */}
- <nav className="md:hidden fixed bottom-0 left-0 right-0 bg-panel border-t border-border flex justify-around p-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] z-50">
- <NavLink to="/dashboard" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><LayoutDashboard /></NavLink>
- {hasChannelPlatforms && <NavLink to="/channels" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><MessageSquare /></NavLink>}
- <NavLink to="/users" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><Users /></NavLink>
- <NavLink to="/remote-access" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><Globe2 /></NavLink>
- <NavLink to="/doctor" className={({isActive}) => clsx("p-2 rounded-lg", isActive ? "text-accent" : "text-muted")}><Activity /></NavLink>
- </nav>
+ <nav className="fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-surface/96 px-2 py-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))] backdrop-blur md:hidden">
+ <div className="flex gap-1">
+ {mobileItems.map((item) => <MobileNavLink key={item.to} item={item} />)}
+ </div>
+ </nav>
</div>
);
};
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index a610a9527..b9adfa82b 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -1,589 +1,443 @@
-import React from 'react';
-import { useTranslation } from 'react-i18next';
-import { useStatus } from '../context/StatusContext';
-import { Play, Square, RotateCw, Activity, Terminal, CheckCircle, MessageSquare, Server, Settings, Info } from 'lucide-react';
+import React, { useEffect, useMemo, useState } from 'react';
+import {
+ Activity,
+ ArrowRight,
+ Clock,
+ Cpu,
+ Gauge,
+ Hash,
+ MessageSquare,
+ Play,
+ PlugZap,
+ RotateCw,
+ Square,
+ Zap,
+} from 'lucide-react';
import { Link } from 'react-router-dom';
-import { getEnabledPlatforms, getPrimaryPlatform } from '../lib/platforms';
-import { apiFetch } from '../lib/apiFetch';
+import { useTranslation } from 'react-i18next';
+import clsx from 'clsx';
+
+import { useApi, type LogEntry } from '@/context/ApiContext';
+import { useStatus } from '@/context/StatusContext';
+import { PlatformIcon } from '@/components/visual';
+import { getEnabledPlatforms, getPlatformCatalog, platformSupportsChannels } from '@/lib/platforms';
+
+function relativeFromIso(value?: string | null) {
+ if (!value) return null;
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return null;
+ const diffMs = date.getTime() - Date.now();
+ const diffSec = Math.round(diffMs / 1000);
+ const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });
+ if (Math.abs(diffSec) < 60) return rtf.format(diffSec, 'second');
+ const diffMin = Math.round(diffSec / 60);
+ if (Math.abs(diffMin) < 60) return rtf.format(diffMin, 'minute');
+ const diffHour = Math.round(diffMin / 60);
+ return rtf.format(diffHour, 'hour');
+}
+
+function absoluteFromIso(value?: string | null) {
+ if (!value) return null;
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return null;
+ return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });
+}
+
+function summarizeLog(message: string) {
+ return message.replace(/^\[[^\]]+\]\s*-?\s*/, '');
+}
+
+// Mirrors design.pen NbtYJ (Card/Stat): cornerRadius 12, fill --background,
+// stroke --border 1px, padding 20, gap 6. Top row (justify space-between)
+// label 13px + icon 16px muted; value 28px bold -0.4 tracking; trend 12px muted.
+const StatCard: React.FC<{
+ label: string;
+ value: string;
+ hint: string;
+ icon: React.ReactNode;
+}> = ({ label, value, hint, icon }) => (
+ <div className="flex flex-col gap-1.5 rounded-xl border border-border bg-background p-5">
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[13px] font-medium text-muted">{label}</span>
+ <span className="text-muted">{icon}</span>
+ </div>
+ <div className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">{value}</div>
+ <div className="text-[12px] font-medium text-muted">{hint}</div>
+ </div>
+);
export const Dashboard: React.FC = () => {
- const { t } = useTranslation();
- const { status, control } = useStatus();
- const [loading, setLoading] = React.useState(false);
- const [config, setConfig] = React.useState<any>({});
- const [doctor, setDoctor] = React.useState<any>(null);
- const [settingsMessage, setSettingsMessage] = React.useState<string | null>(null);
- const [uiSaving, setUiSaving] = React.useState(false);
- const [uiMessage, setUiMessage] = React.useState<string | null>(null);
- const [diagnosticsSaving, setDiagnosticsSaving] = React.useState(false);
- const [diagnosticsMessage, setDiagnosticsMessage] = React.useState<string | null>(null);
+ const { t } = useTranslation();
+ const api = useApi();
+ const { status, control } = useStatus();
+ const [config, setConfig] = useState<any>(null);
+ const [doctor, setDoctor] = useState<any>(null);
+ const [settingsByPlatform, setSettingsByPlatform] = useState<Record<string, any>>({});
+ const [usersCount, setUsersCount] = useState(0);
+ const [recentLogs, setRecentLogs] = useState<LogEntry[]>([]);
+ const [loading, setLoading] = useState(false);
- const handleAction = async (action: string) => {
- setLoading(true);
- try {
- await control(action);
- } finally {
- setLoading(false);
- }
- };
+ useEffect(() => {
+ let cancelled = false;
- // Auto-save Message Handling config (no restart needed)
- const autoSaveMessageConfig = async (newConfig: any) => {
- try {
- const patch = {
- platform: getPrimaryPlatform(newConfig),
- platforms: newConfig.platforms,
- ack_mode: newConfig.ack_mode,
- show_duration: newConfig.show_duration,
- include_user_info: newConfig.include_user_info,
- reply_enhancements: newConfig.reply_enhancements,
- slack: newConfig.slack,
- discord: newConfig.discord,
- telegram: newConfig.telegram,
- lark: newConfig.lark,
- wechat: newConfig.wechat,
- agents: newConfig.agents,
- };
- await apiFetch('/config', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(patch),
- });
- setSettingsMessage(t('common.saved'));
- } catch {
- setSettingsMessage(t('common.saveFailed'));
- }
- };
+ const load = async () => {
+ try {
+ const nextConfig = await api.getConfig();
+ if (cancelled) return;
+ setConfig(nextConfig);
+
+ const enabledPlatforms = getEnabledPlatforms(nextConfig);
+ const [doctorRes, logsRes, settingsEntries, usersEntries] = await Promise.all([
+ api.doctor(),
+ api.getLogs(8, 'service'),
+ Promise.all(enabledPlatforms.map(async (platform) => [platform, await api.getSettings(platform)] as const)),
+ Promise.all(enabledPlatforms.map(async (platform) => [platform, await api.getUsers(platform)] as const)),
+ ]);
- // Save Console Server config and restart UI service
- const handleUiSaveRestart = async () => {
- setUiSaving(true);
- setUiMessage(null);
- try {
- const uiPayload = {
- setup_host: config.ui?.setup_host || '127.0.0.1',
- setup_port: config.ui?.setup_port || 5123,
- };
- const configPayload = {
- ui: { ...(config.ui || {}), ...uiPayload },
- };
- // Save config first
- await apiFetch('/config', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(configPayload),
- });
- // Restart UI service
- await apiFetch('/ui/reload', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ host: uiPayload.setup_host, port: uiPayload.setup_port }),
- });
- setUiMessage(t('dashboard.uiRestartMessage'));
- const newUrl = `http://${uiPayload.setup_host}:${uiPayload.setup_port}`;
- window.setTimeout(() => {
- window.location.href = newUrl;
- }, 2000);
- } catch {
- setUiMessage(t('common.saveFailed'));
- } finally {
- setUiSaving(false);
+ if (cancelled) return;
+ setDoctor(doctorRes);
+ setRecentLogs((logsRes.logs || []).slice(-5).reverse());
+ setSettingsByPlatform(Object.fromEntries(settingsEntries));
+ setUsersCount(
+ usersEntries.reduce((sum, [, payload]) => sum + Object.keys(payload?.users || {}).length, 0)
+ );
+ } catch {
+ if (!cancelled) {
+ setRecentLogs([]);
}
+ }
};
- // Save Diagnostics config and restart main service
- const handleDiagnosticsSaveRestart = async () => {
- setDiagnosticsSaving(true);
- setDiagnosticsMessage(null);
- try {
- const runtimePayload = {
- log_level: config.runtime?.log_level || 'INFO',
- };
- const configPayload = {
- runtime: runtimePayload,
- };
- await apiFetch('/config', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(configPayload),
- });
- await control('restart');
- setDiagnosticsMessage(t('dashboard.mainServiceRestarted'));
- } catch {
- setDiagnosticsMessage(t('common.saveFailed'));
- } finally {
- setDiagnosticsSaving(false);
- }
+ void load();
+ return () => {
+ cancelled = true;
};
+ }, [api]);
+ const handleAction = async (action: string) => {
+ setLoading(true);
+ try {
+ await control(action);
+ } finally {
+ setLoading(false);
+ }
+ };
- React.useEffect(() => {
- const load = async () => {
- try {
- const res = await fetch('/config');
- if (res.ok) {
- const nextConfig = await res.json();
- setConfig(nextConfig);
- }
- const doctorRes = await apiFetch('/doctor', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' });
- if (doctorRes.ok) {
- setDoctor(await doctorRes.json());
- }
- } catch {
- // ignore
- }
- };
- load();
- }, []);
+ const platformCatalog = useMemo(() => getPlatformCatalog(config), [config]);
+ const enabledPlatforms = useMemo(() => getEnabledPlatforms(config), [config]);
+ const lastUpdated = relativeFromIso(status.updated_at);
+ const startedAtRelative = relativeFromIso(status.started_at);
+ const startedAtAbsolute = absoluteFromIso(status.started_at);
+ const totalActiveGroups = useMemo(
+ () =>
+ Object.values(settingsByPlatform).reduce(
+ (sum, payload: any) =>
+ sum + Object.values(payload?.channels || {}).filter((item: any) => item?.enabled).length,
+ 0
+ ),
+ [settingsByPlatform]
+ );
+ const totalDiscoveredGroups = useMemo(
+ () =>
+ Object.values(settingsByPlatform).reduce(
+ (sum, payload: any) => sum + Object.keys(payload?.channels || {}).length,
+ 0
+ ),
+ [settingsByPlatform]
+ );
- React.useEffect(() => {
- if (!settingsMessage) return;
- const timer = window.setTimeout(() => {
- setSettingsMessage(null);
- }, 4000);
- return () => window.clearTimeout(timer);
- }, [settingsMessage]);
+ const platformCards = platformCatalog.map((platform) => {
+ const platformSettings = settingsByPlatform[platform.id] || {};
+ const groups = platformSettings.channels || {};
+ const activeGroups = Object.values(groups).filter((item: any) => item?.enabled).length;
+ const discoveredGroups = Object.keys(groups).length;
+ const enabled = enabledPlatforms.includes(platform.id);
+ const supportsGroups = platformSupportsChannels(config, platform.id);
- React.useEffect(() => {
- if (!diagnosticsMessage) return;
- const timer = window.setTimeout(() => {
- setDiagnosticsMessage(null);
- }, 4000);
- return () => window.clearTimeout(timer);
- }, [diagnosticsMessage]);
+ return {
+ id: platform.id,
+ title: t(platform.title_key || `platform.${platform.id}.title`),
+ enabled,
+ supportsGroups,
+ activeGroups,
+ discoveredGroups,
+ actionHref: supportsGroups ? '/groups' : '/settings/platforms',
+ actionLabel: supportsGroups ? t('dashboard.manageRoute') : t('dashboard.configure'),
+ };
+ });
- const enabledPlatforms = getEnabledPlatforms(config);
- const primaryPlatform = getPrimaryPlatform(config);
- const showWorkspaceGateway = config.mode !== 'self_host' && enabledPlatforms.includes('slack');
+ const isRunning = status.state === 'running';
+ const issuesCount = (doctor?.summary?.fail || 0) + (doctor?.summary?.warn || 0);
- return (
- <div className="max-w-5xl mx-auto space-y-8">
- <header className="flex items-center justify-between">
- <div>
- <h2 className="text-3xl font-display font-bold mb-2 text-text">{t('dashboard.title')}</h2>
- <p className="text-muted">{t('dashboard.subtitle')}</p>
- </div>
- </header>
+ const enabledPlatformTitles = platformCards
+ .filter((p) => p.enabled)
+ .map((p) => p.title)
+ .join(' · ');
- {/* Overview Card */}
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-6">
- <div>
- <h3 className="text-lg font-semibold flex items-center gap-2">
- {t('dashboard.serviceStatus')}
- <span className={`px-2 py-0.5 rounded-full text-xs font-medium ${
- status.state === 'running' ? 'bg-success/10 text-success' : 'bg-muted/10 text-muted'
- }`}>
- {status.state?.toUpperCase() || t('common.unknown').toUpperCase()}
- </span>
- </h3>
- <p className="text-sm text-muted mt-1">PID: {status.service_pid || status.pid || '-'}</p>
- </div>
- <div className="flex gap-2">
- {status.state !== 'running' && (
- <button
- onClick={() => handleAction('start')}
- disabled={loading}
- className="flex items-center gap-2 px-4 py-2 bg-success text-white rounded-lg hover:bg-success/90 disabled:opacity-50 font-medium shadow-sm transition-colors"
- >
- <Play size={16} /> {t('common.start')}
- </button>
- )}
- {status.state === 'running' && (
- <button
- onClick={() => handleAction('stop')}
- disabled={loading}
- className="flex items-center gap-2 px-4 py-2 bg-danger text-white rounded-lg hover:bg-danger/90 disabled:opacity-50 font-medium shadow-sm transition-colors"
- >
- <Square size={16} /> {t('common.stop')}
- </button>
- )}
- <button
- onClick={() => handleAction('restart')}
- disabled={loading}
- className="flex items-center gap-2 px-4 py-2 border border-border bg-white hover:bg-neutral-50 rounded-lg disabled:opacity-50 text-text font-medium transition-colors"
- >
- <RotateCw size={16} /> {t('common.restart')}
- </button>
- </div>
- </div>
+ return (
+ <div className="flex flex-col gap-8">
+ <div className="flex flex-col gap-1.5">
+ <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('dashboard.title')}
+ </h1>
+ <p className="text-[14px] text-muted">{t('dashboard.subtitle')}</p>
+ </div>
- <div className={`grid grid-cols-1 gap-6 border-t border-border pt-6 ${showWorkspaceGateway ? 'md:grid-cols-3' : 'md:grid-cols-1'}`}>
- <div>
- <div className="text-sm text-muted mb-1">{t('dashboard.mode')}</div>
- <div className="font-mono font-medium text-text capitalize">{config.mode || '-'}</div>
- </div>
- {showWorkspaceGateway && (
- <div>
- <div className="text-sm text-muted mb-1">{t('dashboard.workspace')}</div>
- <div className="font-medium text-text">{config.slack?.team_name || '-'}</div>
- <div className="text-xs text-muted font-mono">{config.slack?.team_id || ''}</div>
- </div>
- )}
- {showWorkspaceGateway && (
- <div>
- <div className="text-sm text-muted mb-1">{t('dashboard.gateway')}</div>
- <div className="flex items-center gap-2">
- <div className={`w-2 h-2 rounded-full ${config.gateway?.relay_url ? 'bg-success' : 'bg-danger'}`}></div>
- <span className="text-text">{config.gateway?.relay_url ? t('common.online') : t('common.offline')}</span>
- </div>
- </div>
- )}
- </div>
+ {/* Mirrors design.pen kgGuL (heroStatus): cornerRadius 16, fill --surface-2,
+ mint stroke 33%, padding [28, 32], shadow blur 48 #5BFFA014 y24 spread -12 */}
+ <div
+ className={clsx(
+ 'flex flex-wrap items-center justify-between gap-6 rounded-2xl border bg-surface-2 px-6 py-7 md:px-8',
+ 'shadow-[0_24px_48px_-12px_rgba(91,255,160,0.078)]',
+ isRunning ? 'border-mint/30' : 'border-border'
+ )}
+ >
+ <div className="flex min-w-0 items-center gap-5">
+ {/* heroPulse: 52×52 mint-soft circle, blur 24 spread -6 #5BFFA070 glow */}
+ <div
+ className={clsx(
+ 'flex size-[52px] shrink-0 items-center justify-center rounded-full border',
+ isRunning
+ ? 'border-mint/35 bg-mint/[0.08] shadow-[0_0_24px_-6px_rgba(91,255,160,0.44)]'
+ : 'border-border bg-white/[0.04]'
+ )}
+ >
+ <Zap
+ className={clsx('size-5', isRunning ? 'text-mint' : 'text-muted')}
+ strokeWidth={2.25}
+ />
+ </div>
+ <div className="flex min-w-0 flex-col gap-1.5">
+ <div className="flex flex-wrap items-center gap-2">
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em]',
+ isRunning
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-border bg-white/[0.04] text-muted'
+ )}
+ >
+ <span
+ className={clsx(
+ 'size-1.5 rounded-full',
+ isRunning ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.9)]' : 'bg-muted'
+ )}
+ />
+ {isRunning ? t('dashboard.runningTitle') : t('dashboard.stoppedTitle')}
+ </span>
+ {!doctor?.ok && (
+ <span className="inline-flex items-center rounded-full border border-gold/30 bg-gold/10 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] text-gold">
+ {t('dashboard.levelAttention')}
+ </span>
+ )}
</div>
-
- {/* Quick Actions / Snapshots */}
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-4">
- <h3 className="font-semibold flex items-center gap-2 text-text"><Activity size={18} /> {t('dashboard.health')}</h3>
- <Link to="/doctor" className="text-sm text-accent hover:underline font-medium">{t('common.viewDetails')}</Link>
- </div>
- <div className={`flex items-center gap-2 font-medium ${doctor?.ok ? 'text-success' : 'text-warning'}`}>
- <CheckCircle size={16} /> {doctor?.ok ? t('dashboard.allSystemsOperational') : t('dashboard.issuesDetected')}
- </div>
+ <div className="text-[18px] font-semibold leading-snug text-foreground">
+ {t('dashboard.heroTitle')}
</div>
-
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-4">
- <h3 className="font-semibold flex items-center gap-2 text-text"><Settings size={18} /> {t('dashboard.globalPolicy')}</h3>
- <Link to="/setup" className="text-sm text-accent hover:underline font-medium">{t('common.editSetup')}</Link>
- </div>
- <div className="space-y-3 text-sm">
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.mode')}</span>
- <span className="font-mono text-xs text-text capitalize">{config.mode || '-'}</span>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.platform')}</span>
- <span className="font-mono text-xs text-text capitalize">{enabledPlatforms.join(', ') || primaryPlatform}</span>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.defaultBackend')}</span>
- <span className="font-mono text-xs text-text">{config.agents?.default_backend || '-'}</span>
- </div>
- {showWorkspaceGateway && (
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.slackWorkspace')}</span>
- <span className="text-xs text-text">{config.slack?.team_name || t('common.notLinked')}</span>
- </div>
- )}
- {showWorkspaceGateway && (
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.gateway')}</span>
- <span className="text-xs text-text">{config.gateway?.relay_url ? t('common.online') : t('common.offline')}</span>
- </div>
- )}
- </div>
+ <div className="flex flex-wrap items-center gap-x-2.5 gap-y-1 font-mono text-[11px] leading-none text-muted">
+ <span className="inline-flex items-center gap-1">
+ <Cpu className="size-3 shrink-0" strokeWidth={2} />
+ {status.service_pid || status.pid
+ ? `PID ${status.service_pid || status.pid}`
+ : t('common.unknown')}
+ </span>
+ {isRunning && startedAtAbsolute && (
+ <span
+ className="inline-flex items-center gap-1"
+ title={status.started_at as string | undefined}
+ >
+ <Clock className="size-3 shrink-0" strokeWidth={2} />
+ {t('dashboard.startedAt', {
+ time: startedAtAbsolute,
+ relative: startedAtRelative ?? '',
+ })}
+ </span>
+ )}
+ {!isRunning && lastUpdated && (
+ <span className="inline-flex items-center gap-1">
+ <Clock className="size-3 shrink-0" strokeWidth={2} />
+ {lastUpdated}
+ </span>
+ )}
+ {status.last_action && <span>· {status.last_action}</span>}
</div>
+ </div>
+ </div>
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-4">
- <h3 className="font-semibold flex items-center gap-2 text-text"><MessageSquare size={18} /> {t('dashboard.messageHandling')}</h3>
- </div>
- <div className="space-y-3 text-sm">
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.ackMode')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
- {t('dashboard.ackModeHint')}
- </span>
- </span>
- </span>
- <select
- value={config.ack_mode || 'typing'}
- onChange={(e) => {
- const mode = e.target.value || 'typing';
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- ack_mode: mode,
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className="w-36 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"
- >
- <option value="typing">{t('dashboard.ackTyping')}</option>
- <option value="reaction">{t('dashboard.ackReaction')}</option>
- <option value="message">{t('dashboard.ackMessage')}</option>
- </select>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.errorRetryLimit')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 w-56 text-center">
- {t('dashboard.errorRetryLimitHint')}
- </span>
- </span>
- </span>
- <input
- type="number"
- min={0}
- max={10}
- value={config.agents?.opencode?.error_retry_limit ?? 1}
- onChange={(e) => {
- const limit = Math.max(0, Math.min(10, Number(e.target.value) || 0));
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- agents: {
- ...(config.agents || {}),
- opencode: {
- ...(config.agents?.opencode || {}),
- error_retry_limit: limit,
- },
- },
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className="w-16 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono text-center"
- />
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.showDuration')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
- {t('dashboard.showDurationHint')}
- </span>
- </span>
- </span>
- <button
- onClick={() => {
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- show_duration: !config.show_duration,
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className={`px-2 py-1 rounded text-xs font-semibold border ${
- config.show_duration !== false
- ? 'bg-success/10 text-success border-success/20'
- : 'bg-neutral-100 text-muted border-border'
- }`}
- >
- {config.show_duration !== false
- ? t('common.enabled')
- : t('common.disabled')}
- </button>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.includeUserInfo')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
- {t('dashboard.includeUserInfoHint')}
- </span>
- </span>
- </span>
- <button
- onClick={() => {
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- include_user_info: !config.include_user_info,
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className={`px-2 py-1 rounded text-xs font-semibold border ${
- config.include_user_info
- ? 'bg-success/10 text-success border-success/20'
- : 'bg-neutral-100 text-muted border-border'
- }`}
- >
- {config.include_user_info
- ? t('common.enabled')
- : t('common.disabled')}
- </button>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.replyEnhancements')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
- {t('dashboard.replyEnhancementsHint')}
- </span>
- </span>
- </span>
- <button
- onClick={() => {
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- reply_enhancements: !config.reply_enhancements,
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className={`px-2 py-1 rounded text-xs font-semibold border ${
- config.reply_enhancements !== false
- ? 'bg-success/10 text-success border-success/20'
- : 'bg-neutral-100 text-muted border-border'
- }`}
- >
- {config.reply_enhancements !== false
- ? t('common.enabled')
- : t('common.disabled')}
- </button>
- </div>
- {enabledPlatforms.includes('slack') && (
- <div className="flex justify-between items-center">
- <span className="text-muted flex items-center gap-1">
- {t('dashboard.slackLinkPreviews')}
- <span className="relative group">
- <Info size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 w-60 text-center">
- {t('dashboard.slackLinkPreviewsHint')}
- </span>
- </span>
- </span>
- <button
- onClick={() => {
- setSettingsMessage(null);
- const newConfig = {
- ...config,
- slack: {
- ...(config.slack || {}),
- disable_link_unfurl: !config.slack?.disable_link_unfurl,
- },
- };
- setConfig(newConfig);
- autoSaveMessageConfig(newConfig);
- }}
- className={`px-2 py-1 rounded text-xs font-semibold border ${
- config.slack?.disable_link_unfurl
- ? 'bg-success/10 text-success border-success/20'
- : 'bg-neutral-100 text-muted border-border'
- }`}
- >
- {config.slack?.disable_link_unfurl
- ? t('common.enabled')
- : t('common.disabled')}
- </button>
- </div>
- )}
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.allowedChannels')}</span>
- <Link to="/channels" className="text-xs text-accent hover:underline font-medium">{t('common.manageChannels')}</Link>
- </div>
- </div>
- </div>
+ <div className="flex flex-wrap items-center gap-2">
+ {!isRunning && (
+ <button
+ type="button"
+ onClick={() => void handleAction('start')}
+ disabled={loading}
+ className="inline-flex items-center gap-1.5 rounded-lg bg-mint px-4 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-6px_rgba(91,255,160,0.44)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <Play className="size-3.5" strokeWidth={2.5} />
+ {t('common.start')}
+ </button>
+ )}
+ {isRunning && (
+ <button
+ type="button"
+ onClick={() => void handleAction('stop')}
+ disabled={loading}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2.5 text-[13px] font-medium text-foreground transition hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <Square className="size-3.5" strokeWidth={2.5} />
+ {t('common.stop')}
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={() => void handleAction('restart')}
+ disabled={loading}
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-lg px-4 py-2.5 text-[13px] font-bold transition disabled:cursor-not-allowed disabled:opacity-50',
+ isRunning
+ ? 'bg-mint text-[#080812] shadow-[0_0_24px_-6px_rgba(91,255,160,0.44)] hover:brightness-105'
+ : 'border border-border bg-white/[0.04] text-foreground hover:border-border-strong'
+ )}
+ >
+ <RotateCw className="size-3.5" strokeWidth={2.5} />
+ {t('common.restart')}
+ </button>
+ </div>
+ </div>
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-4">
- <h3 className="font-semibold flex items-center gap-2 text-text"><Server size={18} /> {t('dashboard.consoleServer')}</h3>
- </div>
- <div className="space-y-3 text-sm">
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.host')}</span>
- <input
- type="text"
- value={config.ui?.setup_host || '127.0.0.1'}
- onChange={(e) => {
- const host = e.target.value || '127.0.0.1';
- setUiMessage(null);
- setConfig((prev: any) => ({
- ...prev,
- ui: { ...(prev.ui || {}), setup_host: host },
- }));
- }}
- className="w-40 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"
- />
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.port')}</span>
- <input
- type="number"
- min={1024}
- max={65535}
- value={config.ui?.setup_port || 5123}
- onChange={(e) => {
- const port = Number(e.target.value) || 5123;
- setUiMessage(null);
- setConfig((prev: any) => ({
- ...prev,
- ui: { ...(prev.ui || {}), setup_port: port },
- }));
- }}
- className="w-24 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"
- />
+ {/* Mirrors design.pen statsRow + NbtYJ Card/Stat */}
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
+ <StatCard
+ label={t('dashboard.metricPlatforms')}
+ value={`${enabledPlatforms.length} / ${platformCatalog.length}`}
+ hint={enabledPlatformTitles || t('dashboard.metricPlatformsHint')}
+ icon={<PlugZap className="size-4" />}
+ />
+ <StatCard
+ label={t('dashboard.metricGroups')}
+ value={String(totalActiveGroups)}
+ hint={t('dashboard.metricGroupsHint').replace('{{count}}', String(totalDiscoveredGroups))}
+ icon={<Hash className="size-4" />}
+ />
+ <StatCard
+ label={t('dashboard.metricUsers')}
+ value={String(usersCount)}
+ hint={t('dashboard.metricUsersHint')}
+ icon={<MessageSquare className="size-4" />}
+ />
+ <StatCard
+ label={t('dashboard.metricHealth')}
+ value={String(issuesCount)}
+ hint={doctor?.ok ? t('dashboard.metricHealthHealthy') : t('dashboard.metricHealthIssues')}
+ icon={<Gauge className="size-4" />}
+ />
+ </div>
+
+ {/* Mirrors design.pen l0yMzY (twoCol) — platformsCard 1.2fr / activityCard 420px.
+ Both: cornerRadius 12, fill --background, stroke --border 1px,
+ head padding [20, 24] with bottom border, body fill_container. */}
+ <div className="grid gap-6 xl:grid-cols-[1.2fr_0.8fr]">
+ <div className="flex flex-col overflow-hidden rounded-xl border border-border bg-background">
+ <div className="flex items-center justify-between gap-4 border-b border-border px-6 py-5">
+ <div className="flex flex-col gap-0.5">
+ <h2 className="text-[15px] font-semibold text-foreground">
+ {t('dashboard.platformOverviewTitle')}
+ </h2>
+ <p className="text-[12px] text-muted">{t('dashboard.platformOverviewSubtitle')}</p>
+ </div>
+ <Link
+ to="/settings/platforms"
+ className="inline-flex items-center gap-1 rounded-lg border border-border bg-white/[0.04] px-3 py-1.5 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ {t('dashboard.manageAll')}
+ <ArrowRight className="size-3.5" strokeWidth={2.25} />
+ </Link>
+ </div>
+ <div className="flex flex-col divide-y divide-border">
+ {platformCards.map((platform) => (
+ <div key={platform.id} className="flex items-center justify-between gap-4 px-6 py-4">
+ <div className="flex min-w-0 items-center gap-3">
+ <div className="flex size-10 shrink-0 items-center justify-center rounded-lg border border-border bg-surface-2">
+ <PlatformIcon platform={platform.id as any} size={18} />
+ </div>
+ <div className="flex min-w-0 flex-col gap-0.5">
+ <div className="text-[13px] font-semibold text-foreground">{platform.title}</div>
+ <div className="text-[11px] text-muted">
+ {platform.supportsGroups
+ ? t('dashboard.platformGroupsHint')
+ .replace('{{active}}', String(platform.activeGroups))
+ .replace('{{discovered}}', String(platform.discoveredGroups))
+ : t('dashboard.platformNoGroupsHint')}
</div>
+ </div>
</div>
- <div className="flex justify-between items-center mt-4 pt-4 border-t border-border">
- {uiMessage && <span className="text-xs text-muted">{uiMessage}</span>}
- {!uiMessage && <span />}
- <button
- onClick={handleUiSaveRestart}
- disabled={uiSaving}
- className="px-3 py-1.5 bg-accent text-white rounded-md text-xs font-semibold disabled:opacity-50 flex items-center gap-1"
- >
- <RotateCw size={12} /> {uiSaving ? t('common.saving') : t('common.saveAndRestart')}
- </button>
+ <div className="flex items-center gap-3">
+ <span
+ className={clsx(
+ 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium',
+ platform.enabled
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-border bg-white/[0.04] text-muted'
+ )}
+ >
+ {platform.enabled ? t('dashboard.connected') : t('dashboard.notConfigured')}
+ </span>
+ <Link
+ to={platform.actionHref}
+ className="inline-flex items-center gap-1 text-[12px] font-medium text-foreground transition hover:text-mint"
+ >
+ {platform.actionLabel}
+ <ArrowRight className="size-3.5" strokeWidth={2.25} />
+ </Link>
</div>
- </div>
+ </div>
+ ))}
+ </div>
+ </div>
- <div className="bg-panel rounded-xl border border-border p-6 shadow-sm">
- <div className="flex items-center justify-between mb-4">
- <h3 className="font-semibold flex items-center gap-2 text-text"><Terminal size={18} /> {t('dashboard.diagnostics')}</h3>
- <Link to="/doctor/logs" className="text-sm text-accent hover:underline font-medium">{t('common.viewLogs')}</Link>
- </div>
- <div className="space-y-3 text-sm">
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.logLevel')}</span>
- <select
- value={config.runtime?.log_level || 'INFO'}
- onChange={(e) => {
- const level = e.target.value || 'INFO';
- setDiagnosticsMessage(null);
- setConfig((prev: any) => ({
- ...prev,
- runtime: { ...(prev.runtime || {}), log_level: level },
- }));
- }}
- className="w-28 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"
- >
- {['DEBUG', 'INFO', 'WARNING', 'ERROR'].map((level) => (
- <option key={level} value={level}>{level}</option>
- ))}
- </select>
- </div>
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.configFile')}</span>
- <code className="font-mono text-xs bg-neutral-100 px-2 py-1 rounded text-text">~/.vibe_remote/config/config.json</code>
+ <div className="flex flex-col overflow-hidden rounded-xl border border-border bg-background">
+ <div className="flex items-center justify-between gap-4 border-b border-border px-6 py-5">
+ <div className="flex flex-col gap-0.5">
+ <h2 className="text-[15px] font-semibold text-foreground">
+ {t('dashboard.recentActivityTitle')}
+ </h2>
+ <p className="text-[12px] text-muted">{t('dashboard.recentActivitySubtitle')}</p>
+ </div>
+ <Link
+ to="/logs"
+ className="inline-flex items-center gap-1 text-[12px] font-medium text-foreground transition hover:text-mint"
+ >
+ {t('common.viewLogs')}
+ <ArrowRight className="size-3.5" strokeWidth={2.25} />
+ </Link>
+ </div>
+ <div className="flex flex-col divide-y divide-border">
+ {recentLogs.length === 0 ? (
+ <div className="px-6 py-8 text-center text-[12px] text-muted">
+ {t('dashboard.recentActivityEmpty')}
+ </div>
+ ) : (
+ recentLogs.map((entry, index) => (
+ <div
+ key={`${entry.timestamp}-${index}`}
+ className="flex items-start gap-3 px-6 py-3.5"
+ >
+ <div className="mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border border-cyan/30 bg-cyan/[0.08] text-cyan">
+ <Activity className="size-3.5" strokeWidth={2.25} />
+ </div>
+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <div className="line-clamp-2 text-[12px] font-medium text-foreground">
+ {summarizeLog(entry.message)}
</div>
- <div className="flex justify-between items-center">
- <span className="text-muted">{t('dashboard.logs')}</span>
- <code className="font-mono text-xs bg-neutral-100 px-2 py-1 rounded text-text">~/.vibe_remote/logs/vibe_remote.log</code>
+ <div className="font-mono text-[10px] text-muted">
+ {relativeFromIso(entry.timestamp) || entry.timestamp} · {entry.logger}
</div>
+ </div>
</div>
- <div className="flex justify-between items-center mt-4 pt-4 border-t border-border">
- {diagnosticsMessage && <span className="text-xs text-muted">{diagnosticsMessage}</span>}
- {!diagnosticsMessage && <span />}
- <button
- onClick={handleDiagnosticsSaveRestart}
- disabled={diagnosticsSaving}
- className="px-3 py-1.5 bg-accent text-white rounded-md text-xs font-semibold disabled:opacity-50 flex items-center gap-1"
- >
- <RotateCw size={12} /> {diagnosticsSaving ? t('common.saving') : t('common.saveAndRestart')}
- </button>
- </div>
- </div>
- </div>
-
-
-
+ ))
+ )}
+ </div>
</div>
- );
+ </div>
+ </div>
+ );
};
diff --git a/ui/src/components/LanguageSwitcher.tsx b/ui/src/components/LanguageSwitcher.tsx
index 0746be818..84d4f9e22 100644
--- a/ui/src/components/LanguageSwitcher.tsx
+++ b/ui/src/components/LanguageSwitcher.tsx
@@ -1,18 +1,19 @@
-import React, { useEffect } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { Languages } from 'lucide-react';
+import { Check } from 'lucide-react';
+import clsx from 'clsx';
import { useApi } from '../context/ApiContext';
-export const LanguageSwitcher: React.FC = () => {
+export const LanguageSwitcher: React.FC<{ openUpward?: boolean }> = ({ openUpward = false }) => {
const { i18n, t } = useTranslation();
const { getConfig, saveConfig } = useApi();
+ const [isOpen, setIsOpen] = useState(false);
+ const wrapRef = useRef<HTMLDivElement>(null);
- // Load config and sync language on mount
useEffect(() => {
const loadConfig = async () => {
try {
const cfg = await getConfig();
- // Sync i18n with config language
if (cfg.language && cfg.language !== i18n.language) {
i18n.changeLanguage(cfg.language);
}
@@ -23,6 +24,18 @@ export const LanguageSwitcher: React.FC = () => {
loadConfig();
}, []);
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ if (wrapRef.current && !wrapRef.current.contains(event.target as Node)) {
+ setIsOpen(false);
+ }
+ };
+ if (isOpen) {
+ document.addEventListener('mousedown', handleClickOutside);
+ }
+ return () => document.removeEventListener('mousedown', handleClickOutside);
+ }, [isOpen]);
+
const languageCodes = Object.keys(i18n.options.resources ?? {});
const availableLanguages = languageCodes.length ? languageCodes : ['en'];
const languages = availableLanguages.map((code) => ({
@@ -31,32 +44,67 @@ export const LanguageSwitcher: React.FC = () => {
}));
const currentLang = languages.find((l) => l.code === i18n.language) || languages[0];
- const handleChange = async (e: React.ChangeEvent<HTMLSelectElement>) => {
- const newLang = e.target.value;
- i18n.changeLanguage(newLang);
+ const shortLabel = (code: string) => {
+ if (code === 'zh') return '中';
+ return code.slice(0, 2).toUpperCase();
+ };
- // Save to config
+ const handleSelect = async (code: string) => {
+ setIsOpen(false);
+ if (code === i18n.language) return;
+ i18n.changeLanguage(code);
try {
- await saveConfig({ language: newLang });
+ await saveConfig({ language: code });
} catch {
// Ignore save errors - language change already applied locally
}
};
return (
- <div className="flex items-center gap-2">
- <Languages size={16} className="text-muted" />
- <select
- value={currentLang.code}
- onChange={handleChange}
- className="bg-transparent border border-border rounded px-2 py-1 text-sm text-text cursor-pointer hover:bg-neutral-50 focus:outline-none focus:ring-1 focus:ring-accent"
+ <div className="relative" ref={wrapRef}>
+ <button
+ type="button"
+ onClick={() => setIsOpen((v) => !v)}
+ aria-label={currentLang.label}
+ title={currentLang.label}
+ aria-haspopup="listbox"
+ aria-expanded={isOpen}
+ className="inline-flex h-8 w-8 items-center justify-center rounded-md border border-border-strong bg-surface-2/40 text-[11px] font-semibold text-muted transition hover:bg-surface-2 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring"
>
- {languages.map((lang) => (
- <option key={lang.code} value={lang.code}>
- {lang.label}
- </option>
- ))}
- </select>
+ {shortLabel(currentLang.code)}
+ </button>
+
+ {isOpen && (
+ <div
+ role="listbox"
+ className={clsx(
+ 'absolute right-0 z-50 min-w-[10rem] rounded-lg border border-border bg-popover py-1 text-popover-foreground shadow-xl',
+ openUpward ? 'bottom-full mb-2' : 'top-full mt-2'
+ )}
+ >
+ {languages.map((lang) => {
+ const active = lang.code === currentLang.code;
+ return (
+ <button
+ key={lang.code}
+ type="button"
+ role="option"
+ aria-selected={active}
+ onClick={() => handleSelect(lang.code)}
+ className={clsx(
+ 'flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm transition-colors',
+ active
+ ? 'text-foreground'
+ : 'text-muted hover:bg-surface-2 hover:text-foreground'
+ )}
+ >
+ <span>{lang.label}</span>
+ {active && <Check size={14} className="text-mint" />}
+ </button>
+ );
+ })}
+ </div>
+ )}
</div>
);
};
diff --git a/ui/src/components/RemoteAccess.tsx b/ui/src/components/RemoteAccess.tsx
index 6847d26d5..be2ebaeb2 100644
--- a/ui/src/components/RemoteAccess.tsx
+++ b/ui/src/components/RemoteAccess.tsx
@@ -6,7 +6,7 @@ import { useToast } from '../context/ToastContext';
const VIBE_CLOUD_URL = 'https://avibe.bot';
-export const RemoteAccess: React.FC = () => {
+export const RemoteAccess: React.FC<{ embedded?: boolean }> = ({ embedded = false }) => {
const { t } = useTranslation();
const api = useApi();
const { showToast } = useToast();
@@ -120,19 +120,131 @@ export const RemoteAccess: React.FC = () => {
? t('common.running')
: t('common.stopped');
+ if (embedded) {
+ return (
+ <section className="overflow-hidden rounded-md border border-border bg-surface-2/45">
+ <div className="flex items-start justify-between gap-4 border-b border-border px-4 py-3">
+ <div className="min-w-0 space-y-1">
+ <h2 className="text-[13px] font-semibold text-foreground">{t('remoteAccess.title')}</h2>
+ <p className="max-w-2xl text-[11px] leading-relaxed text-muted">{t('remoteAccess.subtitle')}</p>
+ </div>
+ <button
+ className="inline-flex h-8 shrink-0 items-center gap-2 whitespace-nowrap rounded-md border border-border bg-surface-3 px-3 text-[12px] text-foreground transition hover:border-border-strong"
+ onClick={refresh}
+ type="button"
+ >
+ <RefreshCcw className="size-3.5" />
+ {t('common.refresh')}
+ </button>
+ </div>
+
+ <div className="grid border-b border-border md:grid-cols-3">
+ <div className="border-b border-border px-4 py-3 md:border-b-0 md:border-r">
+ <div className="text-[11px] text-muted">{t('remoteAccess.paired')}</div>
+ <div className="mt-1 text-[13px] font-medium text-foreground">{paired ? t('common.enabled') : t('common.disabled')}</div>
+ </div>
+ <div className="border-b border-border px-4 py-3 md:border-b-0 md:border-r">
+ <div className="text-[11px] text-muted">{t('remoteAccess.connector')}</div>
+ <div className="mt-1 text-[13px] font-medium text-foreground">{loading ? t('common.loading') : connectorState}</div>
+ </div>
+ <div className="px-4 py-3">
+ <div className="text-[11px] text-muted">{t('remoteAccess.vibeCloudService')}</div>
+ <a className="mt-1 inline-flex text-[13px] font-medium text-cyan" href={VIBE_CLOUD_URL} target="_blank" rel="noreferrer">
+ avibe.bot
+ <ExternalLink className="ml-1 size-3.5" />
+ </a>
+ </div>
+ </div>
+
+ {showPairingForm ? (
+ <div className="grid gap-3 px-4 py-3 md:grid-cols-[1fr_auto] md:items-end">
+ <label className="space-y-1.5">
+ <span className="text-[12px] font-medium text-foreground">{t('remoteAccess.pairingKey')}</span>
+ <input
+ className="h-8 w-full rounded-md border border-input bg-surface-3 px-3 font-mono text-[12px] text-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring/30"
+ value={pairingKey}
+ onChange={(event) => setPairingKey(event.target.value)}
+ placeholder="vrp_xxxxxxxxxxxxxxxxx"
+ />
+ <span className="block text-[10px] text-muted">{t('remoteAccess.pairingKeyHelp')}</span>
+ </label>
+ <div className="flex gap-2">
+ <button
+ type="button"
+ className="inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:opacity-50"
+ disabled={pairing || !pairingKey.trim()}
+ onClick={pair}
+ >
+ <Link2 className="size-3.5" />
+ {pairing ? t('remoteAccess.pairing') : t('remoteAccess.pair')}
+ </button>
+ {paired && (
+ <button
+ type="button"
+ className="h-8 rounded-md border border-border px-3 text-[12px] text-foreground"
+ onClick={() => {
+ setReconfiguring(false);
+ setPairingKey('');
+ }}
+ >
+ {t('common.cancel')}
+ </button>
+ )}
+ </div>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-3 px-4 py-3 md:flex-row md:items-center md:justify-between">
+ <div className="min-w-0">
+ <div className="flex items-center gap-2 text-[13px] font-medium text-mint">
+ <CheckCircle2 className="size-3.5" />
+ {t('remoteAccess.configuredBadge')}
+ </div>
+ {publicUrl && <div className="mt-1 truncate font-mono text-[11px] text-muted">{publicUrl}</div>}
+ </div>
+ <div className="flex gap-2">
+ <button
+ type="button"
+ className="h-8 rounded-md border border-border px-3 text-[12px] text-foreground"
+ onClick={() => setReconfiguring(true)}
+ >
+ {t('remoteAccess.repair')}
+ </button>
+ <button className="h-8 rounded-md border border-border px-3 text-[12px] text-foreground disabled:opacity-50" disabled={!paired || running} onClick={start} type="button">
+ {t('common.start')}
+ </button>
+ <button className="h-8 rounded-md border border-border px-3 text-[12px] text-foreground disabled:opacity-50" disabled={!paired || !running} onClick={stop} type="button">
+ {t('common.stop')}
+ </button>
+ </div>
+ </div>
+ )}
+
+ {actionMessage && (
+ <div className={`border-t border-border px-4 py-3 text-[12px] ${
+ actionMessage.type === 'error' ? 'text-gold' : 'text-mint'
+ }`}>
+ {actionMessage.text}
+ </div>
+ )}
+ </section>
+ );
+ }
+
return (
- <div className="max-w-5xl mx-auto space-y-6">
- <div className="rounded-3xl border border-slate-200 bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 text-white p-8 shadow-xl overflow-hidden relative">
- <div className="absolute -right-20 -top-24 h-64 w-64 rounded-full bg-cyan-400/20 blur-3xl" />
- <div className="relative space-y-3">
- <div className="inline-flex items-center gap-2 rounded-full border border-white/15 bg-white/10 px-3 py-1 text-sm text-cyan-100">
- <ShieldCheck className="w-4 h-4" />
- {t('remoteAccess.badge')}
+ <div className={embedded ? 'space-y-6' : 'max-w-5xl mx-auto space-y-6'}>
+ {!embedded && (
+ <div className="relative overflow-hidden rounded-3xl border border-slate-200 bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 p-8 text-white shadow-xl">
+ <div className="absolute -right-20 -top-24 h-64 w-64 rounded-full bg-cyan-400/20 blur-3xl" />
+ <div className="relative space-y-3">
+ <div className="inline-flex items-center gap-2 rounded-full border border-white/15 bg-white/10 px-3 py-1 text-sm text-cyan-100">
+ <ShieldCheck className="h-4 w-4" />
+ {t('remoteAccess.badge')}
+ </div>
+ <h1 className="font-display text-3xl font-bold tracking-tight md:text-4xl">{t('remoteAccess.title')}</h1>
+ <p className="max-w-2xl text-cyan-50/80">{t('remoteAccess.subtitle')}</p>
</div>
- <h1 className="text-3xl md:text-4xl font-display font-bold tracking-tight">{t('remoteAccess.title')}</h1>
- <p className="text-cyan-50/80 max-w-2xl">{t('remoteAccess.subtitle')}</p>
</div>
- </div>
+ )}
<div className="grid lg:grid-cols-[1.1fr_0.9fr] gap-6">
<section className="rounded-2xl border border-border bg-panel p-6 space-y-5">
diff --git a/ui/src/components/ThemeToggle.tsx b/ui/src/components/ThemeToggle.tsx
new file mode 100644
index 000000000..4d473d4bb
--- /dev/null
+++ b/ui/src/components/ThemeToggle.tsx
@@ -0,0 +1,30 @@
+import React from 'react';
+import { Monitor, Moon, Sun } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+
+import { useTheme } from '@/context/ThemeContext';
+
+export const ThemeToggle: React.FC = () => {
+ const { t } = useTranslation();
+ const { mode, cycleMode } = useTheme();
+
+ const Icon = mode === 'system' ? Monitor : mode === 'light' ? Sun : Moon;
+ const label =
+ mode === 'system'
+ ? t('common.themeSystem')
+ : mode === 'light'
+ ? t('common.themeLight')
+ : t('common.themeDark');
+
+ return (
+ <button
+ type="button"
+ onClick={cycleMode}
+ aria-label={`${label}. ${t('common.themeToggleHint')}`}
+ title={label}
+ className="inline-flex h-8 w-8 items-center justify-center rounded-md border border-border-strong bg-surface-2/40 text-muted transition hover:bg-surface-2 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring"
+ >
+ <Icon className="size-3.5" aria-hidden />
+ </button>
+ );
+};
diff --git a/ui/src/components/VersionBadge.tsx b/ui/src/components/VersionBadge.tsx
index b1f8a901e..d1fc5bf7f 100644
--- a/ui/src/components/VersionBadge.tsx
+++ b/ui/src/components/VersionBadge.tsx
@@ -4,7 +4,7 @@ import { useApi, type VersionInfo, type UpgradeResult } from '../context/ApiCont
import { Download, X, RefreshCw, Check, AlertCircle } from 'lucide-react';
import clsx from 'clsx';
-export const VersionBadge: React.FC = () => {
+export const VersionBadge: React.FC<{ openUpward?: boolean }> = ({ openUpward = false }) => {
const { t } = useTranslation();
const api = useApi();
const [versionInfo, setVersionInfo] = React.useState<VersionInfo | null>(null);
@@ -17,13 +17,11 @@ export const VersionBadge: React.FC = () => {
const [savingAutoUpdate, setSavingAutoUpdate] = React.useState(false);
const popupRef = React.useRef<HTMLDivElement>(null);
- // Check version and load config on mount
React.useEffect(() => {
checkVersion();
loadAutoUpdateSetting();
}, []);
- // Close popup when clicking outside
React.useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (popupRef.current && !popupRef.current.contains(event.target as Node)) {
@@ -77,13 +75,11 @@ export const VersionBadge: React.FC = () => {
setUpgradeResult(result);
if (result.ok) {
if (result.restarting) {
- // Show restarting state and reload page after delay
setRestarting(true);
setTimeout(() => {
window.location.reload();
}, 4000);
} else {
- // Refresh version info after upgrade
setTimeout(() => checkVersion(), 1000);
}
}
@@ -99,34 +95,44 @@ export const VersionBadge: React.FC = () => {
return (
<div className="relative" ref={popupRef}>
- {/* Version Badge */}
+ {/* Version Badge trigger */}
<button
onClick={() => setIsPopupOpen(!isPopupOpen)}
className={clsx(
- 'relative px-2 py-0.5 text-xs font-medium rounded-md transition-colors cursor-pointer',
+ 'relative cursor-pointer rounded-md border px-2 py-0.5 text-xs font-medium transition-colors',
hasUpdate
- ? 'bg-amber-100 text-amber-800 hover:bg-amber-200'
- : 'bg-neutral-100 text-neutral-600 hover:bg-neutral-200'
+ ? 'border-gold/30 bg-gold/15 text-gold hover:bg-gold/20'
+ : 'border-border bg-surface-2/60 text-muted hover:bg-surface-2'
)}
>
v{currentVersion}
- {/* Update indicator dot */}
{hasUpdate && (
- <span className="absolute -top-1 -right-1 w-2.5 h-2.5 bg-amber-500 rounded-full border-2 border-white animate-pulse" />
+ <span className="absolute -top-1 -right-1 size-2.5 rounded-full border-2 border-background bg-gold animate-pulse" />
)}
</button>
{/* Popup */}
{isPopupOpen && (
- <div className="absolute top-full left-0 mt-2 w-72 bg-white rounded-lg shadow-lg border border-border z-50">
+ <div
+ className={clsx(
+ 'z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-xl',
+ // Mobile: full-width fixed below sticky header, with scroll
+ 'fixed inset-x-3 top-[4.5rem] max-h-[calc(100dvh-5.5rem)] overflow-auto',
+ // Desktop: anchor to trigger, fixed width
+ 'md:absolute md:inset-x-auto md:max-h-none md:w-72 md:overflow-visible',
+ openUpward
+ ? 'md:bottom-full md:left-0 md:top-auto md:mb-2'
+ : 'md:left-0 md:top-full md:mt-2'
+ )}
+ >
{/* Header */}
- <div className="flex items-center justify-between px-4 py-3 border-b border-border">
- <span className="font-medium text-sm">{t('dashboard.versionAndUpdate')}</span>
- <div className="flex items-center gap-2">
+ <div className="flex items-center justify-between border-b border-border px-4 py-3">
+ <span className="text-sm font-medium text-foreground">{t('dashboard.versionAndUpdate')}</span>
+ <div className="flex items-center gap-1">
<button
onClick={checkVersion}
disabled={checking || restarting}
- className="text-muted hover:text-text p-1 rounded disabled:opacity-50"
+ className="rounded p-1.5 text-muted hover:bg-surface-2 hover:text-foreground disabled:opacity-50"
aria-label={checking ? t('dashboard.checking') : t('dashboard.checkUpdate')}
title={checking ? t('dashboard.checking') : t('dashboard.checkUpdate')}
>
@@ -134,7 +140,7 @@ export const VersionBadge: React.FC = () => {
</button>
<button
onClick={() => setIsPopupOpen(false)}
- className="text-muted hover:text-text p-1 rounded"
+ className="rounded p-1.5 text-muted hover:bg-surface-2 hover:text-foreground"
>
<X size={14} />
</button>
@@ -142,40 +148,40 @@ export const VersionBadge: React.FC = () => {
</div>
{/* Content */}
- <div className="p-4 space-y-3">
+ <div className="space-y-3 p-4">
{/* Current Version */}
<div className="flex items-center justify-between text-sm">
<span className="text-muted">{t('dashboard.currentVersion')}</span>
- <span className="font-mono font-medium">{currentVersion}</span>
+ <span className="font-mono font-medium text-foreground">{currentVersion}</span>
</div>
{/* Latest Version */}
{versionInfo?.latest && (
<div className="flex items-center justify-between text-sm">
<span className="text-muted">{t('dashboard.latestVersion')}</span>
- <span className="font-mono font-medium">{versionInfo.latest}</span>
+ <span className="font-mono font-medium text-foreground">{versionInfo.latest}</span>
</div>
)}
{/* Update Status */}
{hasUpdate ? (
- <div className="flex items-center gap-2 px-3 py-2 bg-amber-50 text-amber-800 rounded-md text-sm">
- <AlertCircle size={16} />
+ <div className="flex items-center gap-2 rounded-md border border-gold/30 bg-gold/10 px-3 py-2 text-sm text-gold">
+ <AlertCircle size={16} className="shrink-0" />
<span>
{t('dashboard.updateHint', {
from: currentVersion,
- to: versionInfo?.latest
+ to: versionInfo?.latest,
})}
</span>
</div>
) : versionInfo && !versionInfo.error ? (
- <div className="flex items-center gap-2 px-3 py-2 bg-green-50 text-green-700 rounded-md text-sm">
- <Check size={16} />
+ <div className="flex items-center gap-2 rounded-md border border-mint/25 bg-mint/10 px-3 py-2 text-sm text-mint">
+ <Check size={16} className="shrink-0" />
<span>{t('dashboard.upToDate')}</span>
</div>
) : versionInfo?.error ? (
- <div className="flex items-center gap-2 px-3 py-2 bg-red-50 text-red-700 rounded-md text-sm">
- <AlertCircle size={16} />
+ <div className="flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">
+ <AlertCircle size={16} className="shrink-0" />
<span>{t('dashboard.checkFailed')}</span>
</div>
) : null}
@@ -184,63 +190,61 @@ export const VersionBadge: React.FC = () => {
{upgradeResult && (
<div
className={clsx(
- 'flex items-center gap-2 px-3 py-2 rounded-md text-sm',
+ 'flex items-center gap-2 rounded-md border px-3 py-2 text-sm',
upgradeResult.ok
- ? 'bg-green-50 text-green-700'
- : 'bg-red-50 text-red-700'
+ ? 'border-mint/25 bg-mint/10 text-mint'
+ : 'border-destructive/30 bg-destructive/10 text-destructive'
)}
>
- {upgradeResult.ok ? <Check size={16} /> : <AlertCircle size={16} />}
+ {upgradeResult.ok ? <Check size={16} className="shrink-0" /> : <AlertCircle size={16} className="shrink-0" />}
<span>
- {upgradeResult.ok
- ? t('dashboard.upgradeSuccess')
- : t('dashboard.upgradeFailed')}
+ {upgradeResult.ok ? t('dashboard.upgradeSuccess') : t('dashboard.upgradeFailed')}
</span>
</div>
)}
{/* Restarting Status */}
{restarting && (
- <div className="flex items-center gap-2 px-3 py-2 bg-blue-50 text-blue-700 rounded-md text-sm">
- <RefreshCw size={16} className="animate-spin" />
+ <div className="flex items-center gap-2 rounded-md border border-cyan/30 bg-cyan/10 px-3 py-2 text-sm text-cyan">
+ <RefreshCw size={16} className="shrink-0 animate-spin" />
<span>{t('dashboard.restarting')}</span>
</div>
)}
{/* Auto Update Toggle */}
{autoUpdate !== null && (
- <div className="flex items-center justify-between pt-2 border-t border-border">
- <div>
- <span className="text-sm text-text">{t('dashboard.autoUpdate')}</span>
- <p className="text-xs text-muted">{t('dashboard.autoUpdateHint')}</p>
+ <div className="flex items-center justify-between gap-3 border-t border-border pt-3">
+ <div className="min-w-0">
+ <div className="text-sm text-foreground">{t('dashboard.autoUpdate')}</div>
+ <div className="text-xs text-muted">{t('dashboard.autoUpdateHint')}</div>
</div>
- <label className="relative inline-flex items-center cursor-pointer">
+ <label className="relative inline-flex cursor-pointer items-center">
<input
type="checkbox"
checked={autoUpdate}
onChange={(e) => handleAutoUpdateToggle(e.target.checked)}
disabled={savingAutoUpdate}
- className="sr-only peer"
+ className="peer sr-only"
/>
- <div className="w-9 h-5 bg-neutral-200 rounded-full peer peer-checked:bg-green-500 peer-focus:ring-2 peer-focus:ring-green-200 after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:after:translate-x-4"></div>
+ <div className="peer h-5 w-9 rounded-full bg-surface-3 transition-colors after:absolute after:left-[2px] after:top-0.5 after:size-4 after:rounded-full after:bg-foreground after:transition-all after:content-[''] peer-checked:bg-mint peer-checked:after:translate-x-4 peer-checked:after:bg-primary-foreground peer-focus:ring-2 peer-focus:ring-ring" />
</label>
</div>
)}
</div>
{/* Actions */}
- <div className="px-4 py-3 border-t border-border flex justify-end">
- {hasUpdate && !restarting && (
+ {hasUpdate && !restarting && (
+ <div className="flex justify-end border-t border-border px-4 py-3">
<button
onClick={handleUpgrade}
disabled={upgrading}
- className="flex items-center justify-center gap-1.5 px-3 py-2 text-sm bg-accent text-white hover:bg-accent/90 rounded-md transition-colors disabled:opacity-50 whitespace-nowrap"
+ className="inline-flex items-center gap-1.5 rounded-md bg-mint px-3 py-2 text-sm font-semibold text-primary-foreground transition-colors hover:bg-mint/90 disabled:opacity-50"
>
<Download size={14} className={upgrading ? 'animate-bounce' : ''} />
{upgrading ? t('dashboard.upgrading') : t('dashboard.upgradeNow')}
</button>
- )}
- </div>
+ </div>
+ )}
</div>
)}
</div>
diff --git a/ui/src/components/Wizard.tsx b/ui/src/components/Wizard.tsx
index d1f0432b6..8e0573322 100644
--- a/ui/src/components/Wizard.tsx
+++ b/ui/src/components/Wizard.tsx
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import { useTranslation } from 'react-i18next';
import { Welcome } from './steps/Welcome';
-// import { ModeSelection } from './steps/ModeSelection'; // temporarily hidden — SaaS mode not yet available
import { PlatformSelection } from './steps/PlatformSelection';
import { AgentDetection } from './steps/AgentDetection';
import { SlackConfig } from './steps/SlackConfig';
@@ -13,9 +12,9 @@ import { WeChatConfig } from './steps/WeChatConfig';
import { ChannelList } from './steps/ChannelList';
import { Summary } from './steps/Summary';
import { useApi } from '../context/ApiContext';
-import { LanguageSwitcher } from './LanguageSwitcher';
import clsx from 'clsx';
import { getEnabledPlatforms, getPrimaryPlatform, platformSupportsChannels } from '../lib/platforms';
+import { WizardChrome } from './visual';
const buildConfigPayload = (data: any) => {
const enabledPlatforms = getEnabledPlatforms(data);
@@ -266,49 +265,46 @@ export const Wizard: React.FC = () => {
};
const CurrentComponent = steps[currentStep].component;
+ const stepId = steps[currentStep].id;
+ const wizardGlowClass =
+ stepId === 'welcome' ? 'page-glow-wizard-welcome'
+ : stepId === 'agents' ? 'page-glow-wizard-backends'
+ : stepId === 'platform' ? 'page-glow-wizard-platforms'
+ : stepId === 'platform-slack' ? 'page-glow-wizard-slack'
+ : stepId === 'summary' ? 'page-glow-wizard-summary'
+ : 'page-glow-wizard-platforms';
- if (!loaded) return <div className="min-h-screen flex items-center justify-center bg-bg text-muted">{t('common.loading')}</div>;
+ if (!loaded) return <div className="min-h-screen flex items-center justify-center bg-background text-muted">{t('common.loading')}</div>;
+
+ // Welcome step omits the segmented progress and the skip button (matches design.pen Kebr6).
+ // Summary step keeps the rail but disables skip (already at the end).
+ const isWelcome = stepId === 'welcome';
+ const isSummary = stepId === 'summary';
+ // Include welcome in the count so the counter ("Step X / N") matches the
+ // step eyebrows (03 — PLATFORMS, etc.). The progress bar itself still
+ // skips welcome via showProgress to keep the welcome screen clean.
+ const progressTotal = steps.length;
+ const progressIndex = steps.findIndex((step) => step.id === stepId);
return (
- <div className="min-h-screen bg-bg flex flex-col items-center justify-center p-4 md:p-8">
- <div className="w-full max-w-4xl bg-panel rounded-2xl border border-border shadow-xl overflow-hidden flex flex-col min-h-[600px] max-h-[90vh]">
- {/* Header */}
- <div className="bg-panel border-b border-border p-6 flex justify-between items-center relative z-10">
- <div>
- <h1 className="text-xl font-bold text-text font-display">{t('wizard.title')}</h1>
- </div>
- <div className="flex items-center gap-4">
- <LanguageSwitcher />
- <div className="flex gap-2">
- {steps.map((s, i) => {
- if (s.id === 'welcome') return null; // Skip welcome dot
- const isCompleted = i < currentStep;
- const isCurrent = i === currentStep;
- return (
- <div key={s.id} className="flex flex-col items-center gap-1">
- <div
- className={clsx(
- "w-8 h-1 rounded-full transition-all duration-300",
- isCompleted ? 'bg-success' : isCurrent ? 'bg-accent' : 'bg-neutral-200'
- )}
- />
- </div>
- );
- })}
- </div>
- </div>
- </div>
+ <div className={clsx('min-h-screen px-4 py-6 text-foreground md:px-10 md:py-10', wizardGlowClass)}>
+ <div className="mx-auto flex min-h-[calc(100vh-4rem)] max-w-[1280px] flex-col gap-8">
+ <WizardChrome
+ current={Math.max(0, progressIndex)}
+ total={Math.max(progressTotal, 1)}
+ showProgress={!isWelcome}
+ onSkip={!isWelcome && !isSummary ? () => setCurrentStep(steps.length - 1) : undefined}
+ />
- {/* Content */}
- <div className="flex-1 p-8 relative overflow-y-auto">
+ <div className="flex flex-1 flex-col items-center justify-start">
<AnimatePresence mode="wait">
<motion.div
key={currentStep}
- initial={{ opacity: 0, x: 20 }}
- animate={{ opacity: 1, x: 0 }}
- exit={{ opacity: 0, x: -20 }}
- transition={{ duration: 0.2 }}
- className="h-full"
+ initial={{ opacity: 0, y: 12 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -8 }}
+ transition={{ duration: 0.18 }}
+ className="w-full"
>
<CurrentComponent
data={data}
diff --git a/ui/src/components/settings/SettingsBackendsPage.tsx b/ui/src/components/settings/SettingsBackendsPage.tsx
new file mode 100644
index 000000000..20fa076ca
--- /dev/null
+++ b/ui/src/components/settings/SettingsBackendsPage.tsx
@@ -0,0 +1,38 @@
+import React, { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { AgentDetection } from '@/components/steps/AgentDetection';
+import { useApi } from '@/context/ApiContext';
+import { useToast } from '@/context/ToastContext';
+import { SettingsPageShell } from './SettingsPageShell';
+
+export const SettingsBackendsPage: React.FC = () => {
+ const { t } = useTranslation();
+ const api = useApi();
+ const { showToast } = useToast();
+ const [config, setConfig] = useState<any>(null);
+
+ useEffect(() => {
+ api.getConfig().then(setConfig).catch(() => {});
+ }, [api]);
+
+ const handleSave = async (nextData: { agents: any; default_backend: string }) => {
+ await api.saveConfig({ agents: { ...nextData.agents, default_backend: nextData.default_backend } });
+ setConfig((prev: any) => ({ ...(prev || {}), agents: { ...nextData.agents, default_backend: nextData.default_backend } }));
+ showToast(t('common.saved'), 'success');
+ };
+
+ return (
+ <SettingsPageShell
+ activeTab="backends"
+ title={t('settings.backendsTitle')}
+ subtitle={t('settings.backendsSubtitle')}
+ >
+ {config ? (
+ <AgentDetection data={config} onNext={() => {}} isPage onSave={handleSave} />
+ ) : (
+ <div className="text-sm text-muted">{t('common.loading')}</div>
+ )}
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsDiagnosticsPage.tsx b/ui/src/components/settings/SettingsDiagnosticsPage.tsx
new file mode 100644
index 000000000..44d4f1087
--- /dev/null
+++ b/ui/src/components/settings/SettingsDiagnosticsPage.tsx
@@ -0,0 +1,19 @@
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { DoctorPanel } from '@/components/steps/DoctorPanel';
+import { SettingsPageShell } from './SettingsPageShell';
+
+export const SettingsDiagnosticsPage: React.FC = () => {
+ const { t } = useTranslation();
+
+ return (
+ <SettingsPageShell
+ activeTab="diagnostics"
+ title={t('settings.diagnosticsTitle')}
+ subtitle={t('settings.diagnosticsSubtitle')}
+ >
+ <DoctorPanel isPage logsPath="/logs" titleKey="settings.diagnosticsDoctorTitle" />
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsLogsPage.tsx b/ui/src/components/settings/SettingsLogsPage.tsx
new file mode 100644
index 000000000..da17b0938
--- /dev/null
+++ b/ui/src/components/settings/SettingsLogsPage.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { LogsPanel } from '@/components/steps/LogsPanel';
+import { SettingsPageShell } from './SettingsPageShell';
+
+export const SettingsLogsPage: React.FC<{ standalone?: boolean }> = ({ standalone = false }) => {
+ const { t } = useTranslation();
+
+ if (standalone) {
+ return (
+ <div className="flex h-full flex-col gap-6">
+ <div className="flex flex-col gap-1.5">
+ <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('settings.logsTitle')}
+ </h1>
+ <p className="text-[14px] leading-[1.55] text-muted">{t('settings.logsSubtitle')}</p>
+ </div>
+ <LogsPanel titleKey="settings.logsTitle" compactHeader />
+ </div>
+ );
+ }
+
+ return (
+ <SettingsPageShell
+ activeTab="diagnostics"
+ title={t('settings.logsTitle')}
+ subtitle={t('settings.logsSubtitle')}
+ breadcrumb={
+ <div className="flex items-center gap-2 font-medium">
+ <span>{t('settings.tabs.serviceRoot')}</span>
+ <span>›</span>
+ <span>{t('settings.tabs.diagnostics')}</span>
+ <span>›</span>
+ <span className="text-mint">{t('settings.logsTitle')}</span>
+ </div>
+ }
+ >
+ <LogsPanel titleKey="settings.logsTitle" />
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsMessagingPage.tsx b/ui/src/components/settings/SettingsMessagingPage.tsx
new file mode 100644
index 000000000..69fd5830c
--- /dev/null
+++ b/ui/src/components/settings/SettingsMessagingPage.tsx
@@ -0,0 +1,261 @@
+import React, { useEffect, useMemo, useState } from 'react';
+import { ArrowRight, MessageSquare } from 'lucide-react';
+import { Link } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
+import clsx from 'clsx';
+
+import { useApi } from '@/context/ApiContext';
+import { SettingsPageShell } from './SettingsPageShell';
+import {
+ platformHasCapability,
+ getEnabledPlatforms,
+ getPrimaryPlatform,
+} from '@/lib/platforms';
+import {
+ CompactField,
+ CompactSelect,
+ SettingsPanel,
+ SettingsRow,
+ ToggleSwitch,
+} from './SettingsPrimitives';
+
+const SAVE_KEYS = [
+ 'platforms',
+ 'ack_mode',
+ 'show_duration',
+ 'include_user_info',
+ 'reply_enhancements',
+ 'slack',
+ 'discord',
+ 'telegram',
+ 'lark',
+ 'wechat',
+ 'agents',
+] as const;
+
+function buildMessagePatch(config: any) {
+ const patch: Record<string, unknown> = {
+ platform: getPrimaryPlatform(config),
+ };
+
+ for (const key of SAVE_KEYS) {
+ patch[key] = config?.[key];
+ }
+
+ return patch;
+}
+
+function formatSavedAt(value: number | null, t: (key: string) => string) {
+ if (!value) return t('settings.messagingStatusIdle');
+ const deltaSec = Math.max(0, Math.round((Date.now() - value) / 1000));
+ return deltaSec <= 1
+ ? t('settings.messagingStatusJustNow')
+ : t('settings.messagingStatusAgo').replace('{{seconds}}', String(deltaSec));
+}
+
+// Mirrors design.pen TDgw0 (VR/CM/Messaging):
+// msgIntro 15px semibold + 12px muted, msgSec1 cornerRadius 12 fill --background
+// stroke --border, value rows padding [14, 20] separated by bottom border.
+export const SettingsMessagingPage: React.FC = () => {
+ const { t } = useTranslation();
+ const api = useApi();
+ const [config, setConfig] = useState<any>(null);
+ const [saveError, setSaveError] = useState<string | null>(null);
+ const [savedAt, setSavedAt] = useState<number | null>(null);
+
+ useEffect(() => {
+ api.getConfig().then(setConfig).catch(() => {});
+ }, [api]);
+
+ const enabledPlatforms = useMemo(() => getEnabledPlatforms(config), [config]);
+ const slackSupportsLinkUnfurl = enabledPlatforms.includes('slack');
+ const reactionSupported = enabledPlatforms.some((platform) =>
+ platformHasCapability(config, platform, 'supports_reaction_indicator')
+ );
+ const typingSupported = enabledPlatforms.some((platform) =>
+ platformHasCapability(config, platform, 'supports_typing_indicator')
+ );
+
+ const persist = async (nextConfig: any) => {
+ setConfig(nextConfig);
+ setSaveError(null);
+ try {
+ await api.saveConfig(buildMessagePatch(nextConfig));
+ setSavedAt(Date.now());
+ } catch (error) {
+ setSaveError(error instanceof Error ? error.message : t('common.saveFailed'));
+ }
+ };
+
+ if (!config) {
+ return (
+ <SettingsPageShell
+ activeTab="messaging"
+ title={t('settings.messagingTitle')}
+ subtitle={t('settings.messagingSubtitle')}
+ >
+ <div className="text-[13px] text-muted">{t('common.loading')}</div>
+ </SettingsPageShell>
+ );
+ }
+
+ const ackOptions = [
+ { value: 'typing', label: t('dashboard.ackTyping'), disabled: !typingSupported },
+ { value: 'reaction', label: t('dashboard.ackReaction'), disabled: !reactionSupported },
+ { value: 'message', label: t('dashboard.ackMessage'), disabled: false },
+ ];
+
+ return (
+ <SettingsPageShell
+ activeTab="messaging"
+ title={t('settings.messagingTitle')}
+ subtitle={t('settings.messagingSubtitle')}
+ actions={
+ <div className="flex items-center gap-2">
+ <span
+ className={clsx(
+ 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em]',
+ saveError
+ ? 'border-danger/30 bg-danger/10 text-danger'
+ : 'border-mint/30 bg-mint/[0.08] text-mint'
+ )}
+ >
+ {saveError ? t('common.saveFailed') : t('settings.messagingAutosaved')}
+ </span>
+ <span className="font-mono text-[10px] text-muted">
+ {saveError || formatSavedAt(savedAt, t)}
+ </span>
+ </div>
+ }
+ >
+ <SettingsPanel
+ title={
+ <span className="inline-flex items-center gap-2">
+ <MessageSquare className="size-3.5 text-cyan" />
+ {t('dashboard.messageHandling')}
+ </span>
+ }
+ description={t('settings.messagingCardDescription')}
+ >
+ <SettingsRow
+ title={t('dashboard.ackMode')}
+ description={t('dashboard.ackModeHint')}
+ control={
+ <CompactSelect
+ value={config.ack_mode || 'typing'}
+ onChange={(event) =>
+ void persist({ ...config, ack_mode: event.target.value || 'typing' })
+ }
+ className="w-40"
+ >
+ {ackOptions.map((option) => (
+ <option key={option.value} value={option.value} disabled={option.disabled}>
+ {option.label}
+ </option>
+ ))}
+ </CompactSelect>
+ }
+ />
+
+ <SettingsRow
+ title={t('dashboard.errorRetryLimit')}
+ description={t('dashboard.errorRetryLimitHint')}
+ control={
+ <CompactField
+ type="number"
+ min={0}
+ max={10}
+ value={config.agents?.opencode?.error_retry_limit ?? 1}
+ onChange={(event) => {
+ const limit = Math.max(0, Math.min(10, Number(event.target.value) || 0));
+ void persist({
+ ...config,
+ agents: {
+ ...(config.agents || {}),
+ opencode: {
+ ...(config.agents?.opencode || {}),
+ error_retry_limit: limit,
+ },
+ },
+ });
+ }}
+ className="w-24 text-center font-mono"
+ />
+ }
+ />
+
+ <SettingsRow
+ title={t('dashboard.showDuration')}
+ description={t('dashboard.showDurationHint')}
+ control={
+ <ToggleSwitch
+ enabled={config.show_duration !== false}
+ onClick={() => void persist({ ...config, show_duration: !config.show_duration })}
+ />
+ }
+ />
+
+ <SettingsRow
+ title={t('dashboard.includeUserInfo')}
+ description={t('dashboard.includeUserInfoHint')}
+ control={
+ <ToggleSwitch
+ enabled={Boolean(config.include_user_info)}
+ onClick={() =>
+ void persist({ ...config, include_user_info: !config.include_user_info })
+ }
+ />
+ }
+ />
+
+ <SettingsRow
+ title={t('dashboard.replyEnhancements')}
+ description={t('dashboard.replyEnhancementsHint')}
+ control={
+ <ToggleSwitch
+ enabled={config.reply_enhancements !== false}
+ onClick={() =>
+ void persist({ ...config, reply_enhancements: !config.reply_enhancements })
+ }
+ />
+ }
+ />
+
+ {slackSupportsLinkUnfurl && (
+ <SettingsRow
+ title={t('dashboard.slackLinkPreviews')}
+ description={t('dashboard.slackLinkPreviewsHint')}
+ control={
+ <ToggleSwitch
+ enabled={Boolean(config.slack?.disable_link_unfurl)}
+ onClick={() =>
+ void persist({
+ ...config,
+ slack: {
+ ...(config.slack || {}),
+ disable_link_unfurl: !config.slack?.disable_link_unfurl,
+ },
+ })
+ }
+ />
+ }
+ />
+ )}
+
+ <SettingsRow
+ title={t('dashboard.allowedChannels')}
+ description={t('settings.messagingGroupsHint')}
+ control={
+ <Link
+ to="/groups"
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ {t('common.manageChannels')}
+ <ArrowRight className="size-3.5" strokeWidth={2.25} />
+ </Link>
+ }
+ />
+ </SettingsPanel>
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsPageShell.tsx b/ui/src/components/settings/SettingsPageShell.tsx
new file mode 100644
index 000000000..4b70bc7f2
--- /dev/null
+++ b/ui/src/components/settings/SettingsPageShell.tsx
@@ -0,0 +1,87 @@
+import React from 'react';
+import { Link } from 'react-router-dom';
+import clsx from 'clsx';
+import { useTranslation } from 'react-i18next';
+import {
+ AlertCircle,
+ Bot,
+ MessageSquare,
+ Settings as SettingsIcon,
+ Stethoscope,
+} from 'lucide-react';
+
+type SettingsTab = 'service' | 'platforms' | 'backends' | 'messaging' | 'diagnostics';
+
+const TABS: Array<{
+ key: SettingsTab;
+ href: string;
+ label: string;
+ icon: React.ComponentType<{ className?: string }>;
+}> = [
+ { key: 'service', href: '/settings/service', label: 'settings.tabs.service', icon: SettingsIcon },
+ { key: 'platforms', href: '/settings/platforms', label: 'settings.tabs.platforms', icon: AlertCircle },
+ { key: 'backends', href: '/settings/backends', label: 'settings.tabs.backends', icon: Bot },
+ { key: 'messaging', href: '/settings/messaging', label: 'settings.tabs.messaging', icon: MessageSquare },
+ { key: 'diagnostics', href: '/settings/diagnostics', label: 'settings.tabs.diagnostics', icon: Stethoscope },
+];
+
+export type SettingsPageShellProps = {
+ title: string;
+ subtitle: string;
+ activeTab: SettingsTab;
+ breadcrumb?: React.ReactNode;
+ actions?: React.ReactNode;
+ children: React.ReactNode;
+};
+
+// Mirrors design.pen niFAd (platSubTabs) but applied at the settings root:
+// rounded-full pills, mint-soft active state with #5BFFA055 stroke,
+// 13px lucide icon + 12px label, padding [8, 14].
+export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({
+ title,
+ subtitle,
+ activeTab,
+ breadcrumb,
+ actions,
+ children,
+}) => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex flex-col gap-6">
+ {breadcrumb && <div className="font-mono text-[11px] text-muted">{breadcrumb}</div>}
+
+ <div className="flex flex-wrap items-end justify-between gap-4">
+ <div className="flex flex-col gap-1.5">
+ <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">{title}</h1>
+ <p className="max-w-3xl text-[14px] leading-[1.55] text-muted">{subtitle}</p>
+ </div>
+ {actions && <div className="shrink-0">{actions}</div>}
+ </div>
+
+ <nav className="flex flex-wrap gap-1.5" aria-label="Settings sections">
+ {TABS.map((tab) => {
+ const Icon = tab.icon;
+ const active = tab.key === activeTab;
+ return (
+ <Link
+ key={tab.key}
+ to={tab.href}
+ className={clsx(
+ 'inline-flex items-center gap-2 rounded-full border px-3.5 py-2 text-[12px] font-semibold transition-colors',
+ active
+ ? 'border-mint/35 bg-mint/[0.08] text-foreground shadow-[0_0_18px_-6px_rgba(91,255,160,0.5)]'
+ : 'border-border bg-white/[0.04] text-muted hover:border-border-strong hover:text-foreground'
+ )}
+ >
+ <Icon className={clsx('size-3.5', active ? 'text-mint' : 'text-muted')} />
+ {t(tab.label)}
+ </Link>
+ );
+ })}
+ </nav>
+
+ <div className="flex flex-col gap-4">{children}</div>
+ </div>
+ );
+};
diff --git a/ui/src/components/settings/SettingsPlaceholderPage.tsx b/ui/src/components/settings/SettingsPlaceholderPage.tsx
new file mode 100644
index 000000000..d76836d17
--- /dev/null
+++ b/ui/src/components/settings/SettingsPlaceholderPage.tsx
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Link } from 'react-router-dom';
+import { ArrowRight, Sparkles } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+
+import { SettingsPageShell } from './SettingsPageShell';
+
+export const SettingsPlaceholderPage: React.FC<{
+ tab: 'platforms' | 'backends' | 'messaging';
+ titleKey: string;
+ subtitleKey: string;
+}> = ({ tab, titleKey, subtitleKey }) => {
+ const { t } = useTranslation();
+
+ return (
+ <SettingsPageShell activeTab={tab} title={t(titleKey)} subtitle={t(subtitleKey)}>
+ <div className="flex flex-col gap-3 rounded-xl border border-border bg-background px-6 py-5">
+ <div className="flex items-center gap-2 text-[14px] font-semibold text-foreground">
+ <Sparkles className="size-4 text-cyan" />
+ {t('settings.inProgressTitle')}
+ </div>
+ <p className="text-[12px] leading-relaxed text-muted">{t('settings.inProgressBody')}</p>
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <span className="text-[12px] text-muted">{t('settings.inProgressHint')}</span>
+ <Link
+ to="/setup"
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 py-2 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ {t('settings.openSetup')}
+ <ArrowRight className="size-3.5" strokeWidth={2.25} />
+ </Link>
+ </div>
+ </div>
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsPlatformsPage.tsx b/ui/src/components/settings/SettingsPlatformsPage.tsx
new file mode 100644
index 000000000..4b93fcc34
--- /dev/null
+++ b/ui/src/components/settings/SettingsPlatformsPage.tsx
@@ -0,0 +1,38 @@
+import React, { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { PlatformSelection } from '@/components/steps/PlatformSelection';
+import { useApi } from '@/context/ApiContext';
+import { useToast } from '@/context/ToastContext';
+import { SettingsPageShell } from './SettingsPageShell';
+
+export const SettingsPlatformsPage: React.FC = () => {
+ const { t } = useTranslation();
+ const api = useApi();
+ const { showToast } = useToast();
+ const [config, setConfig] = useState<any>(null);
+
+ useEffect(() => {
+ api.getConfig().then(setConfig).catch(() => {});
+ }, [api]);
+
+ const handleSave = async (nextData: any) => {
+ await api.saveConfig(nextData);
+ setConfig((prev: any) => ({ ...(prev || {}), ...nextData }));
+ showToast(t('common.saved'), 'success');
+ };
+
+ return (
+ <SettingsPageShell
+ activeTab="platforms"
+ title={t('settings.platformsTitle')}
+ subtitle={t('settings.platformsSubtitle')}
+ >
+ {config ? (
+ <PlatformSelection data={config} onNext={() => {}} isPage onSave={handleSave} />
+ ) : (
+ <div className="text-sm text-muted">{t('common.loading')}</div>
+ )}
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/settings/SettingsPrimitives.tsx b/ui/src/components/settings/SettingsPrimitives.tsx
new file mode 100644
index 000000000..3ecf708ca
--- /dev/null
+++ b/ui/src/components/settings/SettingsPrimitives.tsx
@@ -0,0 +1,130 @@
+import React from 'react';
+import clsx from 'clsx';
+
+type SettingsPanelProps = {
+ title?: React.ReactNode;
+ description?: React.ReactNode;
+ actions?: React.ReactNode;
+ children: React.ReactNode;
+ className?: string;
+};
+
+// Mirrors design.pen O8BNR/B6qFRA (svcSec1 / msgSec1):
+// cornerRadius 12, fill --background, stroke --border 1px,
+// header padding [16, 20] with bottom border, rows padding [12, 20].
+export const SettingsPanel: React.FC<SettingsPanelProps> = ({
+ title,
+ description,
+ actions,
+ children,
+ className,
+}) => (
+ <section
+ className={clsx(
+ 'flex flex-col overflow-hidden rounded-xl border border-border bg-background',
+ className
+ )}
+ >
+ {(title || description || actions) && (
+ <div className="flex items-start justify-between gap-4 border-b border-border px-5 py-4">
+ <div className="flex min-w-0 flex-col gap-1">
+ {title && <h2 className="text-[14px] font-semibold text-foreground">{title}</h2>}
+ {description && (
+ <p className="max-w-2xl text-[12px] leading-relaxed text-muted">{description}</p>
+ )}
+ </div>
+ {actions && <div className="shrink-0">{actions}</div>}
+ </div>
+ )}
+ {children}
+ </section>
+);
+
+type SettingsRowProps = {
+ title: React.ReactNode;
+ description?: React.ReactNode;
+ meta?: React.ReactNode;
+ control?: React.ReactNode;
+ tone?: 'default' | 'success' | 'warning' | 'info';
+};
+
+export const SettingsRow: React.FC<SettingsRowProps> = ({
+ title,
+ description,
+ meta,
+ control,
+ tone = 'default',
+}) => (
+ <div
+ className={clsx(
+ 'flex flex-col gap-3 border-b border-border px-5 py-3 last:border-b-0 md:flex-row md:items-center md:justify-between',
+ tone === 'success' && 'bg-mint/[0.05]',
+ tone === 'warning' && 'bg-gold/[0.06]',
+ tone === 'info' && 'bg-cyan/[0.06]'
+ )}
+ >
+ <div className="flex min-w-0 flex-col gap-0.5">
+ <div className="text-[13px] font-medium text-foreground">{title}</div>
+ {description && (
+ <div className="max-w-2xl text-[11px] leading-relaxed text-muted">{description}</div>
+ )}
+ {meta && <div className="font-mono text-[10px] text-muted">{meta}</div>}
+ </div>
+ {control && <div className="shrink-0">{control}</div>}
+ </div>
+);
+
+export const CompactField: React.FC<React.InputHTMLAttributes<HTMLInputElement>> = ({
+ className,
+ ...props
+}) => (
+ <input
+ className={clsx(
+ 'h-9 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40',
+ className
+ )}
+ {...props}
+ />
+);
+
+export const CompactSelect: React.FC<React.SelectHTMLAttributes<HTMLSelectElement>> = ({
+ className,
+ ...props
+}) => (
+ <select
+ className={clsx(
+ 'h-9 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40',
+ className
+ )}
+ {...props}
+ />
+);
+
+// Mirrors design.pen FALFE / ylboi (mint switch on): cornerRadius 9999,
+// fill --mint, blur 8 #5BFFA055 glow, 38×22 with knob inset 3.
+export const ToggleSwitch: React.FC<{ enabled: boolean; onClick: () => void; disabled?: boolean }> = ({
+ enabled,
+ onClick,
+ disabled,
+}) => (
+ <button
+ type="button"
+ role="switch"
+ aria-checked={enabled}
+ disabled={disabled}
+ onClick={onClick}
+ className={clsx(
+ 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors focus:outline-none focus:ring-2 focus:ring-mint/40 disabled:opacity-50',
+ enabled
+ ? 'border-mint/50 bg-mint shadow-[0_0_12px_-2px_rgba(91,255,160,0.6)]'
+ : 'border-border bg-surface-2'
+ )}
+ >
+ <span
+ className={clsx(
+ 'inline-block size-3.5 rounded-full bg-background shadow transition-transform',
+ enabled ? 'translate-x-[18px]' : 'translate-x-1'
+ )}
+ />
+ </button>
+);
diff --git a/ui/src/components/settings/SettingsServicePage.tsx b/ui/src/components/settings/SettingsServicePage.tsx
new file mode 100644
index 000000000..42120f99f
--- /dev/null
+++ b/ui/src/components/settings/SettingsServicePage.tsx
@@ -0,0 +1,200 @@
+import React, { useEffect, useState } from 'react';
+import { FileText, Globe2, Play, RotateCw, Server, Square } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import clsx from 'clsx';
+
+import { useStatus } from '@/context/StatusContext';
+import { useApi } from '@/context/ApiContext';
+import { apiFetch } from '@/lib/apiFetch';
+import { RemoteAccess } from '@/components/RemoteAccess';
+import { SettingsPageShell } from './SettingsPageShell';
+import { CompactField, SettingsPanel, SettingsRow } from './SettingsPrimitives';
+
+// Mirrors design.pen mHUcm (VR/CM/Service): two cards.
+// svcSec1: header [16, 20] + value rows [12, 20] with bottom borders.
+// svcSec2: single row card with title + value pill (read-only mono).
+export const SettingsServicePage: React.FC = () => {
+ const { t } = useTranslation();
+ const { status, control } = useStatus();
+ const api = useApi();
+ const [config, setConfig] = useState<any>(null);
+ const [loading, setLoading] = useState(false);
+ const [uiSaving, setUiSaving] = useState(false);
+ const [uiMessage, setUiMessage] = useState<string | null>(null);
+
+ useEffect(() => {
+ api.getConfig().then(setConfig).catch(() => {});
+ }, [api]);
+
+ const isRunning = status.state === 'running';
+
+ const handleAction = async (action: string) => {
+ setLoading(true);
+ try {
+ await control(action);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const handleUiSaveRestart = async () => {
+ if (!config) return;
+ setUiSaving(true);
+ setUiMessage(null);
+ try {
+ const uiPayload = {
+ setup_host: config.ui?.setup_host || '127.0.0.1',
+ setup_port: config.ui?.setup_port || 5123,
+ };
+ await api.saveConfig({ ui: { ...(config.ui || {}), ...uiPayload } });
+ await apiFetch('/ui/reload', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ host: uiPayload.setup_host, port: uiPayload.setup_port }),
+ });
+ setUiMessage(t('dashboard.uiRestartMessage'));
+ } catch {
+ setUiMessage(t('common.saveFailed'));
+ } finally {
+ setUiSaving(false);
+ }
+ };
+
+ return (
+ <SettingsPageShell
+ activeTab="service"
+ title={t('settings.serviceTitle')}
+ subtitle={t('settings.serviceSubtitle')}
+ >
+ <SettingsPanel
+ title={
+ <span className="inline-flex items-center gap-2">
+ <Server className="size-3.5 text-mint" />
+ {t('settings.serviceRuntimeTitle')}
+ </span>
+ }
+ description={t('settings.serviceRuntimeSubtitle')}
+ actions={
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em]',
+ isRunning
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-border bg-white/[0.04] text-muted'
+ )}
+ >
+ <span
+ className={clsx(
+ 'size-1.5 rounded-full',
+ isRunning ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.9)]' : 'bg-muted'
+ )}
+ />
+ {isRunning ? t('common.running') : t('common.stopped')}
+ </span>
+ }
+ >
+ <SettingsRow
+ title={t('settings.statusNow')}
+ description={`PID ${status.service_pid || status.pid || '-'}`}
+ control={
+ <div className="flex flex-wrap gap-2">
+ {!isRunning && (
+ <button
+ type="button"
+ onClick={() => void handleAction('start')}
+ disabled={loading}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg bg-mint px-3 text-[12px] font-bold text-[#080812] shadow-[0_0_18px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <Play className="size-3.5" strokeWidth={2.5} />
+ {t('common.start')}
+ </button>
+ )}
+ {isRunning && (
+ <button
+ type="button"
+ onClick={() => void handleAction('stop')}
+ disabled={loading}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <Square className="size-3.5" strokeWidth={2.5} />
+ {t('common.stop')}
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={() => void handleAction('restart')}
+ disabled={loading}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <RotateCw className="size-3.5" strokeWidth={2.5} />
+ {t('common.restart')}
+ </button>
+ </div>
+ }
+ />
+ <SettingsRow
+ title={
+ <span className="inline-flex items-center gap-2">
+ <Globe2 className="size-3.5 text-cyan" />
+ {t('settings.consoleServerTitle')}
+ </span>
+ }
+ description={uiMessage || t('settings.consoleServerHint')}
+ control={
+ <div className="grid grid-cols-[120px_96px_auto] items-center gap-2">
+ <CompactField
+ aria-label={t('dashboard.host')}
+ value={config?.ui?.setup_host || '127.0.0.1'}
+ onChange={(event) => {
+ const host = event.target.value || '127.0.0.1';
+ setUiMessage(null);
+ setConfig((prev: any) => ({
+ ...(prev || {}),
+ ui: { ...((prev && prev.ui) || {}), setup_host: host },
+ }));
+ }}
+ />
+ <CompactField
+ aria-label={t('dashboard.port')}
+ type="number"
+ min={1024}
+ max={65535}
+ value={config?.ui?.setup_port || 5123}
+ onChange={(event) => {
+ const port = Number(event.target.value) || 5123;
+ setUiMessage(null);
+ setConfig((prev: any) => ({
+ ...(prev || {}),
+ ui: { ...((prev && prev.ui) || {}), setup_port: port },
+ }));
+ }}
+ />
+ <button
+ type="button"
+ onClick={() => void handleUiSaveRestart()}
+ disabled={uiSaving}
+ className="inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <RotateCw className={clsx('size-3.5', uiSaving && 'animate-spin')} strokeWidth={2.5} />
+ {uiSaving ? t('common.saving') : t('common.saveAndRestart')}
+ </button>
+ </div>
+ }
+ />
+ </SettingsPanel>
+
+ {/* Mirrors design.pen CuVKM (svcSec2): single-row read-only value pill */}
+ <SettingsPanel>
+ <div className="flex flex-col gap-3 px-5 py-4 md:flex-row md:items-center md:justify-between">
+ <div className="text-[13px] font-medium text-foreground">{t('settings.logFileLabel')}</div>
+ <div className="inline-flex items-center gap-2 rounded-lg border border-border bg-white/[0.04] px-3 py-2">
+ <FileText className="size-3.5 text-muted" />
+ <span className="font-mono text-[11px] text-foreground">~/.vibe_remote/logs/vibe_remote.log</span>
+ </div>
+ </div>
+ </SettingsPanel>
+
+ <RemoteAccess embedded />
+ </SettingsPageShell>
+ );
+};
diff --git a/ui/src/components/shared/RoutingConfigPanel.tsx b/ui/src/components/shared/RoutingConfigPanel.tsx
new file mode 100644
index 000000000..32a2cf879
--- /dev/null
+++ b/ui/src/components/shared/RoutingConfigPanel.tsx
@@ -0,0 +1,456 @@
+import React, { useEffect, useState } from 'react';
+import { FolderOpen, HelpCircle } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import clsx from 'clsx';
+import { Combobox } from '../ui/combobox';
+import { BackendIcon } from '../visual';
+
+// Mirrors design.pen `asPXu` (VR/RoutingConfig). Shared between groups (channels)
+// and users — same form, same fields, same styles. The only difference is whether
+// the @mention requirement segmented toggle is shown.
+
+export interface RoutingConfigValue {
+ custom_cwd: string;
+ routing: {
+ agent_backend: string | null;
+ opencode_agent?: string | null;
+ opencode_model?: string | null;
+ opencode_reasoning_effort?: string | null;
+ claude_agent?: string | null;
+ claude_model?: string | null;
+ claude_reasoning_effort?: string | null;
+ codex_agent?: string | null;
+ codex_model?: string | null;
+ codex_reasoning_effort?: string | null;
+ };
+ show_message_types: string[];
+ require_mention?: boolean | null;
+}
+
+export interface RoutingConfigPanelProps {
+ value: RoutingConfigValue;
+ onChange: (patch: Partial<RoutingConfigValue>) => void;
+ onBrowseDirectory: () => void;
+ globalConfig: any;
+ /** Show the require-@mention segmented control (Inherit / On / Off). */
+ showRequireMention?: boolean;
+ /** Platform key used to derive inherited @mention default (e.g., 'slack', 'discord'). */
+ inheritsFromKey?: string;
+ /** Backend lookup data — pass already-loaded values from the parent. */
+ opencodeOptions?: any;
+ claudeAgents?: { id: string; name: string }[];
+ claudeModels?: string[];
+ claudeReasoningOptions?: Record<string, { value: string; label: string }[]>;
+ codexAgents?: { id: string; name: string }[];
+ codexModels?: string[];
+ /** Optional footer slot — e.g., admin/remove actions on the users page. */
+ footerActions?: React.ReactNode;
+ /** Wrapper class — controls outer padding/border. Default: 'border-t border-border/60 px-5 py-4'. */
+ containerClass?: string;
+}
+
+/** Input that only commits value on blur */
+function BlurInput({
+ value,
+ onCommit,
+ ...props
+}: { value: string; onCommit: (v: string) => void } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onBlur'>) {
+ const [local, setLocal] = useState(value);
+ useEffect(() => setLocal(value), [value]);
+ return (
+ <input
+ {...props}
+ value={local}
+ onChange={(e) => setLocal(e.target.value)}
+ onBlur={() => { if (local !== value) onCommit(local); }}
+ />
+ );
+}
+
+export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
+ value,
+ onChange,
+ onBrowseDirectory,
+ globalConfig,
+ showRequireMention = true,
+ inheritsFromKey,
+ opencodeOptions,
+ claudeAgents = [],
+ claudeModels = [],
+ claudeReasoningOptions = {},
+ codexAgents = [],
+ codexModels = [],
+ footerActions,
+ containerClass = 'border-t border-border/60 px-5 py-4',
+}) => {
+ const { t } = useTranslation();
+
+ const defaultBackend = globalConfig?.agents?.default_backend || 'opencode';
+ const effectiveBackend = value.routing.agent_backend || defaultBackend;
+
+ const getOpenCodeReasoningOptions = (modelKey: string) => {
+ const lookup = opencodeOptions?.reasoning_options || {};
+ if (lookup && typeof lookup === 'object') {
+ return (lookup as Record<string, { value: string; label: string }[]>)[modelKey] || [];
+ }
+ return [];
+ };
+
+ const getClaudeReasoning = (model: string) => {
+ const modelKey = model || '';
+ const cached = claudeReasoningOptions[modelKey];
+ if (cached?.length) return cached;
+ const fallback = claudeReasoningOptions[''] || [];
+ const normalized = modelKey.toLowerCase();
+ if (normalized.includes('claude-opus-4-7') || normalized === 'opus' || normalized === 'opus[1m]') {
+ const opts = [...fallback];
+ if (!opts.some((o) => o.value === 'xhigh')) opts.push({ value: 'xhigh', label: 'Extra High' });
+ if (!opts.some((o) => o.value === 'max')) opts.push({ value: 'max', label: 'Max' });
+ return opts;
+ }
+ if (normalized.includes('claude-opus-4-6') || normalized.includes('claude-sonnet-4-6')) {
+ return fallback.some((o) => o.value === 'max') ? fallback : [...fallback, { value: 'max', label: 'Max' }];
+ }
+ return fallback;
+ };
+
+ const getReasoningLabel = (val: string, fallback: string) => {
+ switch (val) {
+ case 'low': return t('channelList.reasoningLow');
+ case 'medium': return t('channelList.reasoningMedium');
+ case 'high': return t('channelList.reasoningHigh');
+ case 'xhigh': return t('channelList.reasoningXHigh');
+ case 'max': return t('channelList.reasoningMax');
+ default: return fallback;
+ }
+ };
+
+ // Top row: working dir + backend (+ optional require_mention) — dynamic grid columns
+ const topGridCols = showRequireMention ? 'md:grid-cols-3' : 'md:grid-cols-2';
+
+ return (
+ <div className={clsx('space-y-4', containerClass)}>
+ <div className={clsx('grid grid-cols-1 gap-3', topGridCols)}>
+ {/* Working directory */}
+ <div className="space-y-1">
+ <label className="text-xs font-medium uppercase text-muted">{t('channelList.workingDirectory')}</label>
+ <div className="flex gap-1.5">
+ <BlurInput
+ type="text"
+ placeholder={globalConfig?.runtime?.default_cwd || t('channelList.useGlobalDefault')}
+ value={value.custom_cwd}
+ onCommit={(v) => onChange({ custom_cwd: v })}
+ className="flex-1 rounded-lg border border-border bg-surface px-3 py-2 font-mono text-sm text-foreground placeholder:text-muted/50 focus:border-cyan focus:outline-none"
+ />
+ <button
+ type="button"
+ onClick={onBrowseDirectory}
+ title={t('directoryBrowser.title')}
+ className="shrink-0 rounded-lg border border-border bg-surface-3/60 px-2 py-2 text-muted transition-colors hover:border-cyan/40 hover:bg-surface-2/70 hover:text-foreground"
+ >
+ <FolderOpen size={14} />
+ </button>
+ </div>
+ </div>
+
+ {/* Backend */}
+ <div className="space-y-1">
+ <label className="text-xs font-medium uppercase text-muted">{t('channelList.backend')}</label>
+ <div className="relative">
+ <span className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2">
+ <BackendIcon backend={effectiveBackend} variant="glyph" size={14} />
+ </span>
+ <select
+ value={effectiveBackend}
+ onChange={(e) => onChange({ routing: { ...value.routing, agent_backend: e.target.value } })}
+ className="w-full rounded-lg border border-border bg-surface py-2 pl-9 pr-3 text-sm text-foreground focus:border-cyan focus:outline-none"
+ >
+ <option value="opencode">OpenCode</option>
+ <option value="claude">ClaudeCode</option>
+ <option value="codex">Codex</option>
+ </select>
+ </div>
+ </div>
+
+ {/* Require @mention (channels only) */}
+ {showRequireMention && (() => {
+ const current: 'inherit' | 'on' | 'off' =
+ value.require_mention === null || value.require_mention === undefined
+ ? 'inherit'
+ : value.require_mention
+ ? 'on'
+ : 'off';
+ const setMention = (next: 'inherit' | 'on' | 'off') => {
+ onChange({ require_mention: next === 'inherit' ? null : next === 'on' });
+ };
+ const inheritedOn = !!(globalConfig as any)?.[inheritsFromKey || '']?.require_mention;
+ const segs: { id: 'inherit' | 'on' | 'off'; label: string }[] = [
+ {
+ id: 'inherit',
+ label: `${t('common.inherit')} (${
+ inheritedOn ? t('channelList.mentionStatusOn') : t('channelList.mentionStatusOff')
+ })`,
+ },
+ { id: 'on', label: t('channelList.requireMentionOn') },
+ { id: 'off', label: t('channelList.requireMentionOff') },
+ ];
+ return (
+ <div className="space-y-1">
+ <label className="text-xs font-medium uppercase text-muted">{t('channelList.requireMention')}</label>
+ <div
+ role="radiogroup"
+ aria-label={t('channelList.requireMention') as string}
+ className="flex h-9 items-stretch gap-0.5 rounded-md border border-border bg-white/[0.03] p-0.5"
+ >
+ {segs.map((seg) => {
+ const active = current === seg.id;
+ return (
+ <button
+ key={seg.id}
+ type="button"
+ role="radio"
+ aria-checked={active}
+ onClick={() => setMention(seg.id)}
+ className={clsx(
+ 'flex-1 rounded-[4px] px-2.5 text-[12px] transition-colors',
+ active
+ ? 'border border-mint/30 bg-mint-soft font-bold text-mint'
+ : 'font-medium text-muted hover:text-foreground'
+ )}
+ >
+ {seg.label}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ );
+ })()}
+ </div>
+
+ {/* Show message types chips */}
+ <div className="space-y-2">
+ <div className="flex items-center gap-1 text-xs font-medium uppercase text-muted">
+ {t('channelList.showMessageTypes')}
+ <span className="group relative">
+ <HelpCircle size={12} className="cursor-help text-muted/50" />
+ <span className="pointer-events-none absolute bottom-full left-0 z-10 mb-2 w-64 whitespace-normal rounded bg-text px-3 py-2 text-xs font-normal normal-case text-bg opacity-0 shadow-lg transition-opacity group-hover:opacity-100">
+ {t('channelList.showMessageTypesHint')}
+ </span>
+ </span>
+ </div>
+ <div className="flex flex-wrap gap-2 text-sm">
+ {['system', 'assistant', 'toolcall'].map((msgType) => {
+ const checked = (value.show_message_types || []).includes(msgType);
+ const label = msgType === 'toolcall' ? 'Toolcall' : msgType.charAt(0).toUpperCase() + msgType.slice(1);
+ return (
+ <button
+ key={msgType}
+ type="button"
+ aria-pressed={checked}
+ onClick={() => {
+ const next = checked
+ ? (value.show_message_types || []).filter((v) => v !== msgType)
+ : [...(value.show_message_types || []), msgType];
+ onChange({ show_message_types: next });
+ }}
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[12px] font-medium transition-colors',
+ checked
+ ? 'border-mint/40 bg-mint/15 text-mint'
+ : 'border-border bg-white/[0.02] text-muted hover:border-border-strong hover:text-foreground'
+ )}
+ >
+ <span
+ className={clsx(
+ 'size-1.5 rounded-full',
+ checked ? 'bg-mint shadow-[0_0_6px_rgba(91,255,160,0.7)]' : 'bg-muted/50'
+ )}
+ />
+ {label}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+
+ {/* Backend-specific settings */}
+ {effectiveBackend === 'opencode' && (
+ <div className="space-y-3">
+ <div className="text-xs font-medium uppercase text-muted">{t('channelList.opencodeSettings')}</div>
+ <div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.agent')}</label>
+ <select
+ value={value.routing.opencode_agent || ''}
+ onChange={(e) => onChange({ routing: { ...value.routing, opencode_agent: e.target.value || null } })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ {(opencodeOptions?.agents || []).map((a: any) => (
+ <option key={a.name} value={a.name}>{a.name}</option>
+ ))}
+ </select>
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.model')}</label>
+ <select
+ value={value.routing.opencode_model || ''}
+ onChange={(e) => onChange({
+ routing: {
+ ...value.routing,
+ opencode_model: e.target.value || null,
+ opencode_reasoning_effort: null,
+ },
+ })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ {(opencodeOptions?.models?.providers || []).flatMap((provider: any) => {
+ const pid = provider.id || provider.provider_id || provider.name;
+ const pLabel = provider.name || pid;
+ const models = provider.models || {};
+ if (Array.isArray(models)) {
+ return models.map((m: any) => {
+ const mid = typeof m === 'string' ? m : m.id;
+ return <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>;
+ });
+ }
+ return Object.keys(models).map((mid) => (
+ <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>
+ ));
+ })}
+ </select>
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
+ <select
+ value={value.routing.opencode_reasoning_effort || ''}
+ onChange={(e) => onChange({
+ routing: { ...value.routing, opencode_reasoning_effort: e.target.value || null },
+ })}
+ disabled={!getOpenCodeReasoningOptions(value.routing.opencode_model || '').length}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground disabled:opacity-50"
+ >
+ <option value="">{t('common.default')}</option>
+ {getOpenCodeReasoningOptions(value.routing.opencode_model || '').map((opt) => (
+ <option key={opt.value} value={opt.value}>{opt.label}</option>
+ ))}
+ </select>
+ </div>
+ </div>
+ </div>
+ )}
+
+ {effectiveBackend === 'claude' && (
+ <div className="space-y-3">
+ <div className="text-xs font-medium uppercase text-muted">{t('channelList.claudeSettings')}</div>
+ <div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.agent')}</label>
+ <select
+ value={value.routing.claude_agent || ''}
+ onChange={(e) => onChange({ routing: { ...value.routing, claude_agent: e.target.value || null } })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ {claudeAgents.map((a) => <option key={a.id} value={a.id}>{a.name}</option>)}
+ </select>
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.model')}</label>
+ <Combobox
+ options={[{ value: '', label: t('common.default') }, ...claudeModels.map(m => ({ value: m, label: m }))]}
+ value={value.routing.claude_model || ''}
+ onValueChange={(v) => onChange({
+ routing: {
+ ...value.routing,
+ claude_model: v || null,
+ claude_reasoning_effort: null,
+ },
+ })}
+ placeholder={t('channelList.claudeModelPlaceholder')}
+ searchPlaceholder={t('channelList.searchModel')}
+ allowCustomValue={true}
+ />
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
+ <select
+ value={value.routing.claude_reasoning_effort || ''}
+ onChange={(e) => onChange({
+ routing: { ...value.routing, claude_reasoning_effort: e.target.value || null },
+ })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ {getClaudeReasoning(value.routing.claude_model || '')
+ .filter((option) => option.value !== '__default__')
+ .map((option) => (
+ <option key={option.value} value={option.value}>
+ {getReasoningLabel(option.value, option.label)}
+ </option>
+ ))}
+ </select>
+ </div>
+ </div>
+ </div>
+ )}
+
+ {effectiveBackend === 'codex' && (
+ <div className="space-y-3">
+ <div className="text-xs font-medium uppercase text-muted">{t('channelList.codexSettings')}</div>
+ <div className="grid grid-cols-1 gap-3 rounded-xl border border-border bg-surface/80 p-3 md:grid-cols-3">
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.agent')}</label>
+ <select
+ value={value.routing.codex_agent || ''}
+ onChange={(e) => onChange({ routing: { ...value.routing, codex_agent: e.target.value || null } })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ {codexAgents.map((a) => <option key={a.id} value={a.id}>{a.name}</option>)}
+ </select>
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.model')}</label>
+ <Combobox
+ options={[{ value: '', label: t('common.default') }, ...codexModels.map(m => ({ value: m, label: m }))]}
+ value={value.routing.codex_model || ''}
+ onValueChange={(v) => onChange({
+ routing: { ...value.routing, codex_model: v || null },
+ })}
+ placeholder={t('channelList.codexModelPlaceholder')}
+ searchPlaceholder={t('channelList.searchModel')}
+ allowCustomValue={true}
+ />
+ </div>
+ <div className="space-y-1">
+ <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
+ <select
+ value={value.routing.codex_reasoning_effort || ''}
+ onChange={(e) => onChange({
+ routing: { ...value.routing, codex_reasoning_effort: e.target.value || null },
+ })}
+ className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-foreground"
+ >
+ <option value="">{t('common.default')}</option>
+ <option value="low">{t('channelList.reasoningLow')}</option>
+ <option value="medium">{t('channelList.reasoningMedium')}</option>
+ <option value="high">{t('channelList.reasoningHigh')}</option>
+ <option value="xhigh">{t('channelList.reasoningXHigh')}</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ )}
+
+ {/* Custom footer slot — e.g., admin/remove buttons on /users */}
+ {footerActions && (
+ <div className="flex items-center justify-end gap-2 border-t border-border/60 pt-3">
+ {footerActions}
+ </div>
+ )}
+ </div>
+ );
+};
diff --git a/ui/src/components/steps/AgentDetection.tsx b/ui/src/components/steps/AgentDetection.tsx
index 089fa8d67..a606e6376 100644
--- a/ui/src/components/steps/AgentDetection.tsx
+++ b/ui/src/components/steps/AgentDetection.tsx
@@ -1,13 +1,28 @@
import React, { useEffect, useState } from 'react';
-import { Check, X, RefreshCw, Search, Settings, Download, ChevronDown, ChevronUp } from 'lucide-react';
+import {
+ ArrowLeft,
+ ArrowRight,
+ Check,
+ ChevronDown,
+ ChevronUp,
+ Download,
+ RefreshCw,
+ Search,
+ Settings,
+ X,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
+import { BackendIcon, EyebrowBadge, WizardCard } from '../visual';
+import type { BackendId } from '../visual';
interface AgentDetectionProps {
data: any;
onNext: (data: any) => void;
- onBack: () => void;
+ onBack?: () => void;
+ isPage?: boolean;
+ onSave?: (data: { agents: Record<string, AgentState>; default_backend: string }) => Promise<void> | void;
}
type AgentState = {
@@ -18,39 +33,66 @@ type AgentState = {
type PermissionState = 'idle' | 'loading' | 'success' | 'error';
-export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onBack }) => {
+const DEFAULT_AGENTS: Record<string, AgentState> = {
+ opencode: { enabled: true, cli_path: 'opencode', status: 'unknown' },
+ claude: { enabled: true, cli_path: 'claude', status: 'unknown' },
+ codex: { enabled: false, cli_path: 'codex', status: 'unknown' },
+};
+
+const AGENT_LABEL: Record<string, string> = {
+ opencode: 'OpenCode',
+ claude: 'Claude Code',
+ codex: 'Codex',
+};
+
+const normalizeAgents = (source: any): Record<string, AgentState> => {
+ const raw = source?.agents || {};
+ return Object.fromEntries(
+ Object.entries(DEFAULT_AGENTS).map(([name, fallback]) => {
+ const next = raw?.[name] || {};
+ return [
+ name,
+ {
+ ...fallback,
+ ...next,
+ status: next.status || fallback.status,
+ },
+ ];
+ })
+ );
+};
+
+// Mirrors design.pen JHgjz (Backends wizard step) and qVHh4 (Settings → Backends).
+// 920-wide WizardCard, mint eyebrow, compact backend cards with header (icon, label,
+// status pill, switch) and body (CLI path + detect, optional permission/install row).
+export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onBack, isPage = false, onSave }) => {
const { t } = useTranslation();
const api = useApi();
const [checking, setChecking] = useState(false);
- const [defaultBackend, setDefaultBackend] = useState<string>(data.default_backend || 'opencode');
- const [agents, setAgents] = useState<Record<string, AgentState>>(
- data.agents || {
- opencode: { enabled: true, cli_path: 'opencode', status: 'unknown' },
- claude: { enabled: true, cli_path: 'claude', status: 'unknown' },
- codex: { enabled: false, cli_path: 'codex', status: 'unknown' },
- }
+ const [defaultBackend, setDefaultBackend] = useState<string>(
+ data.default_backend || data.agents?.default_backend || 'opencode'
);
+ const [agents, setAgents] = useState<Record<string, AgentState>>(normalizeAgents(data));
const [permissionState, setPermissionState] = useState<PermissionState>('idle');
const [permissionMessage, setPermissionMessage] = useState<string>('');
- // Per-agent install state to prevent race conditions
const [installingAgents, setInstallingAgents] = useState<Record<string, boolean>>({});
- const [installResults, setInstallResults] = useState<Record<string, { ok: boolean; message: string; output?: string | null }>>({});
+ const [installResults, setInstallResults] = useState<
+ Record<string, { ok: boolean; message: string; output?: string | null }>
+ >({});
const [expandedOutputs, setExpandedOutputs] = useState<Record<string, boolean>>({});
const isMissing = (agent: AgentState) => agent.status === 'missing';
- // Check if any agent is currently installing
const isAnyInstalling = Object.values(installingAgents).some(Boolean);
useEffect(() => {
detectAll();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const detect = async (name: string, binary?: string) => {
setChecking(true);
try {
- let result;
- result = await api.detectCli(binary || name);
-
+ const result = await api.detectCli(binary || name);
setAgents((prev) => ({
...prev,
[name]: {
@@ -93,7 +135,6 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
};
const installAgent = async (name: string) => {
- // Prevent multiple concurrent installations
if (isAnyInstalling) return;
setInstallingAgents((prev) => ({ ...prev, [name]: true }));
@@ -111,13 +152,9 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
if (installedPath) {
setAgents((prev) => ({
...prev,
- [name]: {
- ...prev[name],
- cli_path: installedPath,
- },
+ [name]: { ...prev[name], cli_path: installedPath },
}));
}
- // Re-detect after successful installation
await detect(name, installedPath || agents[name]?.cli_path || name);
}
} catch (e) {
@@ -136,166 +173,173 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
const canContinue = Object.values(agents).some((agent) => agent.enabled);
- return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <h2 className="text-3xl font-display font-bold mb-2 text-text">{t('agentDetection.title')}</h2>
- <p className="text-muted mb-6">
- {t('agentDetection.subtitle')}
- </p>
+ const handlePrimaryAction = async () => {
+ const nextData = { agents, default_backend: defaultBackend };
+ if (isPage && onSave) {
+ await onSave(nextData);
+ return;
+ }
+ onNext(nextData);
+ };
- <div className="mb-6 p-4 border border-border rounded-xl bg-panel shadow-sm">
- <label className="text-sm font-medium text-muted uppercase">{t('agentDetection.defaultBackend')}</label>
- <select
- value={defaultBackend}
- onChange={(e) => setDefaultBackend(e.target.value)}
- className="mt-2 w-full bg-bg border border-border rounded px-3 py-2 text-sm"
- >
- <option value="opencode">OpenCode {t('agentDetection.recommended')}</option>
- <option value="claude">ClaudeCode</option>
- <option value="codex">Codex</option>
- </select>
- </div>
+ const enabledCount = Object.values(agents).filter((a) => a.enabled && a.status === 'ok').length;
- <div className="flex justify-end mb-4">
+ // Page mode keeps the existing settings shell — render the inner content only
+ const Inner = (
+ <>
+ <div className="flex flex-col gap-3 rounded-xl border border-border bg-background px-4 py-3 md:flex-row md:items-end md:justify-between">
+ <label className="min-w-0 flex-1">
+ <span className="text-[11px] font-semibold uppercase tracking-[0.12em] text-muted">
+ {t('agentDetection.defaultBackend')}
+ </span>
+ <select
+ value={defaultBackend}
+ onChange={(e) => setDefaultBackend(e.target.value)}
+ className="mt-1 h-9 w-full rounded-lg border border-border bg-surface-2 px-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40 md:max-w-[260px]"
+ >
+ <option value="opencode">OpenCode {t('agentDetection.recommended')}</option>
+ <option value="claude">Claude Code</option>
+ <option value="codex">Codex</option>
+ </select>
+ </label>
<button
onClick={detectAll}
- className="flex items-center gap-2 px-4 py-2 bg-neutral-100 hover:bg-neutral-200 text-text rounded-lg transition-colors font-medium text-sm"
+ className="inline-flex h-9 items-center gap-2 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong"
>
- <Search size={16} /> {t('common.detectAll')}
+ <Search className="size-3.5" /> {t('common.detectAll')}
</button>
</div>
- <div className="space-y-4 mb-6">
+ <div className="flex flex-col gap-3">
{Object.entries(agents).map(([name, agent]) => (
- <div key={name} className="p-5 bg-panel border border-border rounded-xl shadow-sm transition-shadow hover:shadow-md">
- <div className="flex items-center justify-between mb-4">
- <div>
- <h3 className="font-semibold capitalize text-lg text-text font-display">{name}</h3>
+ <div
+ key={name}
+ className="overflow-hidden rounded-xl border border-border bg-background transition-colors hover:border-border-strong"
+ >
+ <div className="flex items-center justify-between gap-3 border-b border-border px-5 py-3.5">
+ <div className="flex min-w-0 items-center gap-3">
+ <div className="flex size-9 items-center justify-center rounded-lg border border-border bg-surface-2">
+ <BackendIcon backend={name as BackendId} size={18} />
+ </div>
+ <div className="min-w-0">
+ <h3 className="text-[13px] font-semibold text-foreground">{AGENT_LABEL[name] || name}</h3>
+ <div className="mt-0.5 text-[11px] text-muted">{t('agentDetection.cliPath')}</div>
+ </div>
</div>
- <StatusBadge status={agent.status || 'unknown'} loading={checking} />
- </div>
-
- <div className="flex flex-col gap-4">
- <label className="flex items-center gap-2.5 text-sm text-text font-medium cursor-pointer w-fit select-none">
+ <div className="flex items-center gap-3">
+ <StatusBadge status={agent.status || 'unknown'} loading={checking} />
<button
role="switch"
aria-checked={agent.enabled}
onClick={() => toggle(name, !agent.enabled)}
className={clsx(
- 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-accent/40',
- agent.enabled ? 'bg-accent' : 'bg-neutral-300'
+ 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors focus:outline-none focus:ring-2 focus:ring-mint/40',
+ agent.enabled
+ ? 'border-mint/50 bg-mint shadow-[0_0_12px_-2px_rgba(91,255,160,0.6)]'
+ : 'border-border bg-surface-2'
)}
>
<span
className={clsx(
- 'inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform',
- agent.enabled ? 'translate-x-[18px]' : 'translate-x-[3px]'
+ 'inline-block size-3.5 rounded-full bg-background shadow transition-transform',
+ agent.enabled ? 'translate-x-[18px]' : 'translate-x-1'
)}
/>
</button>
- {t('common.enable')}
- </label>
+ </div>
+ </div>
- <div className="flex-1">
- <div className="flex items-center gap-2 mb-2">
- <label className="text-xs font-medium text-muted uppercase">{t('agentDetection.cliPath')}</label>
- {isMissing(agent) && (
- <span className="text-[10px] text-danger bg-danger/10 px-1.5 py-0.5 rounded border border-danger/20">{t('common.notFound')}</span>
- )}
- {!isMissing(agent) && agent.status === 'ok' && (
- <span className="text-[10px] text-success bg-success/10 px-1.5 py-0.5 rounded border border-success/20">{t('common.found')}</span>
- )}
- </div>
- <div className="flex gap-2">
- <input
- type="text"
- value={agent.cli_path}
- onChange={(e) => setAgents(prev => ({
- ...prev,
- [name]: { ...prev[name], cli_path: e.target.value }
- }))}
- placeholder={t('agentDetection.cliPathPlaceholder', { name })}
- className="flex-1 bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent font-mono text-text"
- />
- <button
- onClick={() => detect(name, agent.cli_path)}
- disabled={checking}
- className="px-3 py-2 bg-neutral-100 hover:bg-neutral-200 rounded text-sm text-muted hover:text-text font-medium transition-colors border border-border"
- >
- {checking ? <RefreshCw size={14} className="animate-spin" /> : t('common.detect')}
- </button>
- </div>
+ <div className="space-y-3 px-5 py-3.5">
+ <div className="flex gap-2">
+ <input
+ type="text"
+ value={agent.cli_path}
+ onChange={(e) =>
+ setAgents((prev) => ({
+ ...prev,
+ [name]: { ...prev[name], cli_path: e.target.value },
+ }))
+ }
+ placeholder={t('agentDetection.cliPathPlaceholder', { name })}
+ className="h-9 flex-1 rounded-lg border border-border bg-surface-2 px-3 font-mono text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <button
+ onClick={() => detect(name, agent.cli_path)}
+ disabled={checking}
+ className="inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {checking ? <RefreshCw className="size-3.5 animate-spin" /> : <Search className="size-3.5" />}
+ {t('common.detect')}
+ </button>
</div>
- {/* One-click install button when agent is missing */}
{isMissing(agent) && (
- <div className="mt-2 p-3 bg-blue-50 border border-blue-200 rounded-lg">
- <p className="text-sm text-blue-800 mb-2">{t('agentDetection.installHint')}</p>
- <div className="flex flex-col gap-2">
- <div className="flex items-center gap-3 flex-wrap">
+ <div className="space-y-2 rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2.5">
+ <p className="text-[11px] text-cyan">{t('agentDetection.installHint')}</p>
+ <div className="flex flex-wrap items-center gap-3">
+ <button
+ onClick={() => installAgent(name)}
+ disabled={isAnyInstalling}
+ className="inline-flex h-8 items-center gap-2 rounded-lg bg-cyan px-3 text-[12px] font-bold text-[#080812] shadow-[0_0_18px_-4px_rgba(63,224,229,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {installingAgents[name] ? (
+ <RefreshCw className="size-3.5 animate-spin" />
+ ) : (
+ <Download className="size-3.5" />
+ )}
+ {installingAgents[name] ? t('agentDetection.installing') : t('agentDetection.installAgent')}
+ </button>
+ {installResults[name]?.message && (
+ <span
+ className={clsx(
+ 'text-[11px]',
+ installResults[name].ok ? 'text-mint' : 'text-danger'
+ )}
+ >
+ {installResults[name].message}
+ </span>
+ )}
+ </div>
+ {installResults[name]?.output && (
+ <div>
<button
- onClick={() => installAgent(name)}
- disabled={isAnyInstalling}
- className="flex items-center gap-2 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white rounded text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
+ onClick={() => toggleOutput(name)}
+ className="inline-flex items-center gap-1 text-[11px] text-cyan transition hover:text-cyan/80"
>
- {installingAgents[name] ? (
- <RefreshCw size={14} className="animate-spin" />
- ) : (
- <Download size={14} />
- )}
- {installingAgents[name] ? t('agentDetection.installing') : t('agentDetection.installAgent')}
+ {expandedOutputs[name] ? <ChevronUp size={12} /> : <ChevronDown size={12} />}
+ {t('agentDetection.showOutput')}
</button>
- {installResults[name]?.message && (
- <span className={clsx(
- "text-sm",
- installResults[name].ok ? "text-green-600" : "text-red-600"
- )}>
- {installResults[name].message}
- </span>
+ {expandedOutputs[name] && (
+ <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap rounded border border-border bg-background px-3 py-2 font-mono text-[11px] text-muted">
+ {installResults[name].output}
+ </pre>
)}
</div>
- {/* Expandable output section */}
- {installResults[name]?.output && (
- <div className="mt-1">
- <button
- onClick={() => toggleOutput(name)}
- className="flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800"
- >
- {expandedOutputs[name] ? <ChevronUp size={12} /> : <ChevronDown size={12} />}
- {t('agentDetection.showOutput')}
- </button>
- {expandedOutputs[name] && (
- <pre className="mt-2 p-2 bg-gray-100 border border-gray-200 rounded text-xs text-gray-700 overflow-x-auto max-h-40 overflow-y-auto whitespace-pre-wrap">
- {installResults[name].output}
- </pre>
- )}
- </div>
- )}
- </div>
+ )}
</div>
)}
{name === 'opencode' && agent.status === 'ok' && (
- <div className="mt-2 p-3 bg-amber-50 border border-amber-200 rounded-lg">
- <p className="text-sm text-amber-800 mb-2">{t('agentDetection.permissionHint')}</p>
- <div className="flex items-center gap-3">
+ <div className="rounded-lg border border-gold/30 bg-gold/10 px-3 py-2.5">
+ <p className="mb-2 text-[11px] text-gold">{t('agentDetection.permissionHint')}</p>
+ <div className="flex flex-wrap items-center gap-3">
<button
onClick={setupPermission}
disabled={permissionState === 'loading'}
- className="flex items-center gap-2 px-3 py-1.5 bg-amber-500 hover:bg-amber-600 text-white rounded text-sm font-medium transition-colors disabled:opacity-50"
+ className="inline-flex h-8 items-center gap-2 rounded-lg bg-gold px-3 text-[12px] font-bold text-[#080812] shadow-[0_0_18px_-4px_rgba(255,200,87,0.55)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
{permissionState === 'loading' ? (
- <RefreshCw size={14} className="animate-spin" />
+ <RefreshCw className="size-3.5 animate-spin" />
) : (
- <Settings size={14} />
+ <Settings className="size-3.5" />
)}
{t('agentDetection.setupPermission')}
</button>
{permissionState === 'success' && (
- <span className="text-sm text-green-600">{permissionMessage}</span>
+ <span className="text-[11px] text-mint">{permissionMessage}</span>
)}
{permissionState === 'error' && (
- <span className="text-sm text-red-600">{permissionMessage}</span>
+ <span className="text-[11px] text-danger">{permissionMessage}</span>
)}
</div>
</div>
@@ -303,53 +347,97 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
</div>
</div>
))}
+ </div>
+ </>
+ );
+ if (isPage) {
+ return (
+ <div className="flex flex-col gap-4">
+ {Inner}
+ <div className="flex justify-end">
+ <button
+ onClick={() => void handlePrimaryAction()}
+ disabled={!canContinue}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.save')}
+ </button>
+ </div>
</div>
+ );
+ }
- <div className="mt-auto flex justify-between pt-4">
- <button
- onClick={onBack}
- className="px-6 py-2 text-muted hover:text-text font-medium transition-colors"
- >
- {t('common.back')}
- </button>
- <button
- onClick={() => onNext({ agents, default_backend: defaultBackend })}
- disabled={!canContinue}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- canContinue
- ? 'bg-accent hover:bg-accent/90 text-white'
- : 'bg-neutral-200 text-muted cursor-not-allowed'
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Backends</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('agentDetection.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('agentDetection.subtitle')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {enabledCount} active
+ </span>
+ </div>
+ </div>
+
+ {Inner}
+
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ {onBack ? (
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ ) : (
+ <span />
)}
- >
- {t('common.continue')}
- </button>
- </div>
+ <button
+ type="button"
+ onClick={() => void handlePrimaryAction()}
+ disabled={!canContinue}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
-const StatusBadge = ({ status, loading }: { status: 'unknown' | 'ok' | 'missing'; loading: boolean }) => {
+const StatusBadge: React.FC<{ status: 'unknown' | 'ok' | 'missing'; loading: boolean }> = ({ status, loading }) => {
const { t } = useTranslation();
-
+
if (loading) {
return (
- <div className="animate-spin text-muted">
- <RefreshCw size={20} />
+ <div className="text-muted">
+ <RefreshCw className="size-3.5 animate-spin" />
</div>
);
}
if (status === 'unknown') {
- return <span className="text-sm text-muted italic">{t('common.notChecked')}</span>;
+ return <span className="text-[11px] text-muted">{t('common.notChecked')}</span>;
}
return status === 'ok' ? (
- <div className="flex items-center gap-2 text-success bg-success/10 px-3 py-1 rounded-full text-sm font-medium border border-success/20">
- <Check size={14} /> {t('common.found')}
+ <div className="inline-flex items-center gap-1.5 rounded-full border border-mint/30 bg-mint/[0.08] px-2 py-0.5 text-[11px] font-medium text-mint">
+ <Check className="size-3" /> {t('common.found')}
</div>
) : (
- <div className="flex items-center gap-2 text-danger bg-danger/10 px-3 py-1 rounded-full text-sm font-medium border border-danger/20">
- <X size={14} /> {t('common.missing')}
+ <div className="inline-flex items-center gap-1.5 rounded-full border border-danger/30 bg-danger/10 px-2 py-0.5 text-[11px] font-medium text-danger">
+ <X className="size-3" /> {t('common.missing')}
</div>
);
};
diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsx
index 8fd0fe61a..58e8baf2b 100644
--- a/ui/src/components/steps/ChannelList.tsx
+++ b/ui/src/components/steps/ChannelList.tsx
@@ -1,31 +1,42 @@
-import React, { useEffect, useRef, useState } from 'react';
-import { Hash, CheckSquare, Square, RefreshCw, HelpCircle, Globe, FolderOpen, MessageSquare, Users, AtSign } from 'lucide-react';
+import React, { useEffect, useMemo, useRef, useState } from 'react';
+import {
+ ArrowLeft,
+ ArrowRight,
+ AtSign,
+ CheckSquare,
+ ChevronDown,
+ ChevronUp,
+ Globe,
+ Hash,
+ HelpCircle,
+ MessageSquare,
+ RefreshCw,
+ Search,
+ Square,
+ Users,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
-import { Combobox } from '../ui/combobox';
import { DirectoryBrowser } from '../ui/directory-browser';
import { useNavigate } from 'react-router-dom';
import clsx from 'clsx';
import { getEnabledPlatforms, platformSupportsChannels } from '../../lib/platforms';
+import { EyebrowBadge, PlatformIcon, WizardCard } from '../visual';
+import { RoutingConfigPanel } from '../shared/RoutingConfigPanel';
+
+const PLATFORM_BRAND_COLORS: Record<string, string> = {
+ slack: '#4A154B',
+ discord: '#5865F2',
+ telegram: '#0088CC',
+ lark: '#4C6EB5',
+ wechat: '#07C160',
+};
-/** Input that only commits value on blur */
-function BlurInput({
- value,
- onCommit,
- ...props
-}: { value: string; onCommit: (v: string) => void } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onBlur'>) {
- const [local, setLocal] = useState(value);
- useEffect(() => setLocal(value), [value]);
- return (
- <input
- {...props}
- value={local}
- onChange={(e) => setLocal(e.target.value)}
- onBlur={() => { if (local !== value) onCommit(local); }}
- />
- );
-}
+const platformBoxStyle = (platformId: string): React.CSSProperties => {
+ const base = PLATFORM_BRAND_COLORS[platformId] || '#5BFFA0';
+ return { backgroundColor: `${base}26`, borderColor: `${base}66` };
+};
interface ChannelListProps {
data?: any;
@@ -103,7 +114,6 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
const [claudeModels, setClaudeModels] = useState<string[]>([]);
const [claudeReasoningOptions, setClaudeReasoningOptions] = useState<Record<string, { value: string; label: string }[]>>({});
const [codexModels, setCodexModels] = useState<string[]>([]);
- const [selectedModels, setSelectedModels] = useState<Record<string, string>>({});
const [guilds, setGuilds] = useState<any[]>([]);
const [selectedGuildIds, setSelectedGuildIds] = useState<string[]>(getDiscordGuildAllowlist(data));
const [selectedGuild, setSelectedGuild] = useState<string>(getDiscordGuildAllowlist(data)[0] || '');
@@ -117,6 +127,15 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
const [telegramSummary, setTelegramSummary] = useState<TelegramDiscoverySummary | null>(null);
// Directory browser state — tracks which channel's cwd picker is open
const [browsingCwdFor, setBrowsingCwdFor] = useState<string | null>(null);
+ // Page-mode tab/search/collapse state (only used when isPage is true)
+ const [pageTab, setPageTab] = useState<string>('all');
+ const [searchQuery, setSearchQuery] = useState('');
+ const [expandedChannelId, setExpandedChannelId] = useState<string | null>(null);
+ const [showInactive, setShowInactive] = useState(true);
+ // All-channels aggregation: keyed by platform
+ const [allChannelsByPlatform, setAllChannelsByPlatform] = useState<Record<string, any[]>>({});
+ const [allConfigsByPlatform, setAllConfigsByPlatform] = useState<Record<string, Record<string, ChannelConfig>>>({});
+ const [allLoading, setAllLoading] = useState(false);
const applySelectedGuildIds = (allowlist: string[]) => {
const normalized = [...allowlist];
@@ -500,20 +519,6 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
});
}, [channels, configs, config.runtime?.default_cwd, config.agents?.default_backend, config.agents?.opencode?.enabled, config.agents?.claude?.enabled, config.agents?.codex?.enabled]);
- useEffect(() => {
- if (!channels.length) return;
- setSelectedModels((prev) => {
- const next = { ...prev };
- channels.forEach((channel) => {
- const model = configs[channel.id]?.routing?.opencode_model || '';
- if (next[channel.id] !== model) {
- next[channel.id] = model;
- }
- });
- return next;
- });
- }, [channels, configs]);
-
const isChannelEnabled = (channelId: string) => {
const channel = configs[channelId];
return channel ? channel.enabled !== false : false;
@@ -569,58 +574,156 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
require_mention: null,
});
- const getReasoningOptions = (cwd: string, modelKey: string) => {
- const lookup = opencodeOptionsByCwd[cwd]?.reasoning_options || {};
- if (lookup && typeof lookup === 'object') {
- return (lookup as Record<string, { value: string; label: string }[]>)[modelKey] || [];
+ const selectedCount = channels.filter((channel) => isChannelEnabled(channel.id)).length;
+
+ // ---- Page-mode all-platforms aggregation ----
+ const updateConfigForPlatform = async (
+ platformId: string,
+ channelId: string,
+ patch: Partial<ChannelConfig>
+ ) => {
+ const platformConfigs = (allConfigsByPlatform[platformId] || (platformId === platform ? configs : {})) as Record<
+ string,
+ ChannelConfig
+ >;
+ const base = platformConfigs[channelId] || defaultConfig();
+ const next = { ...base, ...patch };
+ if (!next.show_message_types) {
+ next.show_message_types = defaultConfig().show_message_types;
+ }
+ if (!next.routing || typeof next.routing !== 'object') {
+ next.routing = { agent_backend: config.agents?.default_backend || 'opencode' };
+ }
+ const nextPlatformConfigs = { ...platformConfigs, [channelId]: next };
+ setAllConfigsByPlatform((prev) => ({ ...prev, [platformId]: nextPlatformConfigs }));
+ if (platformId === platform) {
+ setConfigs(nextPlatformConfigs);
+ }
+ if (!isPage) return;
+ try {
+ await api.saveSettings({ channels: nextPlatformConfigs }, platformId);
+ showToast(t('channelList.settingsSaved'));
+ } catch {
+ showToast(t('channelList.settingsSaveFailed'), 'error');
}
- return [];
};
- const getClaudeReasoningOptions = (model: string) => {
- const modelKey = model || '';
- const cached = claudeReasoningOptions[modelKey];
- if (cached?.length) return cached;
-
- const fallback = claudeReasoningOptions[''] || [];
- const normalizedModel = modelKey.toLowerCase();
- if (normalizedModel.includes('claude-opus-4-7') || normalizedModel === 'opus' || normalizedModel === 'opus[1m]') {
- const options = [...fallback];
- if (!options.some((option) => option.value === 'xhigh')) {
- options.push({ value: 'xhigh', label: 'Extra High' });
- }
- if (!options.some((option) => option.value === 'max')) {
- options.push({ value: 'max', label: 'Max' });
+ const loadAllPlatformsData = async () => {
+ if (!isPage) return;
+ const platforms = getEnabledPlatforms(config).filter((p) => platformSupportsChannels(config, p));
+ if (platforms.length === 0) return;
+ setAllLoading(true);
+ try {
+ const results = await Promise.all(
+ platforms.map(async (p) => {
+ let channelsList: any[] = [];
+ let configsMap: Record<string, ChannelConfig> = {};
+ try {
+ const settings = await api.getSettings(p);
+ configsMap = (settings.channels || {}) as Record<string, ChannelConfig>;
+ if (p === 'lark') {
+ const appId = config.lark?.app_id || '';
+ const appSecret = config.lark?.app_secret || '';
+ const domain = config.lark?.domain || 'feishu';
+ if (appId && appSecret) {
+ const result = await api.larkChats(appId, appSecret, domain);
+ if (result.ok) channelsList = result.channels || [];
+ }
+ } else if (p === 'telegram') {
+ if (config.telegram?.bot_token) {
+ const result = await api.telegramChats(false);
+ if (result.ok) channelsList = result.channels || [];
+ }
+ } else if (p === 'discord') {
+ const allowlist = getDiscordGuildAllowlist(settings);
+ const guildId = allowlist[0] || selectedGuildIdsRef.current[0] || selectedGuild;
+ const token = config.discord?.bot_token || '';
+ if (guildId && token) {
+ const result = await api.discordChannels(token, guildId);
+ if (result.ok) {
+ channelsList = (result.channels || []).filter((c: any) => c.type === 0 || c.type === 5);
+ }
+ }
+ } else if (p === 'slack') {
+ if (config.slack?.bot_token) {
+ const result = await api.slackChannels(config.slack.bot_token, false);
+ if (result.ok) channelsList = result.channels || [];
+ }
+ }
+ } catch {
+ // ignore individual platform failures
+ }
+ return { platform: p, channels: channelsList, configs: configsMap };
+ })
+ );
+ const channelsByPlatform: Record<string, any[]> = {};
+ const configsByPlatform: Record<string, Record<string, ChannelConfig>> = {};
+ for (const r of results) {
+ channelsByPlatform[r.platform] = r.channels;
+ configsByPlatform[r.platform] = r.configs;
}
- return options;
- }
- if (normalizedModel.includes('claude-opus-4-6') || normalizedModel.includes('claude-sonnet-4-6')) {
- return fallback.some((option) => option.value === 'max')
- ? fallback
- : [...fallback, { value: 'max', label: 'Max' }];
+ setAllChannelsByPlatform(channelsByPlatform);
+ setAllConfigsByPlatform(configsByPlatform);
+ } finally {
+ setAllLoading(false);
}
-
- return fallback;
};
- const getReasoningLabel = (value: string, fallback: string) => {
- switch (value) {
- case 'low':
- return t('channelList.reasoningLow');
- case 'medium':
- return t('channelList.reasoningMedium');
- case 'high':
- return t('channelList.reasoningHigh');
- case 'xhigh':
- return t('channelList.reasoningXHigh');
- case 'max':
- return t('channelList.reasoningMax');
- default:
- return fallback;
+ // Load aggregated data on first All-tab activation, and refresh when config keys change
+ useEffect(() => {
+ if (!isPage) return;
+ if (pageTab !== 'all') return;
+ void loadAllPlatformsData();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [
+ isPage,
+ pageTab,
+ config.slack?.bot_token,
+ config.discord?.bot_token,
+ config.telegram?.bot_token,
+ config.lark?.app_id,
+ config.lark?.app_secret,
+ ]);
+
+ // When the user picks a per-platform tab, sync pagePlatform so existing flow loads it
+ useEffect(() => {
+ if (!isPage) return;
+ if (pageTab === 'all') return;
+ if (pageTab !== pagePlatform) {
+ setPagePlatform(pageTab);
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isPage, pageTab]);
+
+ type AggregatedRow = {
+ platform: string;
+ channel: any;
+ config: ChannelConfig;
};
- const selectedCount = channels.filter((channel) => isChannelEnabled(channel.id)).length;
+ const platformChannelCounts = useMemo(() => {
+ const counts: Record<string, { total: number; active: number }> = {};
+ const platforms = getEnabledPlatforms(config).filter((p) => platformSupportsChannels(config, p));
+ for (const p of platforms) {
+ const channelList = p === platform ? channels : allChannelsByPlatform[p] || [];
+ const configMap = p === platform ? configs : allConfigsByPlatform[p] || {};
+ const total = channelList.length;
+ const active = channelList.filter((c: any) => configMap[c.id]?.enabled !== false && configMap[c.id]?.enabled !== undefined && configMap[c.id]?.enabled).length;
+ counts[p] = { total, active };
+ }
+ return counts;
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [config, platform, channels, configs, allChannelsByPlatform, allConfigsByPlatform]);
+
+ const allTabCounts = useMemo(() => {
+ let total = 0;
+ let active = 0;
+ for (const key of Object.keys(platformChannelCounts)) {
+ total += platformChannelCounts[key].total;
+ active += platformChannelCounts[key].active;
+ }
+ return { total, active };
+ }, [platformChannelCounts]);
// Sort channels: enabled channels first
const sortedChannels = React.useMemo(() => {
@@ -663,23 +766,40 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
// In wizard mode, skip channel step entirely
if (!isPage) {
return (
- <div className="flex flex-col h-full items-center justify-center">
- <div className="w-16 h-16 bg-accent/10 text-accent rounded-full flex items-center justify-center border border-accent/20 mb-6">
- <MessageSquare size={32} />
- </div>
- <h2 className="text-2xl font-display font-bold text-text mb-2">{t('channelList.title')}</h2>
- <p className="text-muted mb-8">{t('wechat.noChannels')}</p>
- <div className="mt-auto flex justify-between w-full">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium">
- {t('common.back')}
- </button>
- <button
- onClick={() => onNext && onNext({})}
- className="px-6 py-2 bg-accent hover:bg-accent/90 text-white rounded-lg font-medium shadow-sm"
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Groups</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('channelList.title')}
+ </h2>
+ <p className="text-[14px] leading-[1.55] text-muted">{t('wechat.noChannels')}</p>
+ </div>
+ <div className="flex flex-col items-center gap-3 rounded-xl border border-cyan/30 bg-cyan/[0.06] px-6 py-10 text-center">
+ <div className="flex size-14 items-center justify-center rounded-full border border-cyan/30 bg-cyan/[0.08] text-cyan">
+ <MessageSquare size={26} />
+ </div>
+ <p className="text-[12px] text-muted">{t('wechat.noChannels')}</p>
+ </div>
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() => onNext && onNext({})}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
}
@@ -693,7 +813,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<p className="text-muted">{t('wechat.noChannels')}</p>
</div>
</div>
- <div className="bg-panel border border-border rounded-xl p-8 text-center shadow-sm">
+ <div className="rounded-2xl border border-border bg-surface-2/40 p-8 text-center shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)]">
<div className="w-16 h-16 bg-accent/10 text-accent rounded-full flex items-center justify-center border border-accent/20 mx-auto mb-4">
<MessageSquare size={32} />
</div>
@@ -710,25 +830,519 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
);
}
+ // ====================================================================
+ // PAGE MODE: redesigned layout (matches design.pen frame A7h8Wv)
+ // - Header with title + 240px search + Rescan
+ // - Tabs row (All channels + per-platform with PlatformIcon + counts)
+ // - Per-tab notes (Discord guild picker, Telegram discovery info)
+ // - List header (count summary + Show inactive toggle)
+ // - Collapsible channel rows with platform-colored icon box + status badge
+ // ====================================================================
+ if (isPage) {
+ const tabPlatforms = getEnabledPlatforms(config).filter((p) => platformSupportsChannels(config, p));
+
+ const buildRowsForPlatform = (p: string): AggregatedRow[] => {
+ const channelList = p === platform ? channels : (allChannelsByPlatform[p] || []);
+ const configsMap = p === platform ? configs : (allConfigsByPlatform[p] || {});
+ return channelList.map((c: any) => ({
+ platform: p,
+ channel: c,
+ config: configsMap[c.id] || defaultConfig(),
+ }));
+ };
+
+ const rawRows: AggregatedRow[] = pageTab === 'all'
+ ? tabPlatforms.flatMap(buildRowsForPlatform)
+ : buildRowsForPlatform(pageTab);
+
+ const lowerQuery = searchQuery.trim().toLowerCase();
+ const visibleRows = rawRows
+ .filter((r) => {
+ const enabled = r.config.enabled === true;
+ if (!showInactive && !enabled) return false;
+ if (!lowerQuery) return true;
+ const name = String(r.channel.name || r.channel.id || '').toLowerCase();
+ const id = String(r.channel.id || '').toLowerCase();
+ return name.includes(lowerQuery) || id.includes(lowerQuery);
+ })
+ .sort((a, b) => {
+ const aOn = a.config.enabled === true;
+ const bOn = b.config.enabled === true;
+ if (aOn !== bOn) return aOn ? -1 : 1;
+ return String(a.channel.name || a.channel.id).localeCompare(String(b.channel.name || b.channel.id));
+ });
+
+ const handleRescan = () => {
+ if (pageTab === 'all') {
+ void loadAllPlatformsData();
+ } else {
+ void loadChannels(false);
+ }
+ };
+
+ const summary = pageTab === 'all'
+ ? { active: allTabCounts.active, total: allTabCounts.total }
+ : platformChannelCounts[pageTab] || { active: 0, total: 0 };
+
+ const isRescanLoading = pageTab === 'all' ? allLoading : (loading || loadingAll);
+
+ return (
+ <>
+ <div className="flex h-full flex-col gap-5">
+ {/* Page header — design.pen iXX59 */}
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="flex flex-col gap-1.5">
+ <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('channelList.title')}
+ </h1>
+ <p className="text-[14px] leading-[1.55] text-muted">{t('channelList.subtitle')}</p>
+ </div>
+ <div className="flex items-center gap-2">
+ <div className="relative">
+ <Search size={14} className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted" />
+ <input
+ type="search"
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ placeholder={t('channelList.filterPlaceholder')}
+ className="h-9 w-[240px] rounded-lg border border-border bg-surface pl-9 pr-3 text-[13px] text-foreground placeholder:text-muted focus:border-mint/50 focus:outline-none"
+ />
+ </div>
+ <button
+ type="button"
+ onClick={handleRescan}
+ disabled={isRescanLoading}
+ className="inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[13px] font-medium text-foreground transition-colors hover:border-border-strong disabled:opacity-50"
+ >
+ <RefreshCw size={14} className={isRescanLoading ? 'animate-spin' : ''} />
+ {t('channelList.rescan')}
+ </button>
+ </div>
+ </div>
+
+ {/* Platform Tabs — design.pen O2hb2M */}
+ <div className="flex flex-wrap items-end gap-1 border-b border-border">
+ <button
+ type="button"
+ onClick={() => setPageTab('all')}
+ className={clsx(
+ '-mb-px flex items-center gap-2 border-b-2 px-3 pb-2.5 pt-2 text-[13px] font-medium transition-colors',
+ pageTab === 'all'
+ ? 'border-mint text-foreground'
+ : 'border-transparent text-muted hover:text-foreground'
+ )}
+ >
+ <Globe size={16} className={pageTab === 'all' ? 'text-mint' : 'text-muted'} />
+ <span>{t('channelList.allChannelsTab')}</span>
+ <span
+ className={clsx(
+ 'rounded-full px-1.5 py-0.5 font-mono text-[10px]',
+ pageTab === 'all' ? 'bg-mint-soft text-mint' : 'bg-white/[0.06] text-muted'
+ )}
+ >
+ {allTabCounts.active}
+ </span>
+ </button>
+ {tabPlatforms.map((p) => {
+ const counts = platformChannelCounts[p] || { active: 0, total: 0 };
+ const active = pageTab === p;
+ return (
+ <button
+ key={p}
+ type="button"
+ onClick={() => setPageTab(p)}
+ className={clsx(
+ '-mb-px flex items-center gap-2 border-b-2 px-3 pb-2.5 pt-2 text-[13px] font-medium transition-colors',
+ active
+ ? 'border-mint text-foreground'
+ : 'border-transparent text-muted hover:text-foreground'
+ )}
+ >
+ <PlatformIcon platform={p} size={16} />
+ <span>{t(`platform.${p}.title`)}</span>
+ <span
+ className={clsx(
+ 'rounded-full px-1.5 py-0.5 font-mono text-[10px]',
+ active ? 'bg-mint-soft text-mint' : 'bg-white/[0.06] text-muted'
+ )}
+ >
+ {counts.active}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+
+ {/* Discord guild picker — only on Discord tab */}
+ {pageTab === 'discord' && (
+ <div className="rounded-xl border border-border bg-surface-2/40 p-3 text-sm shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)]">
+ <div className="grid gap-3 md:grid-cols-[minmax(220px,280px)_1fr]">
+ <div className="space-y-1">
+ <label className="font-medium text-foreground">{t('channelList.guildBrowse')}</label>
+ <select
+ value={selectedGuild}
+ onChange={(e) => updateSelectedGuild(e.target.value)}
+ className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-foreground focus:border-cyan focus:outline-none"
+ >
+ <option value="">{t('channelList.guildPlaceholder')}</option>
+ {knownDiscordGuilds.map((g) => (
+ <option key={g.id} value={g.id}>{g.name}</option>
+ ))}
+ </select>
+ </div>
+ <div className="space-y-2">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <span className="font-medium text-foreground">{t('channelList.guildAccess')}</span>
+ <span className="text-xs text-muted">
+ {t('channelList.guildAccessCount', { count: selectedGuildIds.length })}
+ </span>
+ </div>
+ {knownDiscordGuilds.length > 0 && (
+ <div className="flex flex-wrap gap-2">
+ {knownDiscordGuilds.map((g) => (
+ <label
+ key={g.id}
+ className={clsx(
+ 'inline-flex items-center gap-2 rounded-lg border px-2 py-1 text-xs transition-colors',
+ selectedGuildIds.includes(g.id)
+ ? 'border-mint/40 bg-mint-soft text-foreground'
+ : 'border-border bg-surface text-muted hover:text-foreground'
+ )}
+ >
+ <input
+ type="checkbox"
+ checked={selectedGuildIds.includes(g.id)}
+ onChange={(e) => toggleAllowedGuild(g.id, e.target.checked)}
+ className="h-3.5 w-3.5 accent-accent"
+ />
+ <span>{g.name}</span>
+ </label>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ )}
+
+ {/* Telegram discovery info — only on Telegram tab */}
+ {pageTab === 'telegram' && (
+ <div className="rounded-xl border border-cyan/30 bg-cyan-soft/20 p-3">
+ <div className="text-sm font-medium text-foreground">{t('channelList.telegramDiscoveryTitle')}</div>
+ <div className="mt-1 text-sm text-muted">{t('channelList.telegramDiscoveryInfo')}</div>
+ <div className="mt-2 text-xs text-muted">
+ {t('channelList.telegramDiscoveryStats', {
+ visible: telegramSummary?.visible_count || 0,
+ forum: telegramSummary?.forum_count || 0,
+ hidden: telegramSummary?.hidden_private_count || 0,
+ })}
+ </div>
+ </div>
+ )}
+
+ {/* Browse all + Can't find hint — per-platform tabs only */}
+ {pageTab !== 'all' && (
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2 px-0.5">
+ {!['lark', 'telegram'].includes(pageTab) && (
+ <button
+ type="button"
+ onClick={() => loadChannels(true)}
+ disabled={loadingAll}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 py-1.5 text-[12px] font-medium text-foreground transition-colors hover:border-cyan/40 disabled:opacity-50"
+ >
+ <Globe size={13} className={loadingAll ? 'animate-spin' : ''} />
+ {loadingAll ? t('common.loading') : t('channelList.browseAll')}
+ </button>
+ )}
+ {browseAll && pageTab === platform && (
+ <span className="text-[11px] text-muted">{t('channelList.showingAll')}</span>
+ )}
+ <span className="group relative inline-flex">
+ <span className="flex cursor-help items-center gap-1 text-[12px] text-muted">
+ <HelpCircle size={13} />
+ {t('channelList.cantFindChannel')}
+ </span>
+ <span className="pointer-events-none absolute bottom-full left-0 z-10 mb-2 w-64 whitespace-normal rounded bg-text px-3 py-2 text-xs text-bg opacity-0 shadow-lg transition-opacity group-hover:opacity-100">
+ {pageTab === 'discord'
+ ? t('channelList.discordInviteBotHint')
+ : pageTab === 'lark'
+ ? t('channelList.larkInviteBotHint')
+ : pageTab === 'telegram'
+ ? t('channelList.telegramInviteBotHint')
+ : t('channelList.inviteBotHint')}
+ </span>
+ </span>
+ </div>
+ )}
+
+ {/* List header — design.pen xQq1G */}
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="text-[13px] text-muted">
+ {pageTab === 'all'
+ ? t('channelList.headerSummary', { active: summary.active, discovered: summary.total })
+ : t('channelList.headerSummaryPlatform', {
+ platform: t(`platform.${pageTab}.title`),
+ active: summary.active,
+ discovered: summary.total,
+ })}
+ </div>
+ <label className="inline-flex cursor-pointer items-center gap-2">
+ <span className="text-[12px] text-muted">{t('channelList.showInactive')}</span>
+ <input
+ type="checkbox"
+ checked={showInactive}
+ onChange={(e) => setShowInactive(e.target.checked)}
+ className="sr-only"
+ />
+ <span
+ className={clsx(
+ 'relative inline-flex h-[18px] w-[30px] items-center rounded-full transition-colors',
+ showInactive ? 'bg-mint' : 'bg-neutral-300'
+ )}
+ >
+ <span
+ className={clsx(
+ 'inline-block h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-transform',
+ showInactive ? 'translate-x-[14px]' : 'translate-x-0.5'
+ )}
+ />
+ </span>
+ </label>
+ </div>
+
+ {/* Channel rows — design.pen JrNBe / M8FRiG / KywfU */}
+ <div className="flex-1 space-y-3 overflow-y-auto">
+ {visibleRows.length === 0 && (
+ <div className="rounded-xl border border-dashed border-border bg-surface-3/60 p-8 text-center text-muted">
+ {searchQuery
+ ? t('channelList.noChannelsForSearch')
+ : pageTab === 'discord' && !selectedGuild
+ ? t('channelList.discordNeedsGuild')
+ : t('channelList.noChannelsLoaded')}
+ </div>
+ )}
+ {visibleRows.map((row) => {
+ const channel = row.channel;
+ const channelPlatform = row.platform;
+ const rawConfig = row.config;
+ const def = defaultConfig();
+ const defaultBackend = config.agents?.default_backend || 'opencode';
+ const channelEnabled = rawConfig.enabled === true;
+ const channelConfig = {
+ ...def,
+ ...rawConfig,
+ enabled: channelEnabled,
+ show_message_types: rawConfig.show_message_types || def.show_message_types,
+ custom_cwd: rawConfig.custom_cwd ?? def.custom_cwd,
+ routing: { ...def.routing, ...(rawConfig.routing || {}) },
+ require_mention: rawConfig.require_mention !== undefined ? rawConfig.require_mention : def.require_mention,
+ };
+ const rowKey = `${channelPlatform}::${channel.id}`;
+ const expanded = expandedChannelId === rowKey;
+ const effectiveBackend = channelConfig.routing.agent_backend || defaultBackend;
+ const effectiveCwd = channelConfig.custom_cwd || config.runtime?.default_cwd || '~/work';
+ const opencodeOptions = opencodeOptionsByCwd[effectiveCwd];
+ const claudeAgents = claudeAgentsByCwd[effectiveCwd] || [];
+ const codexAgents = codexAgentsByCwd[effectiveCwd] || [];
+
+ const updateRow = (patch: Partial<ChannelConfig>) => {
+ void updateConfigForPlatform(channelPlatform, channel.id, patch);
+ };
+
+ const backendModel = effectiveBackend === 'claude'
+ ? channelConfig.routing.claude_model
+ : effectiveBackend === 'codex'
+ ? channelConfig.routing.codex_model
+ : channelConfig.routing.opencode_model;
+
+ return (
+ <div
+ key={rowKey}
+ className={clsx(
+ 'rounded-xl border transition-colors',
+ expanded
+ ? 'border-mint/30 bg-surface-2/70 shadow-[0_0_32px_-8px_rgba(91,255,160,0.45)]'
+ : 'border-border bg-background hover:border-border-strong'
+ )}
+ >
+ {/* Top row */}
+ <button
+ type="button"
+ onClick={() => setExpandedChannelId(expanded ? null : rowKey)}
+ className="flex w-full items-center gap-3.5 px-5 py-3.5 text-left"
+ >
+ {/* Toggle */}
+ <span
+ role="switch"
+ aria-checked={channelEnabled}
+ tabIndex={0}
+ onClick={(e) => {
+ e.stopPropagation();
+ updateRow({ enabled: !channelEnabled });
+ }}
+ onKeyDown={(e) => {
+ if (e.key === ' ' || e.key === 'Enter') {
+ e.preventDefault();
+ e.stopPropagation();
+ updateRow({ enabled: !channelEnabled });
+ }
+ }}
+ className={clsx(
+ 'relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors',
+ channelEnabled ? 'bg-mint' : 'bg-neutral-300'
+ )}
+ >
+ <span
+ className={clsx(
+ 'inline-block h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-transform',
+ channelEnabled ? 'translate-x-[14px]' : 'translate-x-0.5'
+ )}
+ />
+ </span>
+
+ {/* Platform-tinted icon box */}
+ <span
+ className="flex size-[34px] shrink-0 items-center justify-center rounded-md border"
+ style={platformBoxStyle(channelPlatform)}
+ >
+ <PlatformIcon platform={channelPlatform} size={18} />
+ </span>
+
+ {/* Name + meta */}
+ <span className="min-w-0 flex-1">
+ <span className="block truncate font-mono text-[13px] font-semibold text-foreground">
+ {channel.name || channel.id}
+ </span>
+ <span className="block truncate text-[11px] text-muted">
+ {channelEnabled
+ ? `${effectiveBackend === 'claude' ? 'Claude' : effectiveBackend === 'codex' ? 'Codex' : 'OpenCode'}${backendModel ? ` / ${backendModel}` : ''} · ID: ${channel.id}`
+ : `ID: ${channel.id}`}
+ </span>
+ </span>
+
+ {/* Status badge */}
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11px] font-medium',
+ channelEnabled
+ ? 'border-mint/40 bg-mint-soft text-mint'
+ : 'border-border bg-white/[0.04] text-muted'
+ )}
+ >
+ <span
+ className={clsx(
+ 'size-1.5 rounded-full',
+ channelEnabled ? 'bg-mint shadow-[0_0_6px_rgba(91,255,160,0.7)]' : 'bg-muted'
+ )}
+ />
+ {channelEnabled ? t('common.enabled') : t('common.disabled')}
+ </span>
+
+ {/* Chevron */}
+ {expanded ? (
+ <ChevronUp size={18} className="shrink-0 text-muted" />
+ ) : (
+ <ChevronDown size={18} className="shrink-0 text-muted" />
+ )}
+ </button>
+
+ {/* Expanded body — design.pen asPXu (VR/RoutingConfig) — shared with /users */}
+ {expanded && (
+ <RoutingConfigPanel
+ value={channelConfig}
+ onChange={(patch) => updateRow(patch)}
+ onBrowseDirectory={() => setBrowsingCwdFor(rowKey)}
+ globalConfig={config}
+ showRequireMention={true}
+ inheritsFromKey={channelPlatform}
+ opencodeOptions={opencodeOptions}
+ claudeAgents={claudeAgents}
+ claudeModels={claudeModels}
+ claudeReasoningOptions={claudeReasoningOptions}
+ codexAgents={codexAgents}
+ codexModels={codexModels}
+ />
+ )}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+
+ {/* Directory browser modal — page mode keys by `${platform}::${channelId}` */}
+ {browsingCwdFor && (() => {
+ const sep = browsingCwdFor.indexOf('::');
+ if (sep < 0) return null;
+ const browsePlatform = browsingCwdFor.slice(0, sep);
+ const browseChannelId = browsingCwdFor.slice(sep + 2);
+ const platformConfigs = browsePlatform === platform ? configs : (allConfigsByPlatform[browsePlatform] || {});
+ return (
+ <DirectoryBrowser
+ initialPath={platformConfigs[browseChannelId]?.custom_cwd || config.runtime?.default_cwd || '~/work'}
+ onSelect={(path) => {
+ void updateConfigForPlatform(browsePlatform, browseChannelId, { custom_cwd: path });
+ setBrowsingCwdFor(null);
+ }}
+ onClose={() => setBrowsingCwdFor(null)}
+ />
+ );
+ })()}
+ </>
+ );
+ }
+
+ const Wrapper: React.FC<{ children: React.ReactNode }> = ({ children }) =>
+ isPage ? (
+ <div className="flex h-full flex-col mx-auto max-w-6xl">{children}</div>
+ ) : (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">{children}</WizardCard>
+ </div>
+ );
+
return (
<>
- <div className={clsx('flex flex-col h-full', isPage ? 'max-w-5xl mx-auto' : '')}>
- <div className="flex justify-between items-center mb-6">
+ <Wrapper>
+ <div className={clsx('space-y-4', !isPage && 'space-y-2')}>
<div>
- <h2 className={clsx('font-display font-bold', isPage ? 'text-3xl' : 'text-2xl')}>{t('channelList.title')}</h2>
- <p className="text-muted">{t('channelList.subtitle')}</p>
+ {!isPage && <EyebrowBadge tone="mint">Groups</EyebrowBadge>}
+ <h2
+ className={clsx(
+ 'font-bold tracking-[-0.4px] text-foreground',
+ isPage ? 'text-3xl font-semibold tracking-tight' : 'mt-2 text-[28px] leading-tight'
+ )}
+ >
+ {t('channelList.title')}
+ </h2>
+ <p className={clsx('text-muted', isPage ? '' : 'mt-2 max-w-[560px] text-[14px] leading-[1.55]')}>
+ {t('channelList.subtitle')}
+ </p>
</div>
+
+ {isPage && (
+ <div className="flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-surface-2/40 px-4 py-3 text-sm text-muted shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)]">
+ <span className="rounded-full border border-mint/40 bg-mint-soft px-2.5 py-1 text-xs font-medium text-mint">
+ {t('channelList.enabledCount', { count: selectedCount })}
+ </span>
+ <span>{t('dashboard.metricGroupsHint', { count: channels.length })}</span>
+ <span className="hidden h-1 w-1 rounded-full bg-border md:inline-block" />
+ <span className="font-mono text-xs uppercase tracking-[0.18em]">{t(`platform.${platform}.title`)}</span>
+ </div>
+ )}
</div>
{((isPage && channelPlatforms.length > 1) || isWizardMultiPlatform) && (
- <div className="mb-4 flex flex-wrap gap-2">
+ <div className="flex flex-wrap gap-2">
{(isWizardMultiPlatform ? wizardPlatforms! : channelPlatforms).map((candidate) => (
<button
key={candidate}
+ type="button"
onClick={() => isWizardMultiPlatform ? switchWizardPlatform(candidate) : setPagePlatform(candidate)}
className={clsx(
- 'px-3 py-1.5 rounded-full text-sm border transition-colors',
- platform === candidate ? 'bg-accent text-white border-accent' : 'bg-panel text-text border-border hover:border-accent/60'
+ 'rounded-full border px-3 py-1.5 text-[12px] font-medium transition-colors',
+ platform === candidate
+ ? 'border-mint/50 bg-mint/[0.16] text-mint shadow-[0_0_20px_-4px_rgba(91,255,160,0.4)]'
+ : 'border-border bg-white/[0.04] text-foreground hover:border-border-strong'
)}
>
{t(`platform.${candidate}.title`)}
@@ -739,10 +1353,10 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
{/* Platform-level require @mention toggle (page mode only) */}
{isPage && (
- <div className="mb-4 bg-panel border border-border p-3 rounded-lg flex items-center justify-between">
- <div className="flex items-center gap-2 text-sm">
+ <div className="mb-4 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-xl border border-border bg-surface-2/40 p-3 shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)]">
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
<AtSign size={14} className="text-accent" />
- <span className="font-medium text-text">{t('dashboard.requireMention')}</span>
+ <span className="font-medium text-foreground">{t('dashboard.requireMention')}</span>
<span className="text-xs text-muted">{t('dashboard.requireMentionHint')}</span>
</div>
<button
@@ -780,12 +1394,12 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
</div>
)}
- <div className="mb-4 bg-panel border border-border p-4 rounded-lg space-y-3">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-4">
+ <div className="mb-4 space-y-3 rounded-2xl border border-border bg-surface-2/40 p-4 shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)]">
+ <div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
<button
onClick={() => loadChannels(browseAll)}
- className="flex items-center gap-2 px-3 py-1.5 bg-neutral-100 hover:bg-neutral-200 text-text rounded text-sm font-medium transition-colors"
+ className="flex items-center gap-2 rounded-lg border border-border bg-surface-3/60 px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:border-cyan/40 hover:bg-surface-2/70"
>
<RefreshCw size={14} className={loading ? 'animate-spin' : ''} /> {t('channelList.refreshList')}
</button>
@@ -793,7 +1407,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<button
onClick={() => loadChannels(true)}
disabled={loadingAll}
- className="flex items-center gap-2 px-3 py-1.5 bg-neutral-100 hover:bg-neutral-200 text-text rounded text-sm font-medium transition-colors disabled:opacity-50"
+ className="flex items-center gap-2 rounded-lg border border-border bg-surface-3/60 px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:border-cyan/40 hover:bg-surface-2/70 disabled:opacity-50"
>
<Globe size={14} className={loadingAll ? 'animate-spin' : ''} />
{loadingAll ? t('common.loading') : t('channelList.browseAll')}
@@ -824,14 +1438,14 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<span className="text-sm text-muted font-mono">{t('channelList.enabledCount', { count: selectedCount })}</span>
</div>
{platform === 'discord' && (
- <div className="rounded-lg border border-border bg-panel p-3 text-sm">
+ <div className="rounded-xl border border-border bg-surface-3/60 p-3 text-sm">
<div className="grid gap-3 md:grid-cols-[minmax(220px,280px)_1fr]">
<div className="space-y-1">
- <label className="font-medium text-text">{t('channelList.guildBrowse')}</label>
+ <label className="font-medium text-foreground">{t('channelList.guildBrowse')}</label>
<select
value={selectedGuild}
onChange={(e) => updateSelectedGuild(e.target.value)}
- className="w-full bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text"
+ className="w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-foreground focus:outline-none focus:border-cyan"
>
<option value="">{t('channelList.guildPlaceholder')}</option>
{knownDiscordGuilds.map((g) => (
@@ -841,7 +1455,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
</div>
<div className="space-y-2">
<div className="flex flex-wrap items-center justify-between gap-2">
- <span className="font-medium text-text">{t('channelList.guildAccess')}</span>
+ <span className="font-medium text-foreground">{t('channelList.guildAccess')}</span>
<span className="text-xs text-muted">
{t('channelList.guildAccessCount', { count: selectedGuildIds.length })}
</span>
@@ -852,11 +1466,11 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
<label
key={g.id}
className={clsx(
- 'inline-flex items-center gap-2 rounded border px-2 py-1 text-xs transition-colors',
- selectedGuildIds.includes(g.id)
- ? 'border-accent bg-accent/10 text-text'
- : 'border-border bg-bg text-muted hover:text-text'
- )}
+ 'inline-flex items-center gap-2 rounded-lg border px-2 py-1 text-xs transition-colors',
+ selectedGuildIds.includes(g.id)
+ ? 'border-mint/40 bg-mint-soft text-foreground'
+ : 'border-border bg-surface text-muted hover:text-foreground'
+ )}
>
<input
type="checkbox"
@@ -884,8 +1498,8 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
</div>
)}
{platform === 'telegram' && (
- <div className="rounded-lg border border-accent/20 bg-accent/5 p-3">
- <div className="text-sm font-medium text-text">{t('channelList.telegramDiscoveryTitle')}</div>
+ <div className="rounded-xl border border-cyan/30 bg-cyan-soft/20 p-3">
+ <div className="text-sm font-medium text-foreground">{t('channelList.telegramDiscoveryTitle')}</div>
<div className="mt-1 text-sm text-muted">{t('channelList.telegramDiscoveryInfo')}</div>
<div className="mt-2 text-xs text-muted">
{t('channelList.telegramDiscoveryStats', {
@@ -898,22 +1512,21 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
)}
</div>
- <div className="flex-1 overflow-y-auto border border-border rounded-xl divide-y divide-border bg-panel shadow-sm">
+ <div className="flex-1 overflow-y-auto rounded-2xl border border-border bg-surface-2/40 p-3 shadow-[0_18px_40px_-30px_rgba(0,0,0,0.8)] space-y-3">
{!loading && channels.length === 0 && !botToken && platform !== 'lark' && (
- <div className="p-8 text-center text-muted">
+ <div className="rounded-xl border border-dashed border-border bg-surface-3/60 p-8 text-center text-muted">
{t('channelList.addTokenFirst')}
</div>
)}
{!loading && channels.length === 0 && platform === 'telegram' && !!botToken && (
- <div className="p-8 text-center">
- <div className="text-sm font-medium text-text">{t('channelList.telegramDiscoveryEmptyTitle')}</div>
+ <div className="rounded-xl border border-dashed border-border bg-surface-3/60 p-8 text-center">
+ <div className="text-sm font-medium text-foreground">{t('channelList.telegramDiscoveryEmptyTitle')}</div>
<div className="mt-2 text-sm text-muted">{t('channelList.telegramDiscoveryEmptyDesc')}</div>
</div>
)}
{sortedChannels.map((channel) => {
const rawConfig = configs[channel.id] || {};
const def = defaultConfig();
- const defaultBackend = config.agents?.default_backend || 'opencode';
const channelConfig = {
...def,
...rawConfig,
@@ -927,14 +1540,12 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
// Preserve require_mention from rawConfig (can be null, true, or false)
require_mention: rawConfig.require_mention !== undefined ? rawConfig.require_mention : def.require_mention,
};
- const effectiveBackend = channelConfig.routing.agent_backend || defaultBackend;
-
const effectiveCwd = channelConfig.custom_cwd || config.runtime?.default_cwd || '~/work';
const opencodeOptions = opencodeOptionsByCwd[effectiveCwd];
const claudeAgents = claudeAgentsByCwd[effectiveCwd] || [];
const codexAgents = codexAgentsByCwd[effectiveCwd] || [];
return (
- <div key={channel.id} className="p-4 hover:bg-neutral-50/50 transition-colors">
+ <div key={channel.id} className="rounded-xl border border-border bg-surface-3/60 p-4 transition-colors hover:border-border-strong hover:bg-surface-2/70">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<button
@@ -944,7 +1555,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
{channelConfig.enabled ? <CheckSquare size={20} /> : <Square size={20} />}
</button>
<div>
- <div className="font-medium flex items-center gap-1 text-text">
+ <div className="flex items-center gap-1 font-medium text-foreground">
<Hash size={14} className="text-muted" /> {channel.name}
</div>
<div className="text-xs text-muted font-mono">ID: {channel.id}</div>
@@ -962,7 +1573,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
className={clsx(
'text-xs px-2 py-0.5 rounded-full border',
platform === 'discord'
- ? 'bg-neutral-100 text-text border-border'
+ ? 'bg-surface text-foreground border-border'
: platform === 'telegram'
? channel.supports_topics
? 'bg-accent/10 text-accent border-accent/20'
@@ -970,7 +1581,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
? 'bg-success/10 text-success border-success/20'
: channel.is_private
? 'bg-warning/10 text-warning border-warning/20'
- : 'bg-neutral-100 text-text border-border'
+ : 'bg-surface text-foreground border-border'
: channel.is_private
? 'bg-warning/10 text-warning border-warning/20'
: 'bg-success/10 text-success border-success/20'
@@ -993,338 +1604,21 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
</div>
{channelConfig.enabled && (
- <div className="mt-4 pl-8 space-y-4">
- {/* Basic Settings */}
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3">
- <div className="space-y-1">
- <label className="text-xs font-medium text-muted uppercase">{t('channelList.workingDirectory')}</label>
- <div className="flex gap-1.5">
- <BlurInput
- type="text"
- placeholder={config.runtime?.default_cwd || t('channelList.useGlobalDefault')}
- value={channelConfig.custom_cwd}
- onCommit={(v) => updateConfig(channel.id, { custom_cwd: v })}
- className="flex-1 bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text placeholder:text-muted/50 font-mono"
- />
- <button
- type="button"
- onClick={() => setBrowsingCwdFor(channel.id)}
- title={t('directoryBrowser.title')}
- className="px-2 py-2 bg-neutral-100 hover:bg-neutral-200 border border-border rounded text-muted hover:text-text transition-colors shrink-0"
- >
- <FolderOpen size={14} />
- </button>
- </div>
- </div>
- <div className="space-y-1">
- <label className="text-xs font-medium text-muted uppercase">{t('channelList.backend')}</label>
- <select
- value={effectiveBackend}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: { ...channelConfig.routing, agent_backend: e.target.value },
- })
- }
- className="w-full bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text"
- >
- <option value="opencode">OpenCode</option>
- <option value="claude">ClaudeCode</option>
- <option value="codex">Codex</option>
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs font-medium text-muted uppercase">{t('channelList.requireMention')}</label>
- <select
- value={channelConfig.require_mention === null || channelConfig.require_mention === undefined ? '' : channelConfig.require_mention ? 'true' : 'false'}
- onChange={(e) => {
- const val = e.target.value;
- updateConfig(channel.id, {
- require_mention: val === '' ? null : val === 'true',
- });
- }}
- className="w-full bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text"
- >
- <option value="">
- {t('common.default')} ({platform === 'discord'
- ? (config.discord?.require_mention ? t('channelList.mentionStatusOn') : t('channelList.mentionStatusOff'))
- : platform === 'telegram'
- ? (config.telegram?.require_mention ? t('channelList.mentionStatusOn') : t('channelList.mentionStatusOff'))
- : platform === 'lark'
- ? (config.lark?.require_mention ? t('channelList.mentionStatusOn') : t('channelList.mentionStatusOff'))
- : (config.slack?.require_mention ? t('channelList.mentionStatusOn') : t('channelList.mentionStatusOff'))})
- </option>
- <option value="true">{t('channelList.requireMentionOn')}</option>
- <option value="false">{t('channelList.requireMentionOff')}</option>
- </select>
- </div>
- </div>
-
- {/* Show Message Types */}
- <div className="space-y-2">
- <div className="text-xs font-medium text-muted uppercase flex items-center gap-1">
- {t('channelList.showMessageTypes')}
- <span className="relative group">
- <HelpCircle size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-0 mb-2 px-3 py-2 bg-text text-bg text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 w-64 whitespace-normal font-normal normal-case">
- {t('channelList.showMessageTypesHint')}
- </span>
- </span>
- </div>
- <div className="flex flex-wrap gap-3 text-sm">
- {['system', 'assistant', 'toolcall'].map((msgType) => {
- const checked = channelConfig.show_message_types.includes(msgType);
- return (
- <label key={msgType} className="flex items-center gap-2 text-text">
- <input
- type="checkbox"
- checked={checked}
- onChange={() => {
- const next = checked
- ? channelConfig.show_message_types.filter((value) => value !== msgType)
- : [...channelConfig.show_message_types, msgType];
- updateConfig(channel.id, { show_message_types: next });
- }}
- className="h-4 w-4 rounded border-border text-accent focus:ring-accent"
- />
- <span className="capitalize">{msgType === 'toolcall' ? 'Toolcall' : msgType}</span>
- </label>
- );
- })}
- </div>
- </div>
-
- {/* OpenCode Settings */}
- {effectiveBackend === 'opencode' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.opencodeSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={channelConfig.routing.opencode_agent || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: { ...channelConfig.routing, opencode_agent: e.target.value || null },
- })
- }
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {(opencodeOptions?.agents || []).map((agent: any) => (
- <option key={agent.name} value={agent.name}>{agent.name}</option>
- ))}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <select
- value={channelConfig.routing.opencode_model || ''}
- onChange={(e) => {
- const modelKey = e.target.value || '';
- setSelectedModels((prev) => ({ ...prev, [channel.id]: modelKey }));
- updateConfig(channel.id, {
- routing: {
- ...channelConfig.routing,
- opencode_model: modelKey || null,
- opencode_reasoning_effort: null,
- },
- });
- }}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {(opencodeOptions?.models?.providers || []).flatMap((provider: any) => {
- const providerId = provider.id || provider.provider_id || provider.name;
- const providerLabel = provider.name || providerId;
- const models = provider.models || {};
- if (Array.isArray(models)) {
- return models.map((model: any) => {
- const modelId = typeof model === 'string' ? model : model.id;
- return (
- <option key={`${providerId}:${modelId}`} value={`${providerId}/${modelId}`}>
- {providerLabel}/{modelId}
- </option>
- );
- });
- }
- return Object.keys(models).map((modelId) => (
- <option key={`${providerId}:${modelId}`} value={`${providerId}/${modelId}`}>
- {providerLabel}/{modelId}
- </option>
- ));
- })}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={channelConfig.routing.opencode_reasoning_effort || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: {
- ...channelConfig.routing,
- opencode_reasoning_effort: e.target.value || null,
- },
- })
- }
- disabled={!getReasoningOptions(
- effectiveCwd,
- selectedModels[channel.id] || channelConfig.routing.opencode_model || ''
- ).length}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm disabled:opacity-50"
- >
- <option value="">{t('common.default')}</option>
- {getReasoningOptions(
- effectiveCwd,
- selectedModels[channel.id] || channelConfig.routing.opencode_model || ''
- ).map((option) => (
- <option key={option.value} value={option.value}>
- {option.label}
- </option>
- ))}
- </select>
- </div>
- </div>
- </div>
- )}
-
- {/* Claude Settings */}
- {effectiveBackend === 'claude' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.claudeSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={channelConfig.routing.claude_agent || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: { ...channelConfig.routing, claude_agent: e.target.value || null },
- })
- }
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {claudeAgents.map((agent) => (
- <option key={agent.id} value={agent.id}>{agent.name}</option>
- ))}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <Combobox
- options={[
- { value: '', label: t('common.default') },
- ...claudeModels.map(m => ({ value: m, label: m }))
- ]}
- value={channelConfig.routing.claude_model || ''}
- onValueChange={(v) =>
- updateConfig(channel.id, {
- routing: {
- ...channelConfig.routing,
- claude_model: v || null,
- claude_reasoning_effort: null,
- },
- })
- }
- placeholder={t('channelList.claudeModelPlaceholder')}
- searchPlaceholder={t('channelList.searchModel')}
- allowCustomValue={true}
- />
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={channelConfig.routing.claude_reasoning_effort || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: {
- ...channelConfig.routing,
- claude_reasoning_effort: e.target.value || null,
- },
- })
- }
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {getClaudeReasoningOptions(channelConfig.routing.claude_model || '')
- .filter((option) => option.value !== '__default__')
- .map((option) => (
- <option key={option.value} value={option.value}>
- {getReasoningLabel(option.value, option.label)}
- </option>
- ))}
- </select>
- </div>
- </div>
- </div>
- )}
-
- {/* Codex Settings */}
- {effectiveBackend === 'codex' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.codexSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={channelConfig.routing.codex_agent || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: { ...channelConfig.routing, codex_agent: e.target.value || null },
- })
- }
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {codexAgents.map((agent) => (
- <option key={agent.id} value={agent.id}>{agent.name}</option>
- ))}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <Combobox
- options={[
- { value: '', label: t('common.default') },
- ...codexModels.map(m => ({ value: m, label: m }))
- ]}
- value={channelConfig.routing.codex_model || ''}
- onValueChange={(v) =>
- updateConfig(channel.id, {
- routing: { ...channelConfig.routing, codex_model: v || null },
- })
- }
- placeholder={t('channelList.codexModelPlaceholder')}
- searchPlaceholder={t('channelList.searchModel')}
- allowCustomValue={true}
- />
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={channelConfig.routing.codex_reasoning_effort || ''}
- onChange={(e) =>
- updateConfig(channel.id, {
- routing: {
- ...channelConfig.routing,
- codex_reasoning_effort: e.target.value || null,
- },
- })
- }
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- <option value="low">{t('channelList.reasoningLow')}</option>
- <option value="medium">{t('channelList.reasoningMedium')}</option>
- <option value="high">{t('channelList.reasoningHigh')}</option>
- <option value="xhigh">{t('channelList.reasoningXHigh')}</option>
- </select>
- </div>
- </div>
- </div>
- )}
- </div>
+ <RoutingConfigPanel
+ value={channelConfig}
+ onChange={(patch) => updateConfig(channel.id, patch)}
+ onBrowseDirectory={() => setBrowsingCwdFor(channel.id)}
+ globalConfig={config}
+ showRequireMention={true}
+ inheritsFromKey={platform}
+ opencodeOptions={opencodeOptions}
+ claudeAgents={claudeAgents}
+ claudeModels={claudeModels}
+ claudeReasoningOptions={claudeReasoningOptions}
+ codexAgents={codexAgents}
+ codexModels={codexModels}
+ containerClass="mt-4 pl-8"
+ />
)}
</div>
);
@@ -1337,11 +1631,17 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
</div>
{!isPage && (
- <div className="mt-6 flex justify-between">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium">
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
{t('common.back')}
</button>
<button
+ type="button"
onClick={() => {
const discordGuildAllowlist = selectedGuildIds;
if (isWizardMultiPlatform) {
@@ -1365,13 +1665,14 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
});
}
}}
- className="px-6 py-2 bg-accent hover:bg-accent/90 text-white rounded-lg font-medium shadow-sm"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105"
>
{t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
</button>
</div>
)}
- </div>
+ </Wrapper>
{/* Directory browser modal */}
{browsingCwdFor && (
diff --git a/ui/src/components/steps/DiscordConfig.tsx b/ui/src/components/steps/DiscordConfig.tsx
index 6770e9365..787363af5 100644
--- a/ui/src/components/steps/DiscordConfig.tsx
+++ b/ui/src/components/steps/DiscordConfig.tsx
@@ -1,10 +1,26 @@
import React, { useEffect, useMemo, useState } from 'react';
-import { Shield, RefreshCw, Check, Server, KeyRound, Plus, ExternalLink, Settings, ChevronDown, ChevronUp, Copy, AlertTriangle } from 'lucide-react';
+import {
+ Shield,
+ RefreshCw,
+ Check,
+ Server,
+ KeyRound,
+ Plus,
+ ExternalLink,
+ Settings,
+ ChevronDown,
+ ChevronUp,
+ Copy,
+ AlertTriangle,
+ ArrowLeft,
+ ArrowRight,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
+import { EyebrowBadge, WizardCard } from '../visual';
interface DiscordConfigProps {
data: any;
@@ -17,6 +33,8 @@ const getDiscordGuildAllowlist = (source: any): string[] => {
return Array.isArray(allowlist) ? allowlist : [];
};
+// Mirrors design.pen XCWAT (Slack creds wizard step) adapted for Discord.
+// 920-wide WizardCard, mint eyebrow, accordion rows with mint-bordered active row.
export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBack }) => {
const { t } = useTranslation();
const api = useApi();
@@ -44,14 +62,13 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBa
useEffect(() => {
if (botToken && !expandedSteps[4]) {
- setExpandedSteps(prev => ({ ...prev, 4: true }));
+ setExpandedSteps((prev) => ({ ...prev, 4: true }));
}
}, [botToken, expandedSteps]);
const isValid = useMemo(() => {
if (!botToken) return false;
if (authResult?.ok) return true;
- // Allow proceeding if token matches previously saved config (already validated before)
return Boolean(data.discord?.bot_token && botToken === data.discord?.bot_token);
}, [botToken, authResult, data.discord?.bot_token]);
@@ -86,16 +103,14 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBa
}, [authResult?.ok]);
const toggleStep = (step: number) => {
- setExpandedSteps(prev => ({ ...prev, [step]: !prev[step] }));
+ setExpandedSteps((prev) => ({ ...prev, [step]: !prev[step] }));
};
const toggleGuild = (guildId: string, checked: boolean) => {
setGuildSelectionTouched(true);
- setSelectedGuilds(prev => {
- if (checked) {
- return prev.includes(guildId) ? prev : [...prev, guildId];
- }
- return prev.filter(id => id !== guildId);
+ setSelectedGuilds((prev) => {
+ if (checked) return prev.includes(guildId) ? prev : [...prev, guildId];
+ return prev.filter((id) => id !== guildId);
});
};
@@ -110,13 +125,12 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBa
const copyInviteUrl = async () => {
if (!inviteUrl) return;
- const copiedToClipboard = await copyTextToClipboard(inviteUrl);
- if (copiedToClipboard) {
+ const ok = await copyTextToClipboard(inviteUrl);
+ if (ok) {
setInviteCopied(true);
setTimeout(() => setInviteCopied(false), 2000);
return;
}
-
setInviteCopied(false);
showToast(t('common.copyFailed'), 'error');
};
@@ -129,18 +143,18 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBa
}) => (
<button
onClick={() => toggleStep(step)}
- className="w-full px-4 py-3 flex items-center justify-between bg-neutral-50 hover:bg-neutral-100 transition-colors"
+ className="flex w-full items-center justify-between gap-3 px-5 py-4 text-left transition-colors hover:bg-white/[0.02]"
>
<div className="flex items-center gap-3">
<span
className={clsx(
- 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',
- completed ? 'bg-success text-white' : 'bg-accent text-white'
+ 'flex size-7 items-center justify-center rounded-full text-[12px] font-bold transition-colors',
+ completed ? 'bg-mint text-[#080812]' : 'bg-cyan/15 text-cyan'
)}
>
{completed ? <Check size={14} /> : step}
</span>
- <span className="flex items-center gap-2 font-semibold text-text">
+ <span className="flex items-center gap-2 text-[14px] font-semibold text-foreground">
{icon}
{title}
</span>
@@ -149,273 +163,314 @@ export const DiscordConfig: React.FC<DiscordConfigProps> = ({ data, onNext, onBa
</button>
);
+ const StepShell: React.FC<{ active: boolean; children: React.ReactNode }> = ({ active, children }) => (
+ <div
+ className={clsx(
+ 'overflow-hidden rounded-xl border transition-colors',
+ active
+ ? 'border-mint/35 bg-surface-2 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]'
+ : 'border-border bg-background'
+ )}
+ >
+ {children}
+ </div>
+ );
+
+ const completedCount = [
+ !!clientId,
+ Boolean(authResult?.ok || (data.discord?.bot_token && botToken === data.discord?.bot_token)),
+ !!inviteUrl,
+ isValid,
+ ].filter(Boolean).length;
+
return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="mb-4">
- <h2 className="text-3xl font-display font-bold text-text">{t('discordConfig.title')}</h2>
- <p className="text-muted mt-1">{t('discordConfig.subtitle')}</p>
- </div>
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Discord</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('discordConfig.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('discordConfig.subtitle')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {completedCount} / 4
+ </span>
+ <div className="flex gap-1">
+ {[0, 1, 2, 3].map((i) => (
+ <span
+ key={i}
+ className={clsx(
+ 'h-1 w-5 rounded-full',
+ i < completedCount ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' : 'bg-white/[0.08]'
+ )}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
- <div className="space-y-3 overflow-y-auto flex-1 pr-1">
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={1}
- title={t('discordConfig.step1Title')}
- icon={<Plus size={16} className="text-accent" />}
- />
- {expandedSteps[1] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('discordConfig.step1Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('discordConfig.step1Item1')}</li>
- <li>{t('discordConfig.step1Item2')}</li>
- <li>{t('discordConfig.step1Item3')}</li>
- </ol>
- <div>
+ <div className="flex flex-col gap-3">
+ {/* Step 1: Create application */}
+ <StepShell active={expandedSteps[1]}>
+ <StepHeader step={1} title={t('discordConfig.step1Title')} icon={<Plus size={16} className="text-cyan" />} />
+ {expandedSteps[1] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('discordConfig.step1Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('discordConfig.step1Item1')}</li>
+ <li>{t('discordConfig.step1Item2')}</li>
+ <li>{t('discordConfig.step1Item3')}</li>
+ </ol>
<button
onClick={openDiscordDeveloperPortal}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 transition-colors font-medium shadow-sm"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105"
>
- <ExternalLink size={16} />
+ <ExternalLink size={14} strokeWidth={2.25} />
{t('discordConfig.openDeveloperPortal')}
</button>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={2}
- title={t('discordConfig.step2Title')}
- icon={<Settings size={16} className="text-accent" />}
- />
- {expandedSteps[2] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('discordConfig.step2Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('discordConfig.step2Item1')}</li>
- <li>{t('discordConfig.step2Item2')}</li>
- </ol>
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">
- <strong>{t('slackConfig.tip')}:</strong> {t('discordConfig.step2Tip')}
+ {/* Step 2: Configure bot */}
+ <StepShell active={expandedSteps[2]}>
+ <StepHeader step={2} title={t('discordConfig.step2Title')} icon={<Settings size={16} className="text-cyan" />} />
+ {expandedSteps[2] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('discordConfig.step2Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('discordConfig.step2Item1')}</li>
+ <li>{t('discordConfig.step2Item2')}</li>
+ </ol>
+ <div className="rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2 text-[12px] leading-[1.55] text-cyan">
+ <strong>{t('slackConfig.tip')}:</strong> {t('discordConfig.step2Tip')}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={3}
- title={t('discordConfig.step3Title')}
- icon={<ExternalLink size={16} className="text-accent" />}
- />
- {expandedSteps[3] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('discordConfig.step3Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('discordConfig.step3Item1')}</li>
- <li>{t('discordConfig.step3Item2')}</li>
- <li>{t('discordConfig.step3Item3')}</li>
- <li>{t('discordConfig.step3Item4')}</li>
- </ol>
- <div className="space-y-2">
- <label className="text-sm font-medium text-text">{t('discordConfig.clientId')}</label>
- <input
- type="text"
- value={clientId}
- onChange={(e) => setClientId(e.target.value)}
- placeholder={t('discordConfig.clientIdPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
- />
- <p className="text-xs text-muted">{t('discordConfig.clientIdHint')}</p>
- </div>
- <div className="space-y-2">
- <div className="flex items-center justify-between">
- <span className="text-xs font-semibold text-muted uppercase">{t('discordConfig.inviteUrlLabel')}</span>
- <button
- onClick={copyInviteUrl}
- disabled={!inviteUrl}
- className="flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- >
- {inviteCopied ? <Check size={12} /> : <Copy size={12} />}
- {inviteCopied ? t('discordConfig.inviteUrlCopied') : t('discordConfig.inviteUrlCopy')}
- </button>
+ {/* Step 3: Invite bot */}
+ <StepShell active={expandedSteps[3]}>
+ <StepHeader step={3} title={t('discordConfig.step3Title')} icon={<ExternalLink size={16} className="text-cyan" />} />
+ {expandedSteps[3] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('discordConfig.step3Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('discordConfig.step3Item1')}</li>
+ <li>{t('discordConfig.step3Item2')}</li>
+ <li>{t('discordConfig.step3Item3')}</li>
+ <li>{t('discordConfig.step3Item4')}</li>
+ </ol>
+ <div className="space-y-2">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <KeyRound size={14} className="text-cyan" /> {t('discordConfig.clientId')}
+ </label>
+ <input
+ type="text"
+ value={clientId}
+ onChange={(e) => setClientId(e.target.value)}
+ placeholder={t('discordConfig.clientIdPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <p className="text-[11px] text-muted">{t('discordConfig.clientIdHint')}</p>
+ </div>
+ <div className="space-y-2">
+ <div className="flex items-center justify-between">
+ <span className="font-mono text-[11px] font-semibold uppercase tracking-[0.16em] text-muted">
+ {t('discordConfig.inviteUrlLabel')}
+ </span>
+ <button
+ onClick={copyInviteUrl}
+ disabled={!inviteUrl}
+ className="inline-flex items-center gap-1 text-[11px] text-cyan transition hover:text-cyan/80 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {inviteCopied ? <Check size={12} /> : <Copy size={12} />}
+ {inviteCopied ? t('discordConfig.inviteUrlCopied') : t('discordConfig.inviteUrlCopy')}
+ </button>
+ </div>
+ <input
+ type="text"
+ value={inviteUrl}
+ readOnly
+ placeholder={t('discordConfig.inviteUrlPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-[11px] text-foreground"
+ />
</div>
- <input
- type="text"
- value={inviteUrl}
- readOnly
- placeholder={t('discordConfig.inviteUrlPlaceholder')}
- className="w-full bg-white border border-border rounded-md p-2 text-xs font-mono text-text"
- />
- </div>
- <div>
<button
onClick={() => inviteUrl && window.open(inviteUrl, '_blank')}
disabled={!inviteUrl}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 transition-colors font-medium shadow-sm disabled:opacity-50 disabled:cursor-not-allowed"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- <ExternalLink size={16} />
+ <ExternalLink size={14} strokeWidth={2.25} />
{t('discordConfig.openInviteUrl')}
</button>
- </div>
- <div className="bg-amber-50 border border-amber-200 rounded-lg p-3 space-y-2">
- <div className="flex items-center gap-2 text-sm font-medium text-amber-800">
- <AlertTriangle size={14} className="text-amber-700" />
- {t('discordConfig.dmTroubleshootTitle')}
+ <div className="space-y-2 rounded-lg border border-gold/30 bg-gold/10 px-3 py-2.5">
+ <div className="flex items-center gap-2 text-[12px] font-semibold text-gold">
+ <AlertTriangle size={14} className="text-gold" />
+ {t('discordConfig.dmTroubleshootTitle')}
+ </div>
+ <ol className="list-inside list-decimal space-y-1 pl-1 text-[11px] leading-[1.55] text-gold/90">
+ <li>{t('discordConfig.dmTroubleshoot1')}</li>
+ <li>{t('discordConfig.dmTroubleshoot2')}</li>
+ <li>{t('discordConfig.dmTroubleshoot3')}</li>
+ </ol>
</div>
- <ol className="list-decimal list-inside space-y-1 text-xs text-amber-900 pl-1">
- <li>{t('discordConfig.dmTroubleshoot1')}</li>
- <li>{t('discordConfig.dmTroubleshoot2')}</li>
- <li>{t('discordConfig.dmTroubleshoot3')}</li>
- </ol>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={4}
- title={t('discordConfig.step4Title')}
- icon={<KeyRound size={16} className="text-accent" />}
- completed={isValid}
- />
- {expandedSteps[4] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('discordConfig.step4Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('discordConfig.step4Item1')}</li>
- <li>{t('discordConfig.step4Item2')}</li>
- <li>{t('discordConfig.step4Item3')}</li>
- </ol>
+ {/* Step 4: Validate token */}
+ <StepShell active={expandedSteps[4]}>
+ <StepHeader
+ step={4}
+ title={t('discordConfig.step4Title')}
+ icon={<KeyRound size={16} className="text-cyan" />}
+ completed={isValid}
+ />
+ {expandedSteps[4] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('discordConfig.step4Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('discordConfig.step4Item1')}</li>
+ <li>{t('discordConfig.step4Item2')}</li>
+ <li>{t('discordConfig.step4Item3')}</li>
+ </ol>
- <div className="space-y-2 pt-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <KeyRound size={16} className="text-accent" /> {t('discordConfig.botToken')}
- </label>
- <input
- type="password"
- value={botToken}
- onChange={(e) => setBotToken(e.target.value)}
- placeholder={t('discordConfig.botTokenPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
- />
- <p className="text-xs text-muted">{t('discordConfig.botTokenHint')}</p>
- </div>
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <KeyRound size={14} className="text-cyan" /> {t('discordConfig.botToken')}
+ </label>
+ <input
+ type="password"
+ value={botToken}
+ onChange={(e) => setBotToken(e.target.value)}
+ placeholder={t('discordConfig.botTokenPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <p className="text-[11px] text-muted">{t('discordConfig.botTokenHint')}</p>
+ </div>
- <div className="flex items-center gap-3">
- <button
- onClick={runAuthTest}
- disabled={!botToken || checking}
- className="px-4 py-2 bg-accent text-white rounded-lg flex items-center gap-2 transition-colors font-medium shadow-sm hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed"
- >
- {checking ? <RefreshCw size={16} className="animate-spin" /> : <Shield size={16} />}
- {t('discordConfig.validateToken')}
- </button>
- {authResult && (
- <span
- className={clsx(
- 'flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border',
- authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20'
- )}
+ <div className="flex flex-wrap items-center gap-3">
+ <button
+ onClick={runAuthTest}
+ disabled={!botToken || checking}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- {authResult.ok ? (
- <>
- <Check size={14} />
- <span>{t('discordConfig.tokenValidated')}</span>
- </>
- ) : (
- <span>{t('discordConfig.authFailed')}: {authResult.error}</span>
- )}
- </span>
- )}
- </div>
+ {checking ? <RefreshCw size={14} className="animate-spin" /> : <Shield size={14} strokeWidth={2.25} />}
+ {t('discordConfig.validateToken')}
+ </button>
+ {authResult && (
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-[12px] font-medium',
+ authResult.ok
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-danger/30 bg-danger/10 text-danger'
+ )}
+ >
+ {authResult.ok ? <Check size={14} /> : null}
+ {authResult.ok
+ ? t('discordConfig.tokenValidated')
+ : `${t('discordConfig.authFailed')}: ${authResult.error}`}
+ </span>
+ )}
+ </div>
- {authResult?.ok && (
- <div className="space-y-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <Server size={16} className="text-accent" /> {t('discordConfig.guild')}
- </label>
- {guilds.length > 0 && (
- <div className="flex flex-wrap items-center justify-between gap-2">
- <span className="text-xs text-muted">
- {t('discordConfig.selectedGuilds', { count: selectedGuilds.length })}
- </span>
- <div className="flex items-center gap-2">
- <button
- type="button"
- onClick={selectAllGuilds}
- className="text-xs font-medium text-accent hover:text-accent/80"
- >
- {t('discordConfig.selectAllGuilds')}
- </button>
- <button
- type="button"
- onClick={() => {
- setGuildSelectionTouched(true);
- setSelectedGuilds([]);
- }}
- className="text-xs font-medium text-muted hover:text-text"
- >
- {t('discordConfig.clearGuilds')}
- </button>
+ {authResult?.ok && (
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <Server size={14} className="text-cyan" /> {t('discordConfig.guild')}
+ </label>
+ {guilds.length > 0 && (
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <span className="text-[11px] text-muted">
+ {t('discordConfig.selectedGuilds', { count: selectedGuilds.length })}
+ </span>
+ <div className="flex items-center gap-3">
+ <button
+ type="button"
+ onClick={selectAllGuilds}
+ className="text-[11px] font-medium text-cyan transition hover:text-cyan/80"
+ >
+ {t('discordConfig.selectAllGuilds')}
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ setGuildSelectionTouched(true);
+ setSelectedGuilds([]);
+ }}
+ className="text-[11px] font-medium text-muted transition hover:text-foreground"
+ >
+ {t('discordConfig.clearGuilds')}
+ </button>
+ </div>
</div>
- </div>
- )}
- <div className="max-h-52 overflow-y-auto rounded-lg border border-border bg-bg">
- {guilds.length === 0 ? (
- <div className="p-3 text-sm text-muted">{t('discordConfig.guildPlaceholder')}</div>
- ) : (
- guilds.map((g) => (
- <label
- key={g.id}
- className="flex items-center gap-3 border-b border-border/70 px-3 py-2 last:border-b-0"
- >
- <input
- type="checkbox"
- checked={selectedGuilds.includes(g.id)}
- onChange={(e) => toggleGuild(g.id, e.target.checked)}
- className="h-4 w-4 accent-accent"
- />
- <span className="text-sm text-text">{g.name}</span>
- </label>
- ))
)}
+ <div className="max-h-52 overflow-y-auto rounded-lg border border-border bg-background">
+ {guilds.length === 0 ? (
+ <div className="px-3 py-2.5 text-[12px] text-muted">{t('discordConfig.guildPlaceholder')}</div>
+ ) : (
+ guilds.map((g) => (
+ <label
+ key={g.id}
+ className="flex items-center gap-3 border-b border-border/70 px-3 py-2 last:border-b-0"
+ >
+ <input
+ type="checkbox"
+ checked={selectedGuilds.includes(g.id)}
+ onChange={(e) => toggleGuild(g.id, e.target.checked)}
+ className="size-4 accent-mint"
+ />
+ <span className="text-[12px] text-foreground">{g.name}</span>
+ </label>
+ ))
+ )}
+ </div>
+ <p className="text-[11px] text-muted">{t('discordConfig.guildHint')}</p>
</div>
- <p className="text-xs text-muted">{t('discordConfig.guildHint')}</p>
- </div>
- )}
- </div>
- )}
+ )}
+ </div>
+ )}
+ </StepShell>
</div>
- </div>
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium transition-colors">
- {t('common.back')}
- </button>
- <button
- onClick={() => onNext({
- platform: 'discord',
- discord: {
- ...(data.discord || {}),
- bot_token: botToken,
- },
- discordGuildAllowlist: selectedGuilds,
- discordGuildAllowlistTouched: guildSelectionTouched,
- })}
- disabled={!isValid}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- isValid ? 'bg-accent hover:bg-accent/90 text-white' : 'bg-neutral-200 text-muted cursor-not-allowed'
- )}
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() =>
+ onNext({
+ platform: 'discord',
+ discord: {
+ ...(data.discord || {}),
+ bot_token: botToken,
+ },
+ discordGuildAllowlist: selectedGuilds,
+ discordGuildAllowlistTouched: guildSelectionTouched,
+ })
+ }
+ disabled={!isValid}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/steps/DoctorPanel.tsx b/ui/src/components/steps/DoctorPanel.tsx
index f60b2639d..57a64211b 100644
--- a/ui/src/components/steps/DoctorPanel.tsx
+++ b/ui/src/components/steps/DoctorPanel.tsx
@@ -1,17 +1,62 @@
import React, { useEffect, useState } from 'react';
-import { Activity, RefreshCw, CheckCircle, AlertTriangle, XCircle, Copy, FileText } from 'lucide-react';
+import {
+ Activity,
+ AlertTriangle,
+ CheckCircle,
+ Copy,
+ FileText,
+ RefreshCw,
+ XCircle,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import { useApi } from '../../context/ApiContext';
-import { useToast } from '../../context/ToastContext';
import { Link } from 'react-router-dom';
import clsx from 'clsx';
+
+import { useApi } from '../../context/ApiContext';
+import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
interface DoctorPanelProps {
isPage?: boolean;
+ logsPath?: string;
+ titleKey?: string;
}
-export const DoctorPanel: React.FC<DoctorPanelProps> = ({ isPage }) => {
+type CheckStatus = 'pass' | 'warn' | 'fail';
+
+const STATUS_TONE: Record<
+ CheckStatus,
+ { row: string; icon: string; text: string; iconNode: React.ReactNode }
+> = {
+ pass: {
+ row: '',
+ icon: 'text-mint',
+ text: 'text-foreground',
+ iconNode: <CheckCircle className="size-4" />,
+ },
+ warn: {
+ row: 'bg-gold/[0.05]',
+ icon: 'text-gold',
+ text: 'text-gold font-semibold',
+ iconNode: <AlertTriangle className="size-4" />,
+ },
+ fail: {
+ row: 'bg-danger/[0.06]',
+ icon: 'text-danger',
+ text: 'text-danger font-semibold',
+ iconNode: <XCircle className="size-4" />,
+ },
+};
+
+// Mirrors design.pen Hns4E (VR/CM/Diagnostics):
+// diagHero: cornerRadius 14, fill --surface-2, mint stroke 33%, blur 32 y16 spread -8 #5BFFA014.
+// diagPulse: 42×42 mint-soft circle with blur 16 #5BFFA070 spread -4 glow.
+// diagG: cornerRadius 12, fill --background, stroke --border. Item rows [10, 20].
+export const DoctorPanel: React.FC<DoctorPanelProps> = ({
+ isPage,
+ logsPath = '/doctor/logs',
+ titleKey = 'doctor.title',
+}) => {
const { t } = useTranslation();
const api = useApi();
const { showToast } = useToast();
@@ -30,99 +75,169 @@ export const DoctorPanel: React.FC<DoctorPanelProps> = ({ isPage }) => {
useEffect(() => {
runDoctor();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const copyReport = async () => {
if (!results) return;
-
const copied = await copyTextToClipboard(JSON.stringify(results, null, 2));
if (!copied) {
showToast(t('common.copyFailed'), 'error');
}
};
- const StatusIcon = ({ status }: { status: string }) => {
- switch (status) {
- case 'pass': return <CheckCircle size={18} className="text-success" />;
- case 'warn': return <AlertTriangle size={18} className="text-warning" />;
- case 'fail': return <XCircle size={18} className="text-danger" />;
- default: return <div className="w-4 h-4 rounded-full bg-muted" />;
- }
- };
+ const summary = results?.summary || { pass: 0, warn: 0, fail: 0 };
+ const totalChecks = (summary.pass || 0) + (summary.warn || 0) + (summary.fail || 0);
return (
- <div className={clsx("flex flex-col", isPage ? "max-w-4xl mx-auto h-full" : "w-full")}>
- <div className="flex items-center justify-between mb-6">
- <h2 className={clsx("font-display font-bold flex items-center gap-2", isPage ? "text-3xl" : "text-xl")}>
- <Activity className="text-accent" />
- {t('doctor.title')}
- </h2>
- <div className="flex gap-2">
- <Link
- to="/doctor/logs"
- className="flex items-center gap-2 px-3 py-2 border border-border rounded-lg text-sm text-muted hover:bg-neutral-50 hover:text-text transition-colors"
- >
- <FileText size={16} /> {t('common.viewLogs')}
- </Link>
- {results && (
- <button
- onClick={() => void copyReport()}
- className="flex items-center gap-2 px-3 py-2 border border-border rounded-lg text-sm text-muted hover:bg-neutral-50 hover:text-text transition-colors"
- >
- <Copy size={16} /> {t('doctor.copyReport')}
- </button>
- )}
- <button
- onClick={runDoctor}
- disabled={loading}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 disabled:opacity-50 transition-colors font-medium shadow-sm"
- >
- <RefreshCw size={16} className={loading ? 'animate-spin' : ''} /> {t('doctor.runChecks')}
- </button>
- </div>
+ <div className={clsx('flex w-full flex-col gap-5', isPage && 'h-full')}>
+ {/* diagHero */}
+ <div className="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-mint/30 bg-surface-2 px-6 py-5 shadow-[0_16px_32px_-8px_rgba(91,255,160,0.078)]">
+ <div className="flex min-w-0 items-center gap-3.5">
+ <div className="flex size-[42px] shrink-0 items-center justify-center rounded-full border border-mint/35 bg-mint/[0.08] shadow-[0_0_16px_-4px_rgba(91,255,160,0.44)]">
+ <Activity className="size-5 text-mint" strokeWidth={2.25} />
+ </div>
+ <div className="flex min-w-0 flex-col gap-0.5">
+ <h2 className="text-[16px] font-semibold tracking-[-0.2px] text-foreground">
+ {t(titleKey)}
+ </h2>
+ <p className="text-[12px] text-muted">
+ {results?.ok
+ ? t('dashboard.metricHealthHealthy')
+ : t('dashboard.metricHealthIssues')}
+ {totalChecks > 0 && ` · ${summary.pass}/${totalChecks}`}
+ </p>
+ </div>
+ </div>
+
+ <div className="flex flex-wrap items-center gap-2">
+ <Link
+ to={logsPath}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ <FileText className="size-3.5" />
+ {t('common.viewLogs')}
+ </Link>
+ {results && (
+ <button
+ type="button"
+ onClick={() => void copyReport()}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ <Copy className="size-3.5" />
+ {t('doctor.copyReport')}
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={runDoctor}
+ disabled={loading}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg bg-mint px-3 text-[12px] font-bold text-[#080812] shadow-[0_0_18px_-4px_rgba(91,255,160,0.55)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <RefreshCw className={clsx('size-3.5', loading && 'animate-spin')} strokeWidth={2.5} />
+ {t('doctor.runChecks')}
+ </button>
</div>
+ </div>
{results && (
- <div className="space-y-6">
- {results.groups?.map((group: any, i: number) => (
- <div key={i} className="bg-panel border border-border rounded-xl overflow-hidden shadow-sm">
- <div className="px-4 py-3 bg-neutral-50 border-b border-border font-semibold text-sm uppercase text-muted tracking-wide">
- {group.name}
- </div>
- <div className="divide-y divide-border">
- {group.items.map((item: any, j: number) => (
- <div key={j} className="p-4 flex items-start gap-4 hover:bg-neutral-50/30 transition-colors">
- <div className="mt-0.5"><StatusIcon status={item.status} /></div>
- <div className="flex-1">
- <div className={clsx("font-medium", item.status === 'fail' ? "text-danger" : "text-text")}>
- {item.message}
+ <div className="flex flex-col gap-4">
+ {/* Summary stat strip */}
+ <div className="grid grid-cols-3 gap-3">
+ <SummaryTile
+ tone="success"
+ label={t('doctor.passed')}
+ value={summary.pass || 0}
+ icon={<CheckCircle className="size-4" />}
+ />
+ <SummaryTile
+ tone="warning"
+ label={t('doctor.warnings')}
+ value={summary.warn || 0}
+ icon={<AlertTriangle className="size-4" />}
+ />
+ <SummaryTile
+ tone="danger"
+ label={t('doctor.failed')}
+ value={summary.fail || 0}
+ icon={<XCircle className="size-4" />}
+ />
+ </div>
+
+ {results.groups?.map((group: any, index: number) => {
+ const groupTotal = group.items?.length || 0;
+ const groupPass = (group.items || []).filter((i: any) => i.status === 'pass').length;
+ return (
+ <div
+ key={index}
+ className="flex flex-col overflow-hidden rounded-xl border border-border bg-background"
+ >
+ <div className="flex items-center justify-between gap-4 border-b border-border px-5 py-3.5">
+ <h3 className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-muted">
+ {group.name}
+ </h3>
+ <span
+ className={clsx(
+ 'font-mono text-[10px] font-bold',
+ groupPass === groupTotal ? 'text-mint' : 'text-gold'
+ )}
+ >
+ {groupPass} / {groupTotal}
+ </span>
+ </div>
+ <div className="flex flex-col">
+ {group.items.map((item: any, j: number) => {
+ const tone = STATUS_TONE[(item.status as CheckStatus) || 'pass'];
+ return (
+ <div
+ key={j}
+ className={clsx(
+ 'flex items-start gap-3 border-b border-border px-5 py-2.5 last:border-b-0',
+ tone.row
+ )}
+ >
+ <div className={clsx('mt-0.5 shrink-0', tone.icon)}>{tone.iconNode}</div>
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <div className={clsx('text-[12px]', tone.text)}>{item.message}</div>
+ {item.action && (
+ <div className="cursor-pointer text-[11px] text-cyan underline-offset-2 hover:underline">
+ {item.action}
+ </div>
+ )}
+ </div>
</div>
- {item.action && (
- <div className="mt-2 text-sm text-accent underline cursor-pointer">{item.action}</div>
- )}
- </div>
- </div>
- ))}
- </div>
- </div>
- ))}
- {/* Summary */}
- <div className="grid grid-cols-3 gap-4">
- <div className="bg-success/10 border border-success/20 rounded-lg p-4 text-center">
- <div className="text-2xl font-bold text-success">{results.summary?.pass || 0}</div>
- <div className="text-sm text-success/80 font-medium">{t('doctor.passed')}</div>
- </div>
- <div className="bg-warning/10 border border-warning/20 rounded-lg p-4 text-center">
- <div className="text-2xl font-bold text-warning">{results.summary?.warn || 0}</div>
- <div className="text-sm text-warning/80 font-medium">{t('doctor.warnings')}</div>
- </div>
- <div className="bg-danger/10 border border-danger/20 rounded-lg p-4 text-center">
- <div className="text-2xl font-bold text-danger">{results.summary?.fail || 0}</div>
- <div className="text-sm text-danger/80 font-medium">{t('doctor.failed')}</div>
+ );
+ })}
+ </div>
</div>
- </div>
+ );
+ })}
</div>
)}
</div>
);
};
+
+const SummaryTile: React.FC<{
+ tone: 'success' | 'warning' | 'danger';
+ label: string;
+ value: number;
+ icon: React.ReactNode;
+}> = ({ tone, label, value, icon }) => {
+ const cfg = {
+ success: 'border-mint/30 bg-mint/[0.06] text-mint',
+ warning: 'border-gold/30 bg-gold/[0.06] text-gold',
+ danger: 'border-danger/30 bg-danger/[0.06] text-danger',
+ }[tone];
+ return (
+ <div className={clsx('flex items-center gap-3 rounded-xl border px-4 py-3', cfg)}>
+ <div className="shrink-0">{icon}</div>
+ <div className="flex min-w-0 flex-col">
+ <div className="text-[20px] font-bold leading-none tracking-[-0.3px]">{value}</div>
+ <div className="text-[11px] font-medium uppercase tracking-[0.12em] opacity-80">
+ {label}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/ui/src/components/steps/LarkConfig.tsx b/ui/src/components/steps/LarkConfig.tsx
index 22a16a963..bfc80bb5a 100644
--- a/ui/src/components/steps/LarkConfig.tsx
+++ b/ui/src/components/steps/LarkConfig.tsx
@@ -1,10 +1,29 @@
import React, { useEffect, useMemo, useState } from 'react';
-import { Shield, RefreshCw, Check, MessageSquare, KeyRound, Plus, ExternalLink, ChevronDown, ChevronUp, BookOpen, Copy, AlertTriangle, Radio, Globe, Wifi } from 'lucide-react';
+import {
+ AlertTriangle,
+ ArrowLeft,
+ ArrowRight,
+ BookOpen,
+ Check,
+ ChevronDown,
+ ChevronUp,
+ Copy,
+ ExternalLink,
+ Globe,
+ KeyRound,
+ MessageSquare,
+ Plus,
+ Radio,
+ RefreshCw,
+ Shield,
+ Wifi,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
+import { EyebrowBadge, WizardCard } from '../visual';
const LARK_PERMISSIONS_JSON = `{
"scopes": {
@@ -35,6 +54,8 @@ interface LarkConfigProps {
onBack: () => void;
}
+// Mirrors design.pen XCWAT (Slack creds wizard step) adapted for Lark/Feishu.
+// Adds a domain selector ahead of the 5-step accordion. WizardCard 920, mint eyebrow.
export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack }) => {
const { t } = useTranslation();
const api = useApi();
@@ -46,11 +67,16 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
const [authResult, setAuthResult] = useState<any>(null);
const [wsStatus, setWsStatus] = useState<'idle' | 'connecting' | 'connected' | 'error'>('idle');
const [chats, setChats] = useState<any[]>([]);
- const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({ 1: true, 2: false, 3: false, 4: false, 5: false });
+ const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({
+ 1: true,
+ 2: false,
+ 3: false,
+ 4: false,
+ 5: false,
+ });
const [copiedJson, setCopiedJson] = useState(false);
const platformBase = domain === 'lark' ? 'https://open.larksuite.com' : 'https://open.feishu.cn';
- // Dynamic links based on appId — only useful after credentials are entered
const appBase = appId ? `${platformBase}/app/${appId}` : '';
const permissionsUrl = appBase ? `${appBase}/auth` : '';
const eventsUrl = appBase ? `${appBase}/event` : '';
@@ -63,22 +89,27 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
useEffect(() => {
if (appId && appSecret && !expandedSteps[2]) {
- setExpandedSteps(prev => ({ ...prev, 2: true }));
+ setExpandedSteps((prev) => ({ ...prev, 2: true }));
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [appId, appSecret]);
- // Stop temp WS on unmount
useEffect(() => {
return () => {
api.larkTempWsStop().catch(() => {});
};
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const isValid = useMemo(() => {
if (!appId || !appSecret) return false;
if (authResult?.ok) return true;
- // Allow proceeding if credentials match previously saved config (already validated before)
- return Boolean(data.lark?.app_id && data.lark?.app_secret && appId === data.lark?.app_id && appSecret === data.lark?.app_secret);
+ return Boolean(
+ data.lark?.app_id &&
+ data.lark?.app_secret &&
+ appId === data.lark?.app_id &&
+ appSecret === data.lark?.app_secret
+ );
}, [appId, appSecret, authResult, data.lark?.app_id, data.lark?.app_secret]);
const runAuthTest = async () => {
@@ -88,12 +119,11 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
const result = await api.larkAuthTest(appId, appSecret, domain);
setAuthResult(result);
- // On success, start temp WS so the Feishu console shows "Use Long Connection"
if (result.ok) {
setWsStatus('connecting');
try {
await api.larkTempWsStart(appId, appSecret, domain);
- await new Promise(resolve => setTimeout(resolve, 2000));
+ await new Promise((resolve) => setTimeout(resolve, 2000));
setWsStatus('connected');
} catch {
setWsStatus('error');
@@ -122,20 +152,20 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
if (authResult?.ok) {
loadChats();
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [authResult?.ok]);
const toggleStep = (step: number) => {
- setExpandedSteps(prev => ({ ...prev, [step]: !prev[step] }));
+ setExpandedSteps((prev) => ({ ...prev, [step]: !prev[step] }));
};
const copyPermissionsJson = async () => {
- const copiedToClipboard = await copyTextToClipboard(LARK_PERMISSIONS_JSON);
- if (copiedToClipboard) {
+ const ok = await copyTextToClipboard(LARK_PERMISSIONS_JSON);
+ if (ok) {
setCopiedJson(true);
setTimeout(() => setCopiedJson(false), 2000);
return;
}
-
showToast(t('common.copyFailed'), 'error');
};
@@ -143,9 +173,9 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
<button
onClick={() => window.open(url, '_blank')}
disabled={!url}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 transition-colors font-medium shadow-sm disabled:opacity-50 disabled:cursor-not-allowed"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- <ExternalLink size={16} />
+ <ExternalLink size={14} strokeWidth={2.25} />
{label}
</button>
);
@@ -158,18 +188,18 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
}) => (
<button
onClick={() => toggleStep(step)}
- className="w-full px-4 py-3 flex items-center justify-between bg-neutral-50 hover:bg-neutral-100 transition-colors"
+ className="flex w-full items-center justify-between gap-3 px-5 py-4 text-left transition-colors hover:bg-white/[0.02]"
>
<div className="flex items-center gap-3">
<span
className={clsx(
- 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',
- completed ? 'bg-success text-white' : 'bg-accent text-white'
+ 'flex size-7 items-center justify-center rounded-full text-[12px] font-bold transition-colors',
+ completed ? 'bg-mint text-[#080812]' : 'bg-cyan/15 text-cyan'
)}
>
{completed ? <Check size={14} /> : step}
</span>
- <span className="flex items-center gap-2 font-semibold text-text">
+ <span className="flex items-center gap-2 text-[14px] font-semibold text-foreground">
{icon}
{title}
</span>
@@ -178,299 +208,348 @@ export const LarkConfig: React.FC<LarkConfigProps> = ({ data, onNext, onBack })
</button>
);
- return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="mb-4">
- <h2 className="text-3xl font-display font-bold text-text">{t('larkConfig.title')}</h2>
- <p className="text-muted mt-1">{t('larkConfig.subtitle')}</p>
- </div>
+ const StepShell: React.FC<{ active: boolean; children: React.ReactNode }> = ({ active, children }) => (
+ <div
+ className={clsx(
+ 'overflow-hidden rounded-xl border transition-colors',
+ active
+ ? 'border-mint/35 bg-surface-2 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]'
+ : 'border-border bg-background'
+ )}
+ >
+ {children}
+ </div>
+ );
- {/* Domain selector */}
- <div className="mb-4 bg-panel border border-border rounded-xl p-4 space-y-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <Globe size={16} className="text-accent" /> {t('larkConfig.domainLabel')}
- </label>
- <div className="flex gap-3">
- <button
- onClick={() => { setDomain('feishu'); setAuthResult(null); setWsStatus('idle'); }}
- className={clsx(
- 'flex-1 px-4 py-2.5 rounded-lg border-2 text-sm font-medium transition-all',
- domain === 'feishu'
- ? 'border-accent bg-accent/10 text-accent'
- : 'border-border bg-bg text-muted hover:border-accent/30'
- )}
- >
- {t('larkConfig.domainFeishu')}
- </button>
- <button
- onClick={() => { setDomain('lark'); setAuthResult(null); setWsStatus('idle'); }}
- className={clsx(
- 'flex-1 px-4 py-2.5 rounded-lg border-2 text-sm font-medium transition-all',
- domain === 'lark'
- ? 'border-accent bg-accent/10 text-accent'
- : 'border-border bg-bg text-muted hover:border-accent/30'
- )}
- >
- {t('larkConfig.domainLark')}
- </button>
- </div>
- <p className="text-xs text-muted">{t('larkConfig.domainHint')}</p>
- </div>
+ const completedCount = [
+ Boolean(appId),
+ isValid,
+ Boolean(authResult?.ok),
+ expandedSteps[4],
+ expandedSteps[5],
+ ].filter(Boolean).length;
- <div className="space-y-3 overflow-y-auto flex-1 pr-1">
- {/* Step 1: Create App */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader step={1} title={t('larkConfig.step1Title')} icon={<Plus size={16} className="text-accent" />} />
- {expandedSteps[1] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('larkConfig.step1Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('larkConfig.step1Item1')}</li>
- <li>{t('larkConfig.step1Item2')}</li>
- <li>{t('larkConfig.step1Item3')}</li>
- </ol>
- <LinkButton url={`${platformBase}/app`} label={t('larkConfig.openPlatform')} />
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Lark / Feishu</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('larkConfig.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('larkConfig.subtitle')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {completedCount} / 5
+ </span>
+ <div className="flex gap-1">
+ {[0, 1, 2, 3, 4].map((i) => (
+ <span
+ key={i}
+ className={clsx(
+ 'h-1 w-4 rounded-full',
+ i < completedCount ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' : 'bg-white/[0.08]'
+ )}
+ />
+ ))}
</div>
- )}
+ </div>
</div>
- {/* Step 2: Enter Credentials & Validate */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader step={2} title={t('larkConfig.step2Title')} icon={<KeyRound size={16} className="text-accent" />} completed={isValid} />
- {expandedSteps[2] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('larkConfig.step2Description')}</p>
-
- <div className="space-y-2 pt-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <KeyRound size={16} className="text-accent" /> {t('larkConfig.appId')}
- </label>
- <input
- type="text"
- value={appId}
- onChange={(e) => setAppId(e.target.value)}
- placeholder={t('larkConfig.appIdPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
- />
- <p className="text-xs text-muted">{t('larkConfig.appIdHint')}</p>
- </div>
-
- <div className="space-y-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <KeyRound size={16} className="text-accent" /> {t('larkConfig.appSecret')}
- </label>
- <input
- type="password"
- value={appSecret}
- onChange={(e) => setAppSecret(e.target.value)}
- placeholder={t('larkConfig.appSecretPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
- />
- <p className="text-xs text-muted">{t('larkConfig.appSecretHint')}</p>
- </div>
-
- <div className="flex items-center gap-3">
- <button
- onClick={runAuthTest}
- disabled={!appId || !appSecret || checking}
- className="px-4 py-2 bg-accent text-white rounded-lg flex items-center gap-2 transition-colors font-medium shadow-sm hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed"
- >
- {checking ? <RefreshCw size={16} className="animate-spin" /> : <Shield size={16} />}
- {t('larkConfig.validateCredentials')}
- </button>
- {authResult && (
- <span
- className={clsx(
- 'flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border',
- authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20'
- )}
- >
- {authResult.ok ? (
- <><Check size={14} /><span>{t('larkConfig.credentialsValidated')}</span></>
- ) : (
- <span>{t('larkConfig.authFailed')}: {authResult.error}</span>
- )}
- </span>
+ {/* Domain selector */}
+ <div className="space-y-2 rounded-xl border border-border bg-background px-5 py-4">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <Globe size={14} className="text-cyan" /> {t('larkConfig.domainLabel')}
+ </label>
+ <div className="flex gap-2">
+ {(['feishu', 'lark'] as const).map((opt) => (
+ <button
+ key={opt}
+ onClick={() => {
+ setDomain(opt);
+ setAuthResult(null);
+ setWsStatus('idle');
+ }}
+ className={clsx(
+ 'flex-1 rounded-lg border px-3 py-2 text-[12px] font-semibold transition',
+ domain === opt
+ ? 'border-mint/45 bg-mint/[0.08] text-mint shadow-[0_0_24px_-4px_rgba(91,255,160,0.4)]'
+ : 'border-border bg-white/[0.04] text-muted hover:border-border-strong hover:text-foreground'
)}
- </div>
+ >
+ {opt === 'feishu' ? t('larkConfig.domainFeishu') : t('larkConfig.domainLark')}
+ </button>
+ ))}
+ </div>
+ <p className="text-[11px] text-muted">{t('larkConfig.domainHint')}</p>
+ </div>
- {/* WS connection status */}
- {wsStatus !== 'idle' && (
- <div className={clsx(
- 'rounded-lg p-3 text-sm flex items-center gap-2 border',
- wsStatus === 'connecting' ? 'bg-blue-50 border-blue-200 text-blue-800' :
- wsStatus === 'connected' ? 'bg-success/10 border-success/20 text-success' :
- 'bg-danger/10 border-danger/20 text-danger'
- )}>
- {wsStatus === 'connecting' && <RefreshCw size={14} className="animate-spin" />}
- {wsStatus === 'connected' && <Wifi size={14} />}
- {wsStatus === 'connecting' && t('larkConfig.step2ConnectingWs')}
- {wsStatus === 'connected' && t('larkConfig.step2WsConnected')}
+ <div className="flex flex-col gap-3">
+ {/* Step 1 — Create app */}
+ <StepShell active={expandedSteps[1]}>
+ <StepHeader step={1} title={t('larkConfig.step1Title')} icon={<Plus size={16} className="text-cyan" />} />
+ {expandedSteps[1] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('larkConfig.step1Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('larkConfig.step1Item1')}</li>
+ <li>{t('larkConfig.step1Item2')}</li>
+ <li>{t('larkConfig.step1Item3')}</li>
+ </ol>
+ <LinkButton url={`${platformBase}/app`} label={t('larkConfig.openPlatform')} />
+ </div>
+ )}
+ </StepShell>
+
+ {/* Step 2 — Credentials */}
+ <StepShell active={expandedSteps[2]}>
+ <StepHeader
+ step={2}
+ title={t('larkConfig.step2Title')}
+ icon={<KeyRound size={16} className="text-cyan" />}
+ completed={isValid}
+ />
+ {expandedSteps[2] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('larkConfig.step2Description')}</p>
+
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <KeyRound size={14} className="text-cyan" /> {t('larkConfig.appId')}
+ </label>
+ <input
+ type="text"
+ value={appId}
+ onChange={(e) => setAppId(e.target.value)}
+ placeholder={t('larkConfig.appIdPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <p className="text-[11px] text-muted">{t('larkConfig.appIdHint')}</p>
</div>
- )}
- {authResult?.ok && chats.length > 0 && (
<div className="space-y-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <MessageSquare size={16} className="text-accent" /> {t('larkConfig.chatListLabel')}
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <KeyRound size={14} className="text-cyan" /> {t('larkConfig.appSecret')}
</label>
- <p className="text-xs text-muted">{t('larkConfig.chatListHint')}</p>
- <div className="bg-bg border border-border rounded-lg p-3 max-h-32 overflow-y-auto">
- <ul className="space-y-1 text-sm text-text">
- {chats.map((c: any) => (
- <li key={c.id} className="flex items-center gap-2">
- <Check size={12} className="text-success shrink-0" />
- <span>{c.name}</span>
- <span className="text-xs text-muted font-mono">({c.id})</span>
- </li>
- ))}
- </ul>
- </div>
+ <input
+ type="password"
+ value={appSecret}
+ onChange={(e) => setAppSecret(e.target.value)}
+ placeholder={t('larkConfig.appSecretPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <p className="text-[11px] text-muted">{t('larkConfig.appSecretHint')}</p>
</div>
- )}
- </div>
- )}
- </div>
- {/* Step 3: Configure Permissions */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader step={3} title={t('larkConfig.step3Title')} icon={<Shield size={16} className="text-accent" />} />
- {expandedSteps[3] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('larkConfig.step3Description')}</p>
-
- {permissionsUrl && (
- <LinkButton url={permissionsUrl} label={t('larkConfig.step3OpenLink')} />
- )}
-
- {/* Batch import JSON */}
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 space-y-2">
- <div className="flex items-center justify-between">
- <span className="text-sm font-medium text-blue-800">{t('larkConfig.step3BatchImport')}</span>
+ <div className="flex flex-wrap items-center gap-3">
<button
- onClick={copyPermissionsJson}
- className="flex items-center gap-1.5 px-3 py-1 bg-blue-100 hover:bg-blue-200 text-blue-700 rounded text-xs font-medium transition-colors"
+ onClick={runAuthTest}
+ disabled={!appId || !appSecret || checking}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- {copiedJson ? <Check size={12} /> : <Copy size={12} />}
- {copiedJson ? t('larkConfig.step3Copied') : t('larkConfig.step3CopyJson')}
+ {checking ? <RefreshCw size={14} className="animate-spin" /> : <Shield size={14} strokeWidth={2.25} />}
+ {t('larkConfig.validateCredentials')}
</button>
+ {authResult && (
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-[12px] font-medium',
+ authResult.ok
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-danger/30 bg-danger/10 text-danger'
+ )}
+ >
+ {authResult.ok ? <Check size={14} /> : null}
+ {authResult.ok
+ ? t('larkConfig.credentialsValidated')
+ : `${t('larkConfig.authFailed')}: ${authResult.error}`}
+ </span>
+ )}
</div>
- <pre className="text-xs bg-white/70 rounded p-2 overflow-x-auto font-mono text-blue-900 whitespace-pre">{LARK_PERMISSIONS_JSON}</pre>
- <p className="text-xs text-blue-700">{t('larkConfig.step3BatchImportHint')}</p>
- </div>
- <details className="text-sm text-muted">
- <summary className="cursor-pointer font-medium text-text hover:text-accent transition-colors">{t('larkConfig.step3ManualList')}</summary>
- <ul className="space-y-1.5 mt-2 pl-1">
- {[1,2,3,4,5,6,7,8,9,10,11,12,13,14].map(i => (
- <li key={i} className="flex items-start gap-2">
- <code className="text-xs bg-neutral-100 px-1.5 py-0.5 rounded font-mono shrink-0">{i}</code>
- {t(`larkConfig.step3Item${i}`)}
- </li>
- ))}
- </ul>
- </details>
- </div>
- )}
- </div>
+ {wsStatus !== 'idle' && (
+ <div
+ className={clsx(
+ 'inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-[12px]',
+ wsStatus === 'connecting' && 'border-cyan/30 bg-cyan/[0.06] text-cyan',
+ wsStatus === 'connected' && 'border-mint/30 bg-mint/[0.08] text-mint',
+ wsStatus === 'error' && 'border-danger/30 bg-danger/10 text-danger'
+ )}
+ >
+ {wsStatus === 'connecting' && <RefreshCw size={14} className="animate-spin" />}
+ {wsStatus === 'connected' && <Wifi size={14} />}
+ {wsStatus === 'connecting' && t('larkConfig.step2ConnectingWs')}
+ {wsStatus === 'connected' && t('larkConfig.step2WsConnected')}
+ </div>
+ )}
- {/* Step 4: Configure Events, Callbacks & Long Connection */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader step={4} title={t('larkConfig.step4Title')} icon={<Radio size={16} className="text-accent" />} />
- {expandedSteps[4] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('larkConfig.step4Description')}</p>
-
- {eventsUrl && (
- <LinkButton url={eventsUrl} label={t('larkConfig.step4OpenLink')} />
- )}
-
- {/* Part A: Event subscription */}
- <div className="space-y-2">
- <h4 className="text-sm font-semibold text-text">{t('larkConfig.step4EventTitle')}</h4>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('larkConfig.step4Item1')}</li>
- <li>{t('larkConfig.step4Item2')}</li>
- <li>{t('larkConfig.step4Item3')}</li>
- </ol>
+ {authResult?.ok && chats.length > 0 && (
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <MessageSquare size={14} className="text-cyan" /> {t('larkConfig.chatListLabel')}
+ </label>
+ <p className="text-[11px] text-muted">{t('larkConfig.chatListHint')}</p>
+ <div className="max-h-32 overflow-y-auto rounded-lg border border-border bg-background px-3 py-2.5">
+ <ul className="space-y-1 text-[12px] text-foreground">
+ {chats.map((c: any) => (
+ <li key={c.id} className="flex items-center gap-2">
+ <Check size={12} className="shrink-0 text-mint" />
+ <span>{c.name}</span>
+ <span className="font-mono text-[11px] text-muted">({c.id})</span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </div>
+ )}
</div>
+ )}
+ </StepShell>
+
+ {/* Step 3 — Permissions */}
+ <StepShell active={expandedSteps[3]}>
+ <StepHeader step={3} title={t('larkConfig.step3Title')} icon={<Shield size={16} className="text-cyan" />} />
+ {expandedSteps[3] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('larkConfig.step3Description')}</p>
+
+ {permissionsUrl && <LinkButton url={permissionsUrl} label={t('larkConfig.step3OpenLink')} />}
+
+ <div className="space-y-2 rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2.5">
+ <div className="flex items-center justify-between">
+ <span className="text-[12px] font-semibold text-cyan">{t('larkConfig.step3BatchImport')}</span>
+ <button
+ onClick={copyPermissionsJson}
+ className="inline-flex items-center gap-1.5 rounded border border-cyan/30 bg-cyan/[0.08] px-2 py-0.5 text-[11px] font-medium text-cyan transition hover:bg-cyan/[0.16]"
+ >
+ {copiedJson ? <Check size={12} /> : <Copy size={12} />}
+ {copiedJson ? t('larkConfig.step3Copied') : t('larkConfig.step3CopyJson')}
+ </button>
+ </div>
+ <pre className="overflow-x-auto whitespace-pre rounded bg-background/80 px-3 py-2 font-mono text-[11px] text-foreground">
+ {LARK_PERMISSIONS_JSON}
+ </pre>
+ <p className="text-[11px] text-cyan/85">{t('larkConfig.step3BatchImportHint')}</p>
+ </div>
- {/* Part B: Callback subscription */}
- <div className="space-y-2">
- <h4 className="text-sm font-semibold text-text">{t('larkConfig.step4CallbackTitle')}</h4>
- <p className="text-sm text-muted">{t('larkConfig.step4CallbackDesc')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('larkConfig.step4CallbackItem1')}</li>
- <li>{t('larkConfig.step4CallbackItem2')}</li>
- <li>{t('larkConfig.step4CallbackItem3')}</li>
- </ol>
+ <details className="text-[12px] text-muted">
+ <summary className="cursor-pointer font-medium text-foreground transition hover:text-cyan">
+ {t('larkConfig.step3ManualList')}
+ </summary>
+ <ul className="mt-2 space-y-1.5 pl-1">
+ {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14].map((i) => (
+ <li key={i} className="flex items-start gap-2">
+ <code className="shrink-0 rounded bg-white/[0.06] px-1.5 py-0.5 font-mono text-[11px] text-foreground">
+ {i}
+ </code>
+ {t(`larkConfig.step3Item${i}`)}
+ </li>
+ ))}
+ </ul>
+ </details>
</div>
+ )}
+ </StepShell>
- <div className="bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-800">
- <strong>{t('slackConfig.important')}:</strong> {t('larkConfig.step4Tip')}
- </div>
+ {/* Step 4 — Events / callbacks / WS */}
+ <StepShell active={expandedSteps[4]}>
+ <StepHeader step={4} title={t('larkConfig.step4Title')} icon={<Radio size={16} className="text-cyan" />} />
+ {expandedSteps[4] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('larkConfig.step4Description')}</p>
- {/* FAQ callout */}
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 space-y-1.5">
- <div className="flex items-center gap-2 text-sm font-medium text-blue-800">
- <AlertTriangle size={14} className="text-blue-600" />
- {t('larkConfig.step4LongConnFaqTitle')}
+ {eventsUrl && <LinkButton url={eventsUrl} label={t('larkConfig.step4OpenLink')} />}
+
+ <div className="space-y-2">
+ <h4 className="text-[12px] font-semibold text-foreground">{t('larkConfig.step4EventTitle')}</h4>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('larkConfig.step4Item1')}</li>
+ <li>{t('larkConfig.step4Item2')}</li>
+ <li>{t('larkConfig.step4Item3')}</li>
+ </ol>
+ </div>
+
+ <div className="space-y-2">
+ <h4 className="text-[12px] font-semibold text-foreground">{t('larkConfig.step4CallbackTitle')}</h4>
+ <p className="text-[12px] text-muted">{t('larkConfig.step4CallbackDesc')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('larkConfig.step4CallbackItem1')}</li>
+ <li>{t('larkConfig.step4CallbackItem2')}</li>
+ <li>{t('larkConfig.step4CallbackItem3')}</li>
+ </ol>
+ </div>
+
+ <div className="rounded-lg border border-gold/30 bg-gold/10 px-3 py-2 text-[12px] leading-[1.55] text-gold">
+ <strong>{t('slackConfig.important')}:</strong> {t('larkConfig.step4Tip')}
+ </div>
+
+ <div className="space-y-1.5 rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2.5">
+ <div className="flex items-center gap-2 text-[12px] font-semibold text-cyan">
+ <AlertTriangle size={14} />
+ {t('larkConfig.step4LongConnFaqTitle')}
+ </div>
+ <p className="text-[11px] text-cyan/85">{t('larkConfig.step4LongConnFaqDesc')}</p>
+ <p className="text-[11px] font-medium text-cyan">{t('larkConfig.step4LarkWsWarning')}</p>
</div>
- <p className="text-xs text-blue-700">{t('larkConfig.step4LongConnFaqDesc')}</p>
- <p className="text-xs text-blue-700 font-medium">{t('larkConfig.step4LarkWsWarning')}</p>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- {/* Step 5: Publish App */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader step={5} title={t('larkConfig.step5Title')} icon={<BookOpen size={16} className="text-accent" />} />
- {expandedSteps[5] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('larkConfig.step5Description')}</p>
-
- {versionUrl && (
- <LinkButton url={versionUrl} label={t('larkConfig.step5OpenLink')} />
- )}
-
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('larkConfig.step5Item1')}</li>
- </ol>
- <div className="bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-800">
- <strong>{t('slackConfig.important')}:</strong> {t('larkConfig.step5Tip')}
+ {/* Step 5 — Publish */}
+ <StepShell active={expandedSteps[5]}>
+ <StepHeader step={5} title={t('larkConfig.step5Title')} icon={<BookOpen size={16} className="text-cyan" />} />
+ {expandedSteps[5] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('larkConfig.step5Description')}</p>
+
+ {versionUrl && <LinkButton url={versionUrl} label={t('larkConfig.step5OpenLink')} />}
+
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('larkConfig.step5Item1')}</li>
+ </ol>
+ <div className="rounded-lg border border-gold/30 bg-gold/10 px-3 py-2 text-[12px] leading-[1.55] text-gold">
+ <strong>{t('slackConfig.important')}:</strong> {t('larkConfig.step5Tip')}
+ </div>
</div>
- </div>
- )}
+ )}
+ </StepShell>
</div>
- </div>
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium transition-colors">
- {t('common.back')}
- </button>
- <button
- onClick={() => {
- api.larkTempWsStop().catch(() => {});
- onNext({
- platform: 'lark',
- lark: {
- ...(data.lark || {}),
- app_id: appId,
- app_secret: appSecret,
- domain: domain,
- },
- });
- }}
- disabled={!isValid}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- isValid ? 'bg-accent hover:bg-accent/90 text-white' : 'bg-neutral-200 text-muted cursor-not-allowed'
- )}
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ api.larkTempWsStop().catch(() => {});
+ onNext({
+ platform: 'lark',
+ lark: {
+ ...(data.lark || {}),
+ app_id: appId,
+ app_secret: appSecret,
+ domain,
+ },
+ });
+ }}
+ disabled={!isValid}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/steps/LogsPanel.tsx b/ui/src/components/steps/LogsPanel.tsx
index 9859a1ba9..3950112d0 100644
--- a/ui/src/components/steps/LogsPanel.tsx
+++ b/ui/src/components/steps/LogsPanel.tsx
@@ -1,28 +1,42 @@
-import React, { useEffect, useState, useMemo, useRef } from 'react';
-import { FileText, RefreshCw, Search, Filter, ArrowDown, Pause, Play } from 'lucide-react';
+import React, { useEffect, useMemo, useRef, useState } from 'react';
+import {
+ ArrowDown,
+ FileText,
+ Filter,
+ Pause,
+ Play,
+ RefreshCw,
+ Search,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import { useApi, type LogEntry, type LogSource } from '../../context/ApiContext';
import clsx from 'clsx';
+import { useApi, type LogEntry, type LogSource } from '../../context/ApiContext';
+
type LogLevel = 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR' | 'ALL';
-const LOG_LEVEL_COLORS: Record<string, { bg: string; text: string; border: string }> = {
- DEBUG: { bg: 'bg-neutral-100', text: 'text-neutral-500', border: 'border-neutral-200' },
- INFO: { bg: 'bg-blue-50', text: 'text-blue-600', border: 'border-blue-200' },
- WARNING: { bg: 'bg-yellow-50', text: 'text-yellow-600', border: 'border-yellow-200' },
- ERROR: { bg: 'bg-red-50', text: 'text-red-600', border: 'border-red-200' },
+const LEVEL_PILL: Record<string, string> = {
+ DEBUG: 'border-border bg-white/[0.04] text-muted',
+ INFO: 'border-cyan/30 bg-cyan/[0.08] text-cyan',
+ WARNING: 'border-gold/30 bg-gold/[0.08] text-gold',
+ ERROR: 'border-danger/30 bg-danger/[0.08] text-danger',
};
-// Parse file location from message like "[__init__.py:246] - actual message"
const parseLogMessage = (message: string): { location?: string; content: string } => {
const match = message.match(/^\[([^\]]+)\]\s*-?\s*(.*)$/s);
- if (match) {
- return { location: match[1], content: match[2] };
- }
+ if (match) return { location: match[1], content: match[2] };
return { content: message };
};
-export const LogsPanel: React.FC = () => {
+interface LogsPanelProps {
+ titleKey?: string;
+ compactHeader?: boolean;
+}
+
+export const LogsPanel: React.FC<LogsPanelProps> = ({
+ titleKey = 'logs.title',
+ compactHeader = false,
+}) => {
const { t } = useTranslation();
const api = useApi();
const [logs, setLogs] = useState<LogEntry[]>([]);
@@ -51,9 +65,9 @@ export const LogsPanel: React.FC = () => {
useEffect(() => {
void loadLogs();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- // Auto-refresh logic
useEffect(() => {
if (autoRefresh) {
autoRefreshRef.current = setInterval(() => {
@@ -68,34 +82,33 @@ export const LogsPanel: React.FC = () => {
clearInterval(autoRefreshRef.current);
}
};
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [autoRefresh, selectedSource]);
- // Auto-scroll to bottom when new logs arrive
useEffect(() => {
if (logsContainerRef.current) {
- logsContainerRef.current.scrollTop = 0; // Since we reverse the list, top is newest
+ logsContainerRef.current.scrollTop = 0;
}
}, [logs]);
- // Filter logs based on search and level
- const filteredLogs = useMemo(() => {
- return logs.filter((log) => {
- const matchesLevel = levelFilter === 'ALL' || log.level === levelFilter;
- const matchesSearch = !searchQuery ||
- log.message.toLowerCase().includes(searchQuery.toLowerCase()) ||
- log.logger.toLowerCase().includes(searchQuery.toLowerCase()) ||
- log.timestamp.includes(searchQuery);
- return matchesLevel && matchesSearch;
- });
- }, [logs, levelFilter, searchQuery]);
+ const filteredLogs = useMemo(
+ () =>
+ logs.filter((log) => {
+ const matchesLevel = levelFilter === 'ALL' || log.level === levelFilter;
+ const matchesSearch =
+ !searchQuery ||
+ log.message.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ log.logger.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ log.timestamp.includes(searchQuery);
+ return matchesLevel && matchesSearch;
+ }),
+ [logs, levelFilter, searchQuery]
+ );
- // Count logs by level
const levelCounts = useMemo(() => {
const counts: Record<string, number> = { DEBUG: 0, INFO: 0, WARNING: 0, ERROR: 0 };
logs.forEach((log) => {
- if (counts[log.level] !== undefined) {
- counts[log.level]++;
- }
+ if (counts[log.level] !== undefined) counts[log.level]++;
});
return counts;
}, [logs]);
@@ -124,199 +137,207 @@ export const LogsPanel: React.FC = () => {
}
};
- const LogLevelBadge = ({ level }: { level: string }) => {
- const colors = LOG_LEVEL_COLORS[level] || LOG_LEVEL_COLORS.INFO;
- return (
- <span className={clsx(
- 'px-1.5 py-0.5 rounded text-xs font-medium border min-w-[60px] text-center inline-block',
- colors.bg, colors.text, colors.border
- )}>
- {level}
- </span>
- );
- };
-
- const scrollToBottom = () => {
- if (logsContainerRef.current) {
- logsContainerRef.current.scrollTop = 0;
- }
+ const scrollToTop = () => {
+ if (logsContainerRef.current) logsContainerRef.current.scrollTop = 0;
};
return (
- <div className="max-w-6xl mx-auto flex flex-col h-full">
- <div className="flex items-center justify-between mb-6">
- <h2 className="text-3xl font-display font-bold flex items-center gap-2">
- <FileText className="text-accent" />
- {t('logs.title')}
- </h2>
- <div className="flex gap-2">
+ <div className="flex h-full flex-col gap-4">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ {!compactHeader && (
+ <h2 className="inline-flex items-center gap-2 text-[24px] font-bold tracking-[-0.3px] text-foreground">
+ <FileText className="size-5 text-cyan" />
+ {t(titleKey)}
+ </h2>
+ )}
+ <div className="flex flex-wrap gap-2">
<button
+ type="button"
onClick={() => setAutoRefresh(!autoRefresh)}
className={clsx(
- 'flex items-center gap-2 px-3 py-2 border rounded-lg text-sm transition-colors',
- autoRefresh
- ? 'bg-accent/10 border-accent text-accent'
- : 'border-border text-muted hover:bg-neutral-50 hover:text-text'
+ 'inline-flex h-9 items-center gap-1.5 rounded-lg border px-3 text-[12px] font-medium transition',
+ autoRefresh
+ ? 'border-cyan/40 bg-cyan/[0.08] text-cyan'
+ : 'border-border bg-white/[0.04] text-foreground hover:border-border-strong'
)}
>
- {autoRefresh ? <Pause size={16} /> : <Play size={16} />}
+ {autoRefresh ? <Pause className="size-3.5" /> : <Play className="size-3.5" />}
{autoRefresh ? t('logs.autoRefreshOn') : t('logs.autoRefresh')}
</button>
<button
+ type="button"
onClick={() => void loadLogs(selectedSource)}
disabled={loading}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 disabled:opacity-50 transition-colors font-medium shadow-sm"
+ className="inline-flex h-9 items-center gap-1.5 rounded-lg bg-mint px-3 text-[12px] font-bold text-[#080812] shadow-[0_0_18px_-4px_rgba(91,255,160,0.55)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- <RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
+ <RefreshCw className={clsx('size-3.5', loading && 'animate-spin')} strokeWidth={2.5} />
{t('common.refresh')}
</button>
</div>
</div>
- <div className="space-y-4 flex-1 flex flex-col min-h-0">
- {/* Search and Filter Bar */}
- <div className="flex gap-3 items-center flex-wrap">
- <div className="relative flex-1 min-w-[200px]">
- <Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted" />
- <input
- type="text"
- placeholder={t('logs.searchPlaceholder')}
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- className="w-full pl-10 pr-4 py-2 border border-border rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent"
- />
- </div>
- <div className="flex items-center gap-2">
- <Filter size={16} className="text-muted" />
- <select
- value={levelFilter}
- onChange={(e) => setLevelFilter(e.target.value as LogLevel)}
- className="px-3 py-2 border border-border rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-accent/20"
- >
- <option value="ALL">{t('logs.allLevels')}</option>
- <option value="ERROR">{t('logs.error')} ({levelCounts.ERROR})</option>
- <option value="WARNING">{t('logs.warning')} ({levelCounts.WARNING})</option>
- <option value="INFO">{t('logs.info')} ({levelCounts.INFO})</option>
- <option value="DEBUG">{t('logs.debug')} ({levelCounts.DEBUG})</option>
- </select>
- </div>
+ <div className="flex flex-wrap items-center gap-3">
+ <div className="relative min-w-[220px] flex-1">
+ <Search className="absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted" />
+ <input
+ type="text"
+ placeholder={t('logs.searchPlaceholder')}
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ className="h-9 w-full rounded-lg border border-border bg-white/[0.04] pl-9 pr-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
</div>
+ <div className="flex items-center gap-2">
+ <Filter className="size-3.5 text-muted" />
+ <select
+ value={levelFilter}
+ onChange={(e) => setLevelFilter(e.target.value as LogLevel)}
+ className="h-9 rounded-lg border border-border bg-white/[0.04] px-3 text-[12px] text-foreground outline-none transition focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ >
+ <option value="ALL">{t('logs.allLevels')}</option>
+ <option value="ERROR">{t('logs.error')} ({levelCounts.ERROR})</option>
+ <option value="WARNING">{t('logs.warning')} ({levelCounts.WARNING})</option>
+ <option value="INFO">{t('logs.info')} ({levelCounts.INFO})</option>
+ <option value="DEBUG">{t('logs.debug')} ({levelCounts.DEBUG})</option>
+ </select>
+ </div>
+ </div>
- {/* Level Quick Filters */}
- <div className="flex gap-2 flex-wrap">
+ {sources.length > 0 && (
+ <div className="flex flex-wrap gap-1.5">
{sources.map((source) => (
<button
key={source.key}
+ type="button"
onClick={() => void loadLogs(source.key)}
className={clsx(
- 'px-3 py-1.5 rounded-full text-xs font-medium border transition-colors',
+ 'inline-flex h-7 items-center gap-1 rounded-full border px-3 text-[11px] font-medium transition-colors',
selectedSource === source.key
- ? 'bg-accent text-white border-accent'
- : 'bg-white text-muted border-border hover:border-accent/50'
+ ? 'border-mint/35 bg-mint/[0.08] text-mint shadow-[0_0_12px_-4px_rgba(91,255,160,0.5)]'
+ : 'border-border bg-white/[0.04] text-muted hover:border-border-strong hover:text-foreground'
)}
>
{getSourceLabel(source.key)}
- {source.total > 0 && ` (${source.total})`}
+ {source.total > 0 && (
+ <span className="font-mono text-[10px] opacity-70">{source.total}</span>
+ )}
</button>
))}
</div>
+ )}
- <div className="flex gap-2 flex-wrap">
- {(['ALL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'] as LogLevel[]).map((level) => (
+ <div className="flex flex-wrap gap-1.5">
+ {(['ALL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'] as LogLevel[]).map((level) => (
+ <button
+ key={level}
+ type="button"
+ onClick={() => setLevelFilter(level)}
+ className={clsx(
+ 'inline-flex h-7 items-center gap-1 rounded-full border px-3 text-[11px] font-medium transition-colors',
+ levelFilter === level
+ ? 'border-cyan/40 bg-cyan/[0.08] text-cyan'
+ : 'border-border bg-white/[0.04] text-muted hover:border-border-strong hover:text-foreground'
+ )}
+ >
+ {level === 'ALL' ? t('logs.all') : level}
+ {level !== 'ALL' && (
+ <span className="font-mono text-[10px] opacity-70">{levelCounts[level]}</span>
+ )}
+ </button>
+ ))}
+ </div>
+
+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-background">
+ <div className="flex shrink-0 items-center justify-between gap-3 border-b border-border bg-white/[0.02] px-4 py-2.5">
+ <span className="font-mono text-[11px] font-medium text-muted">
+ {t('logs.entriesCount', { filtered: filteredLogs.length, total: logs.length })}
+ {logsTotal > logs.length && ` · ${t('logs.totalInFile', { total: logsTotal })}`}
+ </span>
+ <div className="flex items-center gap-3">
<button
- key={level}
- onClick={() => setLevelFilter(level)}
- className={clsx(
- 'px-3 py-1 rounded-full text-xs font-medium border transition-colors',
- levelFilter === level
- ? 'bg-accent text-white border-accent'
- : 'bg-white text-muted border-border hover:border-accent/50'
- )}
+ type="button"
+ onClick={scrollToTop}
+ className="inline-flex items-center gap-1 text-[11px] font-medium text-cyan transition hover:text-cyan/80"
>
- {level === 'ALL' ? t('logs.all') : level}
- {level !== 'ALL' && ` (${levelCounts[level]})`}
+ <ArrowDown className="size-3" /> {t('logs.jumpToLatest')}
</button>
- ))}
+ <code className="rounded border border-border bg-background px-2 py-0.5 font-mono text-[10px] text-muted">
+ {selectedSourceMeta?.path || t('logs.allFiles')}
+ </code>
+ </div>
</div>
- {/* Logs List */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden shadow-sm flex-1 flex flex-col min-h-0">
- <div className="px-4 py-3 bg-neutral-50 border-b border-border flex justify-between items-center flex-shrink-0">
- <span className="font-semibold text-sm text-muted">
- {t('logs.entriesCount', { filtered: filteredLogs.length, total: logs.length })}
- {logsTotal > logs.length && ` ${t('logs.totalInFile', { total: logsTotal })}`}
- </span>
- <div className="flex items-center gap-3">
- <button
- onClick={scrollToBottom}
- className="text-xs text-accent hover:underline flex items-center gap-1"
- >
- <ArrowDown size={12} /> {t('logs.jumpToLatest')}
- </button>
- <code className="text-xs text-muted bg-neutral-100 px-2 py-1 rounded">
- {selectedSourceMeta?.path || t('logs.allFiles')}
- </code>
+ {loading && logs.length === 0 ? (
+ <div className="flex flex-1 items-center justify-center p-8 text-[12px] text-muted">
+ <div className="flex flex-col items-center gap-2">
+ <RefreshCw className="size-5 animate-spin" />
+ {t('logs.loadingLogs')}
</div>
</div>
-
- {loading && logs.length === 0 ? (
- <div className="p-8 text-center text-muted flex-1 flex items-center justify-center">
- <div>
- <RefreshCw size={24} className="animate-spin mx-auto mb-2" />
- {t('logs.loadingLogs')}
- </div>
- </div>
- ) : filteredLogs.length === 0 ? (
- <div className="p-8 text-center text-muted flex-1 flex items-center justify-center">
- {logs.length === 0 ? t('logs.noLogsAvailable') : t('logs.noLogsMatch')}
- </div>
- ) : (
- <div
- ref={logsContainerRef}
- className="divide-y divide-border overflow-y-auto flex-1 font-mono text-sm"
- style={{ minHeight: '500px', maxHeight: 'calc(100vh - 380px)' }}
- >
- {filteredLogs.slice().reverse().map((log, i) => {
+ ) : filteredLogs.length === 0 ? (
+ <div className="flex flex-1 items-center justify-center p-8 text-[12px] text-muted">
+ {logs.length === 0 ? t('logs.noLogsAvailable') : t('logs.noLogsMatch')}
+ </div>
+ ) : (
+ <div
+ ref={logsContainerRef}
+ className="flex-1 divide-y divide-border overflow-y-auto"
+ style={{ minHeight: '500px', maxHeight: 'calc(100vh - 380px)' }}
+ >
+ {filteredLogs
+ .slice()
+ .reverse()
+ .map((log, i) => {
const { location, content } = parseLogMessage(log.message);
return (
- <div
- key={i}
+ <div
+ key={i}
className={clsx(
- 'p-3 hover:bg-neutral-50/50 transition-colors',
- log.level === 'ERROR' && 'bg-red-50/30',
- log.level === 'WARNING' && 'bg-yellow-50/30'
+ 'px-4 py-2.5 transition-colors hover:bg-white/[0.02]',
+ log.level === 'ERROR' && 'bg-danger/[0.04]',
+ log.level === 'WARNING' && 'bg-gold/[0.04]'
)}
>
- <div className="flex items-center gap-2 flex-wrap">
- <span className="text-muted text-xs whitespace-nowrap">
- {log.timestamp}
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="font-mono text-[10px] text-muted">{log.timestamp}</span>
+ <span
+ className={clsx(
+ 'inline-block min-w-[60px] rounded border px-1.5 py-0.5 text-center font-mono text-[10px] font-bold',
+ LEVEL_PILL[log.level] || LEVEL_PILL.INFO
+ )}
+ >
+ {log.level}
</span>
- <LogLevelBadge level={log.level} />
- <span className="text-muted text-xs truncate max-w-[200px]" title={log.logger}>
+ <span
+ className="max-w-[220px] truncate font-mono text-[10px] text-muted"
+ title={log.logger}
+ >
{log.logger}
</span>
- <span className="text-muted/60 text-xs font-normal">
+ <span className="font-mono text-[10px] text-muted/70">
{getSourceLabel(log.source)}
</span>
{location && (
- <span className="text-muted/60 text-xs font-normal">
- [{location}]
- </span>
+ <span className="font-mono text-[10px] text-muted/70">[{location}]</span>
)}
</div>
- <div className={clsx(
- 'mt-1.5 whitespace-pre-wrap break-words leading-relaxed',
- log.level === 'ERROR' ? 'text-red-700' :
- log.level === 'WARNING' ? 'text-yellow-700' : 'text-text'
- )}>
+ <div
+ className={clsx(
+ 'mt-1.5 whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed',
+ log.level === 'ERROR'
+ ? 'text-danger'
+ : log.level === 'WARNING'
+ ? 'text-gold'
+ : 'text-foreground'
+ )}
+ >
{content}
</div>
</div>
);
})}
- </div>
- )}
- </div>
+ </div>
+ )}
</div>
</div>
);
diff --git a/ui/src/components/steps/PlatformSelection.tsx b/ui/src/components/steps/PlatformSelection.tsx
index 350f408f2..9e971784d 100644
--- a/ui/src/components/steps/PlatformSelection.tsx
+++ b/ui/src/components/steps/PlatformSelection.tsx
@@ -1,20 +1,79 @@
-import React, { useMemo, useState } from 'react';
+import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
+import { ArrowLeft, ArrowRight, Check, ExternalLink, Info, Loader2, Plus } from 'lucide-react';
+import { useApi } from '../../context/ApiContext';
+import { useToast } from '../../context/ToastContext';
import { getEnabledPlatforms, getPlatformCatalog, getPrimaryPlatform } from '../../lib/platforms';
+import { EyebrowBadge, PlatformIcon, WizardCard } from '../visual';
+
+// Per-platform brand-tinted tile container colors (matches design.pen wT*L
+// frames: Slack purple-soft, Discord indigo-soft, etc.).
+const PLATFORM_TILE_STYLES: Record<string, { bg: string; border: string }> = {
+ slack: { bg: 'bg-[#4A154B26]', border: 'border-[#4A154B66]' },
+ discord: { bg: 'bg-[#5865F226]', border: 'border-[#5865F255]' },
+ telegram: { bg: 'bg-[#0088CC26]', border: 'border-[#0088CC55]' },
+ lark: { bg: 'bg-[#06A0FB1F]', border: 'border-[#06A0FB55]' },
+ feishu: { bg: 'bg-[#06A0FB1F]', border: 'border-[#06A0FB55]' },
+ wechat: { bg: 'bg-[#07C16026]', border: 'border-[#07C16055]' },
+};
interface PlatformSelectionProps {
data: any;
onNext: (data: any) => void;
- onBack: () => void;
+ onBack?: () => void;
+ isPage?: boolean;
+ onSave?: (data: any) => Promise<void> | void;
}
-export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNext, onBack }) => {
+type ValidationState = 'idle' | 'success' | 'error';
+
+const buildInitialCredentialDraft = (data: any) => ({
+ slack: {
+ ...(data.slack || {}),
+ bot_token: data.slack?.bot_token || data.slackBotToken || '',
+ app_token: data.slack?.app_token || data.slackAppToken || '',
+ },
+ discord: {
+ ...(data.discord || {}),
+ bot_token: data.discord?.bot_token || '',
+ client_id: data.discord?.client_id || data.discord_client_id || '',
+ },
+ telegram: {
+ require_mention: true,
+ forum_auto_topic: true,
+ ...(data.telegram || {}),
+ bot_token: data.telegram?.bot_token || '',
+ },
+ lark: {
+ domain: 'feishu',
+ ...(data.lark || {}),
+ app_id: data.lark?.app_id || '',
+ app_secret: data.lark?.app_secret || '',
+ },
+ wechat: {
+ ...(data.wechat || {}),
+ },
+});
+
+export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNext, onBack, isPage = false, onSave }) => {
const { t } = useTranslation();
+ const api = useApi();
+ const { showToast } = useToast();
const initialPlatforms = useMemo(() => getEnabledPlatforms(data), [data]);
const platformCatalog = useMemo(() => getPlatformCatalog(data), [data]);
const [selected, setSelected] = useState<string[]>(initialPlatforms);
const [primary, setPrimary] = useState<string>(getPrimaryPlatform(data));
+ const [activeCredentialPlatform, setActiveCredentialPlatform] = useState<string>(getPrimaryPlatform(data));
+ const [credentialDraft, setCredentialDraft] = useState<Record<string, any>>(() => buildInitialCredentialDraft(data));
+ const [validating, setValidating] = useState(false);
+ const [validationState, setValidationState] = useState<Record<string, ValidationState>>({});
+
+ useEffect(() => {
+ if (!selected.includes(activeCredentialPlatform)) {
+ setActiveCredentialPlatform(selected[0] || platformCatalog[0]?.id || 'slack');
+ }
+ }, [activeCredentialPlatform, platformCatalog, selected]);
const togglePlatform = (platform: string) => {
setSelected((current) => {
@@ -32,102 +91,517 @@ export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNe
if (!current.length) {
setPrimary(platform);
}
+ setActiveCredentialPlatform(platform);
return next;
});
};
- const handleContinue = () => {
+ const updateCredential = (platform: string, patch: Record<string, any>) => {
+ setCredentialDraft((current) => ({
+ ...current,
+ [platform]: {
+ ...(current[platform] || {}),
+ ...patch,
+ },
+ }));
+ setValidationState((current) => ({ ...current, [platform]: 'idle' }));
+ };
+
+ const handleContinue = async () => {
const normalized = selected.length ? selected : [platformCatalog[0]?.id || 'slack'];
const resolvedPrimary = normalized.includes(primary) ? primary : normalized[0];
- onNext({
+ const nextData = {
+ ...credentialDraft,
+ discord_client_id: credentialDraft.discord?.client_id || '',
platform: resolvedPrimary,
platforms: {
enabled: normalized,
primary: resolvedPrimary,
},
- });
+ };
+
+ if (isPage && onSave) {
+ await onSave(nextData);
+ return;
+ }
+
+ onNext(nextData);
};
- return (
- <div className="flex flex-col h-full max-w-3xl mx-auto">
- <div className="mb-6">
- <h2 className="text-3xl font-display font-bold text-text">{t('platform.title')}</h2>
- <p className="text-muted mt-1">{t('platform.subtitle')}</p>
- </div>
+ const activeDescriptor = platformCatalog.find((item) => item.id === activeCredentialPlatform) || platformCatalog[0];
+ const activePlatformLabel = t(activeDescriptor?.title_key || `platform.${activeCredentialPlatform}.title`);
+ const activeCredential = credentialDraft[activeCredentialPlatform] || {};
+ const currentValidationState = validationState[activeCredentialPlatform] || 'idle';
+
+ const getExternalUrl = (platform: string) => {
+ if (platform === 'slack') return 'https://api.slack.com/apps';
+ if (platform === 'discord') return 'https://discord.com/developers/applications';
+ if (platform === 'telegram') return 'https://t.me/BotFather';
+ if (platform === 'lark') return activeCredential.domain === 'lark' ? 'https://open.larksuite.com/app' : 'https://open.feishu.cn/app';
+ return '';
+ };
+
+ const canValidate = () => {
+ if (activeCredentialPlatform === 'slack') return Boolean(activeCredential.bot_token);
+ if (activeCredentialPlatform === 'discord') return Boolean(activeCredential.bot_token);
+ if (activeCredentialPlatform === 'telegram') return Boolean(activeCredential.bot_token);
+ if (activeCredentialPlatform === 'lark') return Boolean(activeCredential.app_id && activeCredential.app_secret);
+ return false;
+ };
+
+ const validateActivePlatform = async () => {
+ if (!canValidate()) return;
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4 flex-1">
- {platformCatalog.map((platform) => {
- const option = platform.id;
- const active = selected.includes(option);
- return (
- <button
- type="button"
- key={option}
- onClick={() => togglePlatform(option)}
- className={clsx(
- 'text-left p-5 rounded-xl border transition-colors shadow-sm relative',
- active ? 'border-accent bg-accent/5' : 'border-border bg-panel hover:border-accent/60'
- )}
+ setValidating(true);
+ try {
+ let result: any = { ok: false };
+ if (activeCredentialPlatform === 'slack') {
+ result = await api.slackAuthTest(activeCredential.bot_token);
+ } else if (activeCredentialPlatform === 'discord') {
+ result = await api.discordAuthTest(activeCredential.bot_token);
+ } else if (activeCredentialPlatform === 'telegram') {
+ result = await api.telegramAuthTest(activeCredential.bot_token);
+ } else if (activeCredentialPlatform === 'lark') {
+ result = await api.larkAuthTest(activeCredential.app_id, activeCredential.app_secret, activeCredential.domain);
+ }
+
+ const ok = result?.ok !== false;
+ setValidationState((current) => ({ ...current, [activeCredentialPlatform]: ok ? 'success' : 'error' }));
+ showToast(ok ? t('platform.validationSuccess') : t('platform.validationFailed'), ok ? 'success' : 'error');
+ } catch {
+ setValidationState((current) => ({ ...current, [activeCredentialPlatform]: 'error' }));
+ } finally {
+ setValidating(false);
+ }
+ };
+
+ const renderCredentialFields = () => {
+ if (activeCredentialPlatform === 'slack') {
+ return (
+ <>
+ <CredentialInput
+ label={t('slackConfig.botToken')}
+ value={activeCredential.bot_token || ''}
+ placeholder={t('slackConfig.botTokenPlaceholder')}
+ hint={`${t('slackConfig.botTokenHint')} xoxb-`}
+ onChange={(value) => updateCredential('slack', { bot_token: value })}
+ />
+ <CredentialInput
+ label={t('slackConfig.appToken')}
+ value={activeCredential.app_token || ''}
+ placeholder={t('slackConfig.appTokenPlaceholder')}
+ hint={`${t('slackConfig.appTokenHint')} xapp-`}
+ onChange={(value) => updateCredential('slack', { app_token: value })}
+ />
+ </>
+ );
+ }
+
+ if (activeCredentialPlatform === 'discord') {
+ return (
+ <>
+ <CredentialInput
+ label={t('discordConfig.clientId')}
+ value={activeCredential.client_id || ''}
+ placeholder={t('discordConfig.clientIdPlaceholder')}
+ hint={t('discordConfig.clientIdHint')}
+ type="text"
+ onChange={(value) => updateCredential('discord', { client_id: value })}
+ />
+ <CredentialInput
+ label={t('discordConfig.botToken')}
+ value={activeCredential.bot_token || ''}
+ placeholder={t('discordConfig.botTokenPlaceholder')}
+ hint={t('discordConfig.botTokenHint')}
+ onChange={(value) => updateCredential('discord', { bot_token: value })}
+ />
+ </>
+ );
+ }
+
+ if (activeCredentialPlatform === 'telegram') {
+ return (
+ <>
+ <CredentialInput
+ label={t('telegramConfig.botToken')}
+ value={activeCredential.bot_token || ''}
+ placeholder={t('telegramConfig.botTokenPlaceholder')}
+ hint={t('telegramConfig.botTokenHint')}
+ onChange={(value) => updateCredential('telegram', { bot_token: value })}
+ />
+ <div className="grid gap-2 md:grid-cols-2">
+ <CredentialToggle
+ label={t('telegramConfig.requireMention')}
+ checked={activeCredential.require_mention ?? true}
+ onChange={(checked) => updateCredential('telegram', { require_mention: checked })}
+ />
+ <CredentialToggle
+ label={t('telegramConfig.forumAutoTopic')}
+ checked={activeCredential.forum_auto_topic ?? true}
+ onChange={(checked) => updateCredential('telegram', { forum_auto_topic: checked })}
+ />
+ </div>
+ </>
+ );
+ }
+
+ if (activeCredentialPlatform === 'lark') {
+ return (
+ <>
+ <label className="grid gap-1.5">
+ <span className="text-[11px] font-medium text-muted">{t('larkConfig.domainLabel')}</span>
+ <select
+ value={activeCredential.domain || 'feishu'}
+ onChange={(event) => updateCredential('lark', { domain: event.target.value })}
+ className="h-9 rounded-md border border-border bg-background px-3 text-[12px] text-foreground outline-none focus:border-mint"
>
- <div className="flex items-start justify-between gap-3">
- <div>
- <div className="text-lg font-semibold text-text">{t(platform.title_key || `platform.${option}.title`)}</div>
- <div className="text-sm text-muted mt-2">{t(platform.description_key || `platform.${option}.desc`)}</div>
- </div>
- <div
- className={clsx(
- 'mt-1 h-5 w-5 rounded-full border flex items-center justify-center text-xs font-bold',
- active ? 'border-accent bg-accent text-white' : 'border-border bg-bg'
- )}
+ <option value="feishu">{t('larkConfig.domainFeishu')}</option>
+ <option value="lark">{t('larkConfig.domainLark')}</option>
+ </select>
+ </label>
+ <CredentialInput
+ label={t('larkConfig.appId')}
+ value={activeCredential.app_id || ''}
+ placeholder={t('larkConfig.appIdPlaceholder')}
+ hint={t('larkConfig.appIdHint')}
+ type="text"
+ onChange={(value) => updateCredential('lark', { app_id: value })}
+ />
+ <CredentialInput
+ label={t('larkConfig.appSecret')}
+ value={activeCredential.app_secret || ''}
+ placeholder={t('larkConfig.appSecretPlaceholder')}
+ hint={t('larkConfig.appSecretHint')}
+ onChange={(value) => updateCredential('lark', { app_secret: value })}
+ />
+ </>
+ );
+ }
+
+ return (
+ <div className="rounded-md border border-border bg-background px-3 py-3 text-[12px] leading-relaxed text-muted">
+ {t('platform.wechatCredentialHint')}
+ </div>
+ );
+ };
+
+ if (isPage) {
+ return (
+ <div className="mx-auto max-w-[920px]">
+ <section className="overflow-hidden rounded-md border border-border bg-surface-2/45">
+ <div className="border-b border-border px-4 py-3">
+ <div className="flex items-start justify-between gap-3">
+ <div className="min-w-0">
+ <h2 className="text-[12px] font-semibold text-foreground">{t('platform.credentialsTitle')}</h2>
+ <p className="mt-1 max-w-2xl text-[10px] leading-relaxed text-muted">{t('platform.credentialsSubtitle')}</p>
+ </div>
+ <button
+ type="button"
+ className="inline-flex h-6 shrink-0 items-center rounded-md border border-border bg-surface-3 px-2 text-[10px] font-medium text-foreground"
+ >
+ {t('common.edit')}
+ </button>
+ </div>
+
+ <div className="mt-3 flex flex-wrap gap-1.5">
+ {platformCatalog.map((platform) => {
+ const option = platform.id;
+ const active = selected.includes(option);
+ const focused = activeCredentialPlatform === option;
+ const label = t(platform.title_key || `platform.${option}.title`);
+ return (
+ <button
+ key={option}
+ type="button"
+ onClick={() => {
+ if (!active) {
+ togglePlatform(option);
+ }
+ setActiveCredentialPlatform(option);
+ }}
+ className={clsx(
+ 'inline-flex h-7 min-w-[118px] items-center justify-between gap-2 rounded-[5px] border px-2 text-[11px] font-medium transition-colors',
+ active
+ ? 'border-mint/35 bg-mint-soft text-foreground'
+ : 'border-border bg-surface-3 text-muted hover:border-border-strong',
+ focused && 'ring-1 ring-mint/30'
+ )}
+ >
+ <span className="truncate">{label}</span>
+ {active ? <Check className="size-3 text-mint" /> : <Plus className="size-3" />}
+ </button>
+ );
+ })}
+ </div>
+
+ <div className="mt-2 flex flex-col gap-2 border-t border-border pt-2 md:flex-row md:items-center md:justify-between">
+ <p className="text-[10px] text-muted">{t('platform.applyHint')}</p>
+ <div className="flex justify-end gap-2">
+ <button
+ type="button"
+ className="h-6 rounded-md border border-border bg-surface-3 px-2 text-[10px] font-medium text-foreground"
>
- {active ? selected.indexOf(option) + 1 : ''}
- </div>
+ {t('common.cancel')}
+ </button>
+ <button
+ type="button"
+ onClick={() => void handleContinue()}
+ disabled={!selected.length}
+ className="inline-flex h-6 items-center gap-1.5 rounded-md bg-primary px-2.5 text-[10px] font-semibold text-primary-foreground disabled:opacity-50"
+ >
+ <Check className="size-3" />
+ {t('platform.apply')}
+ </button>
+ </div>
+ </div>
+ </div>
+
+ <div className="border-b border-border px-4 py-2">
+ <div className="flex flex-col gap-2 md:flex-row md:items-center md:justify-between">
+ <div className="min-w-0">
+ <h2 className="text-[12px] font-semibold text-foreground">
+ {t('platform.credentialSetupTitle', { platform: activePlatformLabel })}
+ </h2>
+ <p className="mt-0.5 text-[10px] text-muted">{t('platform.credentialSetupSubtitle')}</p>
</div>
- {active && primary === option && (
- <div className="mt-4 inline-flex items-center rounded-full bg-success/10 text-success px-2 py-1 text-xs font-medium">
- {t('platform.primary')}
+ <div className="flex flex-wrap gap-1.5">
+ {selected.map((platform) => {
+ const descriptor = platformCatalog.find((item) => item.id === platform);
+ return (
+ <button
+ key={platform}
+ type="button"
+ onClick={() => setActiveCredentialPlatform(platform)}
+ className={clsx(
+ 'h-6 rounded-md border px-2.5 text-[10px] font-medium transition-colors',
+ activeCredentialPlatform === platform
+ ? 'border-mint/40 bg-mint-soft text-mint'
+ : 'border-border bg-surface-3 text-muted hover:border-border-strong'
+ )}
+ >
+ {t(descriptor?.title_key || `platform.${platform}.title`)}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ </div>
+
+ <div>
+ {[
+ t('platform.stepCreateApp'),
+ activeCredentialPlatform === 'slack' ? t('slackConfig.step2Title') : t('platform.stepAddBotToken'),
+ activeCredentialPlatform === 'slack' ? t('slackConfig.step3Title') : t('platform.stepConfigureOptions'),
+ activeCredentialPlatform === 'slack' ? t('slackConfig.step4Title') : t('platform.stepValidate'),
+ ].map((title, index) => {
+ const expanded = index === 2;
+ return (
+ <div
+ key={`${activeCredentialPlatform}-${title}`}
+ className={clsx('border-b border-border px-4 py-2 last:border-b-0', expanded && 'bg-mint-soft/10')}
+ >
+ <div className="flex items-center justify-between gap-3">
+ <div className="flex min-w-0 items-center gap-3">
+ <span
+ className={clsx(
+ 'flex size-4 shrink-0 items-center justify-center rounded-full border text-[9px] font-semibold',
+ index < 2 || currentValidationState === 'success'
+ ? 'border-mint bg-mint text-background'
+ : 'border-border bg-background text-muted'
+ )}
+ >
+ {index < 2 || currentValidationState === 'success' ? <Check className="size-2.5" /> : index + 1}
+ </span>
+ <div className="min-w-0">
+ <div className="text-[11px] font-medium text-foreground">{title}</div>
+ {expanded && (
+ <div className="mt-0.5 text-[9px] text-muted">
+ {t('platform.expandedStepHint', { platform: activePlatformLabel })}
+ </div>
+ )}
+ </div>
+ </div>
+ <div className="text-[9px] text-muted">{expanded ? t('platform.expanded') : t('platform.collapsed')}</div>
+ </div>
+
+ {expanded && (
+ <div className="mt-2 rounded-md border border-border bg-background/70 p-2.5">
+ <div className="rounded-md border border-border bg-surface-3 px-2.5 py-2 text-[10px] leading-relaxed text-muted">
+ {t('platform.credentialGuide', { platform: activePlatformLabel })}
+ </div>
+
+ <div className="mt-2 grid gap-2">{renderCredentialFields()}</div>
+
+ <div className="mt-2 flex flex-col gap-2 md:flex-row md:items-center md:justify-between">
+ {getExternalUrl(activeCredentialPlatform) ? (
+ <button
+ type="button"
+ onClick={() => window.open(getExternalUrl(activeCredentialPlatform), '_blank')}
+ className="inline-flex h-7 items-center justify-center gap-1.5 rounded-md border border-border bg-surface-3 px-2.5 text-[10px] font-medium text-foreground hover:border-border-strong"
+ >
+ <ExternalLink className="size-3" />
+ {t('platform.openConsole', { platform: activePlatformLabel })}
+ </button>
+ ) : <span />}
+ <button
+ type="button"
+ onClick={() => void validateActivePlatform()}
+ disabled={!canValidate() || validating || activeCredentialPlatform === 'wechat'}
+ className="inline-flex h-7 items-center justify-center gap-1.5 rounded-md bg-primary px-2.5 text-[10px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {validating ? <Loader2 className="size-3 animate-spin" /> : <Check className="size-3" />}
+ {t('platform.validateToken')}
+ </button>
+ </div>
+
+ {currentValidationState !== 'idle' && (
+ <div
+ className={clsx(
+ 'mt-2 rounded-md border px-2.5 py-1.5 text-[10px]',
+ currentValidationState === 'success'
+ ? 'border-mint/30 bg-mint-soft text-mint'
+ : 'border-danger/30 bg-danger/10 text-danger'
+ )}
+ >
+ {currentValidationState === 'success' ? t('platform.validationSuccess') : t('platform.validationFailed')}
+ </div>
+ )}
+ </div>
+ )}
</div>
- )}
- </button>
- );
- })}
+ );
+ })}
+ </div>
+ </section>
</div>
+ );
+ }
- <div className="mt-6 bg-panel border border-border rounded-xl p-4">
- <div className="text-sm font-medium text-text">{t('platform.primaryTitle')}</div>
- <p className="text-xs text-muted mt-1">{t('platform.primaryDesc')}</p>
- <div className="mt-3 flex flex-wrap gap-2">
- {selected.map((platform) => {
- const descriptor = platformCatalog.find((item) => item.id === platform);
+ // Wizard mode — design.pen jXiOv: WizardCard 840 wide with tile grid + tip.
+ // Primary platform is implicit: first selected, then locked to that order.
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-8">
+ <div className="flex flex-col gap-3">
+ <EyebrowBadge tone="mint">03 — Platforms</EyebrowBadge>
+ <h2 className="text-[34px] font-bold leading-[1.1] tracking-[-0.6px] text-foreground">
+ {t('platform.title')}
+ </h2>
+ <p className="max-w-[680px] text-[15px] leading-[1.5] text-muted">{t('platform.subtitle')}</p>
+ </div>
+
+ <div className="grid w-full grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-5">
+ {platformCatalog.map((platform) => {
+ const option = platform.id;
+ const active = selected.includes(option);
+ const tileTint = PLATFORM_TILE_STYLES[option] || {
+ bg: 'bg-white/[0.04]',
+ border: 'border-white/[0.10]',
+ };
return (
<button
- key={platform}
type="button"
- onClick={() => setPrimary(platform)}
+ key={option}
+ onClick={() => togglePlatform(option)}
className={clsx(
- 'px-3 py-1.5 rounded-full text-sm border transition-colors',
- primary === platform ? 'bg-accent text-white border-accent' : 'bg-bg text-text border-border hover:border-accent/60'
+ 'flex flex-col items-center gap-2.5 rounded-xl px-4 py-5 transition-colors',
+ active
+ ? 'border-2 border-mint bg-mint/[0.16]'
+ : 'border border-white/[0.08] bg-background hover:border-white/[0.16] hover:bg-white/[0.02]'
)}
>
- {t(descriptor?.title_key || `platform.${platform}.title`)}
+ <span
+ className={clsx(
+ 'inline-flex size-11 items-center justify-center rounded-[10px] border',
+ tileTint.bg,
+ tileTint.border
+ )}
+ >
+ <PlatformIcon platform={option} size={22} />
+ </span>
+ <span
+ className={clsx(
+ 'text-[13px] leading-tight transition-colors',
+ active ? 'font-bold text-foreground' : 'font-medium text-muted'
+ )}
+ >
+ {t(platform.title_key || `platform.${option}.title`)}
+ </span>
</button>
);
})}
</div>
- </div>
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium transition-colors">
- {t('common.back')}
- </button>
- <button
- onClick={handleContinue}
- disabled={!selected.length}
- className="px-8 py-3 rounded-lg font-medium transition-colors shadow-sm bg-accent hover:bg-accent/90 text-white disabled:opacity-50 disabled:cursor-not-allowed"
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex items-center gap-2 rounded-lg border border-white/[0.08] bg-white/[0.04] px-4 py-2.5">
+ <Info className="size-3.5 shrink-0 text-cyan" />
+ <span className="text-[12px] leading-[1.45] text-muted">
+ {t('platform.selectedSummary', { count: selected.length })}
+ </span>
+ </div>
+
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() => void handleContinue()}
+ disabled={!selected.length}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
+
+const CredentialInput: React.FC<{
+ label: string;
+ value: string;
+ placeholder?: string;
+ hint?: string;
+ type?: 'password' | 'text';
+ onChange: (value: string) => void;
+}> = ({ label, value, placeholder, hint, type = 'password', onChange }) => (
+ <label className="grid gap-1.5">
+ <span className="text-[11px] font-medium text-muted">{label}</span>
+ <input
+ type={type}
+ value={value}
+ placeholder={placeholder}
+ onChange={(event) => onChange(event.target.value)}
+ className="h-9 rounded-md border border-border bg-background px-3 text-[12px] text-foreground outline-none transition-colors placeholder:text-muted/55 focus:border-mint"
+ />
+ {hint ? <span className="text-[10px] text-muted">{hint}</span> : null}
+ </label>
+);
+
+const CredentialToggle: React.FC<{
+ label: string;
+ checked: boolean;
+ onChange: (checked: boolean) => void;
+}> = ({ label, checked, onChange }) => (
+ <button
+ type="button"
+ onClick={() => onChange(!checked)}
+ className="flex h-10 items-center justify-between gap-3 rounded-md border border-border bg-background px-3 text-left"
+ >
+ <span className="text-[11px] font-medium text-foreground">{label}</span>
+ <span className={clsx('relative h-5 w-9 rounded-full transition-colors', checked ? 'bg-mint' : 'bg-surface-3')}>
+ <span
+ className={clsx(
+ 'absolute top-0.5 size-4 rounded-full bg-background transition-transform',
+ checked ? 'translate-x-4' : 'translate-x-0.5'
+ )}
+ />
+ </span>
+ </button>
+);
diff --git a/ui/src/components/steps/SlackConfig.tsx b/ui/src/components/steps/SlackConfig.tsx
index 044f5b366..e8aaa983d 100644
--- a/ui/src/components/steps/SlackConfig.tsx
+++ b/ui/src/components/steps/SlackConfig.tsx
@@ -1,10 +1,11 @@
import React, { useEffect, useMemo, useState } from 'react';
-import { Lock, Shield, RefreshCw, Copy, ExternalLink, Check, ChevronDown, ChevronUp, Key, Hash, Plus } from 'lucide-react';
+import { Lock, Shield, RefreshCw, Copy, ExternalLink, Check, ChevronDown, ChevronUp, Key, Hash, Plus, ArrowLeft, ArrowRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
+import { EyebrowBadge, WizardCard } from '../visual';
interface SlackConfigProps {
data: any;
@@ -12,46 +13,45 @@ interface SlackConfigProps {
onBack: () => void;
}
+// Mirrors design.pen XCWAT (Slack creds wizard step): WizardCard 920 wide,
+// sStep accordion rows with mint-bordered active row + faint border collapsed
+// rows, navigation row with chevron-left back and mint pill next.
export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }) => {
const { t } = useTranslation();
const api = useApi();
const { showToast } = useToast();
const [botToken, setBotToken] = useState(data.slack?.bot_token || data.slackBotToken || '');
const [appToken, setAppToken] = useState(data.slack?.app_token || data.slackAppToken || '');
- const [mode] = useState<'self_host' | 'saas'>(data.mode || 'saas');
const [checking, setChecking] = useState(false);
const [authResult, setAuthResult] = useState<any>(null);
const [manifest, setManifest] = useState<string>('');
const [manifestCompact, setManifestCompact] = useState<string>('');
const [manifestLoading, setManifestLoading] = useState(false);
const [copied, setCopied] = useState(false);
-
+
// Collapsible states for each step
const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({ 1: true, 2: false, 3: false, 4: false });
- const isValid = useMemo(() => {
- if (mode === 'saas') return true;
- return botToken.startsWith('xoxb-') && appToken.startsWith('xapp-');
- }, [mode, botToken, appToken]);
+ const isValid = useMemo(() => botToken.startsWith('xoxb-') && appToken.startsWith('xapp-'), [botToken, appToken]);
- // Load manifest on mount for self-host mode
useEffect(() => {
- if (mode === 'self_host') {
- loadManifest();
- }
- }, [mode]);
+ void loadManifest();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
// Auto-expand next step when token is entered
useEffect(() => {
if (botToken.startsWith('xoxb-') && !expandedSteps[3]) {
- setExpandedSteps(prev => ({ ...prev, 2: false, 3: true }));
+ setExpandedSteps((prev) => ({ ...prev, 2: false, 3: true }));
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [botToken]);
useEffect(() => {
if (appToken.startsWith('xapp-') && !expandedSteps[4]) {
- setExpandedSteps(prev => ({ ...prev, 3: false, 4: true }));
+ setExpandedSteps((prev) => ({ ...prev, 3: false, 4: true }));
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [appToken]);
const loadManifest = async () => {
@@ -71,13 +71,12 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }
const copyManifest = async () => {
if (!manifest) return;
- const copiedToClipboard = await copyTextToClipboard(manifest);
- if (copiedToClipboard) {
+ const ok = await copyTextToClipboard(manifest);
+ if (ok) {
setCopied(true);
setTimeout(() => setCopied(false), 2000);
return;
}
-
showToast(t('common.copyFailed'), 'error');
};
@@ -103,22 +102,29 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }
};
const toggleStep = (step: number) => {
- setExpandedSteps(prev => ({ ...prev, [step]: !prev[step] }));
+ setExpandedSteps((prev) => ({ ...prev, [step]: !prev[step] }));
};
- const StepHeader: React.FC<{ step: number; title: string; icon: React.ReactNode; completed?: boolean }> = ({ step, title, icon, completed }) => (
+ const StepHeader: React.FC<{ step: number; title: string; icon: React.ReactNode; completed?: boolean }> = ({
+ step,
+ title,
+ icon,
+ completed,
+ }) => (
<button
onClick={() => toggleStep(step)}
- className="w-full px-4 py-3 flex items-center justify-between bg-neutral-50 hover:bg-neutral-100 transition-colors"
+ className="flex w-full items-center justify-between gap-3 px-5 py-4 text-left transition-colors hover:bg-white/[0.02]"
>
<div className="flex items-center gap-3">
- <span className={clsx(
- 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',
- completed ? 'bg-success text-white' : 'bg-accent text-white'
- )}>
+ <span
+ className={clsx(
+ 'flex size-7 items-center justify-center rounded-full text-[12px] font-bold transition-colors',
+ completed ? 'bg-mint text-[#080812]' : 'bg-cyan/15 text-cyan'
+ )}
+ >
{completed ? <Check size={14} /> : step}
</span>
- <span className="flex items-center gap-2 font-semibold text-text">
+ <span className="flex items-center gap-2 text-[14px] font-semibold text-foreground">
{icon}
{title}
</span>
@@ -127,236 +133,260 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }
</button>
);
- return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="mb-4">
- <h2 className="text-3xl font-display font-bold text-text">{t('slackConfig.title')}</h2>
- <p className="text-muted mt-1">
- {mode === 'saas' ? t('slackConfig.saasDescription') : t('slackConfig.selfHostDescription')}
- </p>
- </div>
+ const StepShell: React.FC<{ active: boolean; children: React.ReactNode }> = ({ active, children }) => (
+ <div
+ className={clsx(
+ 'overflow-hidden rounded-xl border transition-colors',
+ active
+ ? 'border-mint/35 bg-surface-2 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]'
+ : 'border-border bg-background'
+ )}
+ >
+ {children}
+ </div>
+ );
- {mode === 'saas' ? (
- <div className="flex flex-col items-center justify-center h-64 border-2 border-dashed border-border rounded-xl bg-neutral-50">
- <p className="text-muted mb-6 text-center max-w-xs">{t('slackConfig.oauthPrompt')}</p>
- <button className="px-6 py-3 bg-accent text-white rounded-lg font-medium hover:bg-accent/90 transition-colors shadow-sm">
- {t('slackConfig.openSlackOAuth')}
- </button>
- <p className="text-xs text-muted mt-6">{t('slackConfig.afterAuth')}</p>
+ const completedCount = [
+ !!manifest, // step 1 done as soon as manifest is available (best heuristic without backend signal)
+ botToken.startsWith('xoxb-'),
+ appToken.startsWith('xapp-'),
+ Boolean(authResult?.ok),
+ ].filter(Boolean).length;
+
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">04 — Slack</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('slackConfig.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('slackConfig.selfHostDescription')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {completedCount} / 4
+ </span>
+ <div className="flex gap-1">
+ {[0, 1, 2, 3].map((i) => (
+ <span
+ key={i}
+ className={clsx(
+ 'h-1 w-5 rounded-full',
+ i < completedCount ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' : 'bg-white/[0.08]'
+ )}
+ />
+ ))}
+ </div>
+ </div>
</div>
- ) : (
- <div className="space-y-3 overflow-y-auto flex-1 pr-1">
- {/* Step 1: Create Slack App */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={1}
- title={t('slackConfig.step1Title')}
- icon={<Plus size={16} className="text-accent" />}
- />
+
+ <div className="flex flex-col gap-3">
+ {/* Step 1 */}
+ <StepShell active={expandedSteps[1]}>
+ <StepHeader step={1} title={t('slackConfig.step1Title')} icon={<Plus size={16} className="text-cyan" />} />
{expandedSteps[1] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('slackConfig.step1Description')}</p>
-
- <div className="flex flex-wrap gap-2">
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('slackConfig.step1Description')}</p>
+ <div className="flex flex-wrap items-center gap-3">
<button
onClick={openSlackCreateApp}
disabled={!manifestCompact || manifestLoading}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium shadow-sm"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- <ExternalLink size={16} />
+ <ExternalLink size={14} strokeWidth={2.25} />
{t('slackConfig.createSlackApp')}
</button>
- </div>
-
- {manifest && (
- <div className="flex items-center gap-3 text-sm">
- <details className="group">
- <summary className="cursor-pointer text-accent hover:text-accent/80 flex items-center gap-1">
- <ChevronDown size={14} className="transition-transform group-open:rotate-180" />
- {t('slackConfig.viewManifest')}
- </summary>
- <pre className="mt-2 bg-neutral-900 text-neutral-100 p-3 rounded-lg text-xs overflow-x-auto max-h-40 overflow-y-auto font-mono">
- {manifest}
- </pre>
- </details>
- <span className="text-muted">|</span>
+ {manifest && (
<button
onClick={copyManifest}
disabled={manifestLoading}
- className="flex items-center gap-1 text-accent hover:text-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 py-2 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:opacity-50"
>
{copied ? <Check size={14} /> : <Copy size={14} />}
{copied ? t('slackConfig.copied') : t('slackConfig.copyManifest')}
</button>
- </div>
+ )}
+ </div>
+ {manifest && (
+ <details className="group">
+ <summary className="flex cursor-pointer items-center gap-1 text-[12px] text-cyan hover:text-cyan/80">
+ <ChevronDown size={14} className="transition-transform group-open:rotate-180" />
+ {t('slackConfig.viewManifest')}
+ </summary>
+ <pre className="mt-2 max-h-40 overflow-auto rounded-lg border border-border bg-background px-3 py-3 font-mono text-[11px] text-foreground">
+ {manifest}
+ </pre>
+ </details>
)}
-
{manifestLoading && (
- <div className="flex items-center gap-2 text-sm text-muted">
+ <div className="flex items-center gap-2 text-[12px] text-muted">
<RefreshCw size={14} className="animate-spin" />
{t('common.loading')}
</div>
)}
-
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">
+ <div className="rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2 text-[12px] leading-[1.55] text-cyan">
<strong>{t('slackConfig.tip')}:</strong> {t('slackConfig.step1Tip')}
</div>
</div>
)}
- </div>
+ </StepShell>
- {/* Step 2: Get Bot Token */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={2}
- title={t('slackConfig.step2Title')}
- icon={<Shield size={16} className="text-accent" />}
+ {/* Step 2 */}
+ <StepShell active={expandedSteps[2]}>
+ <StepHeader
+ step={2}
+ title={t('slackConfig.step2Title')}
+ icon={<Shield size={16} className="text-cyan" />}
completed={botToken.startsWith('xoxb-')}
/>
{expandedSteps[2] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('slackConfig.step2Description')}</p>
-
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('slackConfig.step2Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
<li>{t('slackConfig.step2Item1')}</li>
<li>{t('slackConfig.step2Item2')}</li>
<li>{t('slackConfig.step2Item3')}</li>
<li>{t('slackConfig.step2Item4')}</li>
</ol>
-
- <div className="space-y-2 pt-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <Key size={16} className="text-accent" /> {t('slackConfig.botToken')}
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <Key size={14} className="text-cyan" /> {t('slackConfig.botToken')}
</label>
<input
type="password"
value={botToken}
onChange={(e) => setBotToken(e.target.value)}
placeholder={t('slackConfig.botTokenPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
/>
- <p className="text-xs text-muted">{t('slackConfig.botTokenHint')} <code className="bg-neutral-100 px-1.5 py-0.5 rounded text-text">xoxb-</code></p>
+ <p className="text-[11px] text-muted">
+ {t('slackConfig.botTokenHint')}{' '}
+ <code className="rounded bg-white/[0.06] px-1.5 py-0.5 text-foreground">xoxb-</code>
+ </p>
</div>
</div>
)}
- </div>
+ </StepShell>
- {/* Step 3: Get App Token */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={3}
- title={t('slackConfig.step3Title')}
- icon={<Lock size={16} className="text-accent" />}
+ {/* Step 3 */}
+ <StepShell active={expandedSteps[3]}>
+ <StepHeader
+ step={3}
+ title={t('slackConfig.step3Title')}
+ icon={<Lock size={16} className="text-cyan" />}
completed={appToken.startsWith('xapp-')}
/>
{expandedSteps[3] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('slackConfig.step3Description')}</p>
-
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('slackConfig.step3Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
<li>{t('slackConfig.step3Item1')}</li>
<li>{t('slackConfig.step3Item2')}</li>
<li>{t('slackConfig.step3Item3')}</li>
<li>{t('slackConfig.step3Item4')}</li>
<li>{t('slackConfig.step3Item5')}</li>
</ol>
-
- <div className="space-y-2 pt-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <Key size={16} className="text-accent" /> {t('slackConfig.appToken')}
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <Key size={14} className="text-cyan" /> {t('slackConfig.appToken')}
</label>
<input
type="password"
value={appToken}
onChange={(e) => setAppToken(e.target.value)}
placeholder={t('slackConfig.appTokenPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
/>
- <p className="text-xs text-muted">{t('slackConfig.appTokenHint')} <code className="bg-neutral-100 px-1.5 py-0.5 rounded text-text">xapp-</code></p>
+ <p className="text-[11px] text-muted">
+ {t('slackConfig.appTokenHint')}{' '}
+ <code className="rounded bg-white/[0.06] px-1.5 py-0.5 text-foreground">xapp-</code>
+ </p>
</div>
-
- <div className="bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm text-yellow-800">
+ <div className="rounded-lg border border-gold/30 bg-gold/10 px-3 py-2 text-[12px] leading-[1.55] text-gold">
<strong>{t('slackConfig.important')}:</strong> {t('slackConfig.step3Warning')}
</div>
</div>
)}
- </div>
+ </StepShell>
- {/* Step 4: Validate & Invite */}
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={4}
- title={t('slackConfig.step4Title')}
- icon={<Hash size={16} className="text-accent" />}
- completed={authResult?.ok}
+ {/* Step 4 */}
+ <StepShell active={expandedSteps[4]}>
+ <StepHeader
+ step={4}
+ title={t('slackConfig.step4Title')}
+ icon={<Hash size={16} className="text-cyan" />}
+ completed={!!authResult?.ok}
/>
{expandedSteps[4] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('slackConfig.step4Description')}</p>
-
- <div className="flex items-center gap-3">
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('slackConfig.step4Description')}</p>
+ <div className="flex flex-wrap items-center gap-3">
<button
onClick={runAuthTest}
disabled={!botToken || !appToken || checking}
- className="px-4 py-2 bg-accent text-white rounded-lg flex items-center gap-2 transition-colors font-medium shadow-sm hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed"
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- {checking ? <RefreshCw size={16} className="animate-spin" /> : <Shield size={16} />}
+ {checking ? <RefreshCw size={14} className="animate-spin" /> : <Shield size={14} strokeWidth={2.25} />}
{t('slackConfig.validateTokens')}
</button>
{authResult && (
- <span className={clsx(
- 'flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border',
- authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20'
- )}>
- {authResult.ok ? (
- <>
- <Check size={14} />
- <span>{t('slackConfig.tokenValidated')}</span>
- </>
- ) : (
- <span>{t('slackConfig.authFailed')}: {authResult.error}</span>
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-[12px] font-medium',
+ authResult.ok
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-danger/30 bg-danger/10 text-danger'
)}
+ >
+ {authResult.ok ? <Check size={14} /> : null}
+ {authResult.ok ? t('slackConfig.tokenValidated') : `${t('slackConfig.authFailed')}: ${authResult.error}`}
</span>
)}
</div>
-
{authResult?.ok && (
- <div className="space-y-3 pt-2">
- <p className="text-sm font-medium text-text">{t('slackConfig.inviteBotTitle')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
+ <div className="space-y-2.5 pt-1">
+ <p className="text-[12px] font-semibold text-foreground">{t('slackConfig.inviteBotTitle')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
<li>{t('slackConfig.step4Item1')}</li>
<li>{t('slackConfig.step4Item2')}</li>
<li>{t('slackConfig.step4Item3')}</li>
</ol>
- <div className="bg-green-50 border border-green-200 rounded-lg p-3 text-sm text-green-800">
+ <div className="rounded-lg border border-mint/30 bg-mint/[0.08] px-3 py-2 text-[12px] leading-[1.55] text-mint">
<strong>{t('slackConfig.tip')}:</strong> {t('slackConfig.step4Tip')}
</div>
</div>
)}
</div>
)}
- </div>
+ </StepShell>
</div>
- )}
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button
- onClick={onBack}
- className="px-6 py-2 text-muted hover:text-text font-medium transition-colors"
- >
- {t('common.back')}
- </button>
- <button
- onClick={() => onNext({ slack: { ...data.slack, bot_token: botToken, app_token: appToken }, mode })}
- disabled={!isValid}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- isValid ? 'bg-accent hover:bg-accent/90 text-white' : 'bg-neutral-200 text-muted cursor-not-allowed'
- )}
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() =>
+ onNext({ slack: { ...data.slack, bot_token: botToken, app_token: appToken }, mode: 'self_host' })
+ }
+ disabled={!isValid}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsx
index c3b67d699..6665e129b 100644
--- a/ui/src/components/steps/Summary.tsx
+++ b/ui/src/components/steps/Summary.tsx
@@ -1,12 +1,24 @@
import React, { useState } from 'react';
-import { CheckCircle2, MessageSquare, Zap, Terminal, Copy, Check, Key } from 'lucide-react';
+import {
+ ArrowLeft,
+ ArrowRight,
+ Check,
+ Copy,
+ Key,
+ MessageSquare,
+ Sparkles,
+ Terminal,
+ Zap,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useStatus } from '../../context/StatusContext';
-import { useNavigate } from 'react-router-dom';
import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
import { getEnabledPlatforms, getPrimaryPlatform } from '../../lib/platforms';
+import { EyebrowBadge, WizardCard } from '../visual';
interface SummaryProps {
data: any;
@@ -16,6 +28,8 @@ interface SummaryProps {
isLast: boolean;
}
+// Mirrors design.pen X9wTM (Summary): mint-accented WizardCard with 72×72 check
+// halo, 38px title, recap rows, then secondary toggles and quick-start tips.
export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
const { t } = useTranslation();
const api = useApi();
@@ -40,11 +54,11 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
? (data.discord?.require_mention || false)
: platform === 'telegram'
? (data.telegram?.require_mention ?? true)
- : platform === 'lark'
- ? (data.lark?.require_mention || false)
- : platform === 'wechat'
- ? (data.wechat?.require_mention || false)
- : (data.slack?.require_mention || false),
+ : platform === 'lark'
+ ? (data.lark?.require_mention || false)
+ : platform === 'wechat'
+ ? (data.wechat?.require_mention || false)
+ : (data.slack?.require_mention || false),
])
)
);
@@ -58,7 +72,6 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
showToast(t('common.copyFailed'), 'error');
return;
}
-
setCodeCopied(true);
setTimeout(() => setCodeCopied(false), 2000);
};
@@ -105,11 +118,9 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
await Promise.all(
Object.entries(settingsByPlatform).map(([platform, payload]) => api.saveSettings(payload, platform))
);
-
- // Start service
+
await control('start');
- // WeChat: skip bind code, auto-bind happens on QR login
if (enabledPlatforms.every((platform) => platform === 'wechat')) {
setSaving(false);
showToast(t('wechat.setupComplete'));
@@ -119,23 +130,20 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
return;
}
- // Fetch first bind code (auto-generated on first access)
try {
const resp = await api.getFirstBindCode();
if (resp?.code) {
setBindCode(resp.code);
setSaving(false);
- return; // Don't navigate yet — show bind code first
+ return;
}
} catch {
- // Non-critical: skip bind code display
+ /* non-critical */
}
- // No bind code — redirect immediately
setTimeout(() => {
- navigate('/dashboard');
+ navigate('/dashboard');
}, 1000);
-
} catch (exc: any) {
const message = exc && exc.message ? exc.message : 'Failed to save configuration';
setError(message);
@@ -144,205 +152,267 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
}
};
- // If bind code is available, show the bind code screen
+ const recapRows: Array<{ label: string; value: string }> = [
+ { label: t('summary.platform'), value: enabledPlatforms.map((p) => titleCase(p)).join(', ') || '—' },
+ {
+ label: t('summary.enabledAgents'),
+ value: enabledAgents(data).map(titleCase).join(', ') || '—',
+ },
+ {
+ label: t('summary.channelsConfigured'),
+ value: String(countConfiguredChannels(data.channelConfigsByPlatform)),
+ },
+ ];
+
+ if (enabledPlatforms.includes('slack')) {
+ recapRows.push({ label: t('summary.slackBotToken'), value: mask(data.slack?.bot_token || '') });
+ }
+ if (enabledPlatforms.includes('discord')) {
+ recapRows.push({ label: t('summary.discordBotToken'), value: mask(data.discord?.bot_token || '') });
+ recapRows.push({
+ label: t('summary.discordGuild'),
+ value: discordGuildAllowlist.join(', ') || t('summary.notSet'),
+ });
+ }
+ if (enabledPlatforms.includes('telegram')) {
+ recapRows.push({ label: t('summary.telegramBotToken'), value: mask(data.telegram?.bot_token || '') });
+ }
+ if (enabledPlatforms.includes('lark')) {
+ recapRows.push({ label: t('summary.larkAppId'), value: mask(data.lark?.app_id || '') });
+ }
+ if (enabledPlatforms.includes('wechat')) {
+ recapRows.push({ label: t('summary.wechatBotToken'), value: mask(data.wechat?.bot_token || '') });
+ }
+
if (bindCode) {
return (
- <div className="flex flex-col h-full max-w-2xl mx-auto items-center justify-center">
- <div className="w-16 h-16 bg-success/10 text-success rounded-full flex items-center justify-center border border-success/20 mb-6">
- <CheckCircle2 size={40} />
- </div>
- <h2 className="text-2xl font-display font-bold text-text mb-2">{t('summary.title')}</h2>
- <p className="text-muted mb-8">{t('summary.serviceRunning')}</p>
-
- <div className="bg-panel border border-border rounded-lg p-6 shadow-sm w-full max-w-md">
- <div className="flex items-center gap-3 mb-4">
- <div className="w-10 h-10 bg-warning/10 text-warning rounded-lg flex items-center justify-center flex-shrink-0">
- <Key size={20} />
+ <div className="flex w-full justify-center">
+ <WizardCard accent size="hero" className="items-center gap-6 text-center">
+ <div className="flex size-[72px] items-center justify-center rounded-full border-2 border-mint/40 bg-mint/[0.08] text-mint shadow-[0_0_48px_-6px_rgba(91,255,160,0.7)]">
+ <Check size={36} strokeWidth={2.4} />
+ </div>
+ <div className="space-y-2">
+ <h2 className="text-[38px] font-bold leading-tight tracking-[-0.7px] text-foreground">
+ {t('summary.title')}
+ </h2>
+ <p className="mx-auto max-w-[600px] text-[15px] leading-[1.55] text-muted">
+ {t('summary.serviceRunning')}
+ </p>
+ </div>
+ <div className="w-full max-w-md rounded-xl border border-gold/30 bg-gold/[0.06] px-5 py-4 text-left">
+ <div className="mb-3 flex items-center gap-3">
+ <div className="flex size-10 items-center justify-center rounded-lg border border-gold/30 bg-gold/15 text-gold">
+ <Key size={18} />
+ </div>
+ <div>
+ <h3 className="text-[14px] font-semibold text-foreground">{t('summary.bindCodeTitle')}</h3>
+ <p className="text-[11px] text-muted">{t('summary.bindCodeDesc')}</p>
+ </div>
</div>
- <div>
- <h3 className="text-base font-semibold text-text">{t('summary.bindCodeTitle')}</h3>
- <p className="text-xs text-muted">{t('summary.bindCodeDesc')}</p>
+ <div className="flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2.5">
+ <code className="flex-1 select-all font-mono text-[13px] text-foreground">bind {bindCode}</code>
+ <button
+ onClick={copyBindCode}
+ className="rounded-md p-1.5 text-muted transition hover:bg-white/[0.04] hover:text-foreground"
+ title="Copy"
+ aria-label={t('common.copy') as string}
+ >
+ {codeCopied ? <Check size={16} className="text-mint" /> : <Copy size={16} />}
+ </button>
</div>
+ {codeCopied && (
+ <p className="mt-2 text-[11px] text-mint">{t('summary.bindCodeCopied')}</p>
+ )}
</div>
- <div className="flex items-center gap-2 bg-bg border border-border rounded-md p-3">
- <code className="flex-1 text-sm font-mono text-text select-all">bind {bindCode}</code>
- <button
- onClick={copyBindCode}
- className="p-2 text-muted hover:text-text transition-colors rounded-md hover:bg-panel"
- title="Copy"
- >
- {codeCopied ? <Check size={16} className="text-success" /> : <Copy size={16} />}
- </button>
- </div>
- {codeCopied && (
- <p className="text-xs text-success mt-2">{t('summary.bindCodeCopied')}</p>
- )}
- </div>
-
- <button
- onClick={() => navigate('/dashboard')}
- className="mt-8 px-8 py-3 bg-accent hover:bg-accent/90 text-white rounded-lg font-bold transition-colors shadow-sm"
- >
- {t('summary.goToDashboard')}
- </button>
+ <button
+ onClick={() => navigate('/dashboard')}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-7 py-3 text-[14px] font-bold text-[#080812] shadow-[0_0_48px_-8px_rgba(91,255,160,0.7)] transition hover:brightness-105"
+ >
+ {t('summary.goToDashboard')}
+ <ArrowRight size={16} strokeWidth={2.25} />
+ </button>
+ </WizardCard>
</div>
);
}
return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="flex items-center gap-4 mb-8">
- <div className="w-12 h-12 bg-success/10 text-success rounded-full flex items-center justify-center border border-success/20">
- <CheckCircle2 size={32} />
- </div>
- <div>
- <h2 className="text-2xl font-display font-bold text-text">{t('summary.title')}</h2>
- <p className="text-muted">{t('summary.subtitle')}</p>
+ <div className="flex w-full justify-center">
+ <WizardCard accent size="hero" className="gap-6">
+ <div className="flex flex-col items-center gap-5 text-center">
+ <div className="flex size-[72px] items-center justify-center rounded-full border-2 border-mint/40 bg-mint/[0.08] text-mint shadow-[0_0_48px_-6px_rgba(91,255,160,0.7)]">
+ <Check size={36} strokeWidth={2.4} />
+ </div>
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Summary</EyebrowBadge>
+ <h2 className="text-[38px] font-bold leading-tight tracking-[-0.7px] text-foreground">
+ {t('summary.title')}
+ </h2>
+ <p className="mx-auto max-w-[600px] text-[15px] leading-[1.55] text-muted">
+ {t('summary.subtitle')}
+ </p>
+ </div>
</div>
- </div>
- <div className="flex-1 space-y-4 overflow-y-auto mb-6">
- <Section title={t('summary.mode')} value={data.mode} />
- <Section title={t('summary.platform')} value={enabledPlatforms.join(', ')} />
- {enabledPlatforms.includes('slack') && (
- <>
- <Section title={t('summary.slackBotToken')} value={mask(data.slack?.bot_token || '')} />
- <Section title={t('summary.slackAppToken')} value={mask(data.slack?.app_token || '')} />
- </>
- )}
- {enabledPlatforms.includes('discord') && (
- <>
- <Section title={t('summary.discordBotToken')} value={mask(data.discord?.bot_token || '')} />
- <Section
- title={t('summary.discordGuild')}
- value={discordGuildAllowlist.join(', ') || t('summary.notSet')}
- />
- </>
- )}
- {enabledPlatforms.includes('telegram') && (
- <Section title={t('summary.telegramBotToken')} value={mask(data.telegram?.bot_token || '')} />
- )}
- {enabledPlatforms.includes('lark') && (
- <Section title={t('summary.larkAppId')} value={mask(data.lark?.app_id || '')} />
- )}
- {enabledPlatforms.includes('wechat') && (
- <Section title={t('summary.wechatBotToken')} value={mask(data.wechat?.bot_token || '')} />
- )}
- <Section title={t('summary.enabledAgents')} value={enabledAgents(data).join(', ')} />
- <Section title={t('summary.channelsConfigured')} value={countConfiguredChannels(data.channelConfigsByPlatform)} />
-
- {/* Require Mention Setting */}
- <div className="bg-panel border border-border rounded-lg p-4 shadow-sm space-y-4">
- <div>
- <h3 className="text-sm font-medium text-text">{t('summary.requireMention')}</h3>
- <p className="text-xs text-muted mt-1">{t('summary.requireMentionHint')}</p>
- </div>
- {enabledPlatforms.map((platform) => (
- <div key={platform} className="flex justify-between items-center border-t border-border pt-3 first:border-t-0 first:pt-0">
- <span className="text-sm text-text capitalize">{platform}</span>
- <label className="relative inline-flex items-center cursor-pointer">
- <input
- type="checkbox"
- checked={requireMentionByPlatform[platform] || false}
- onChange={(e) =>
- setRequireMentionByPlatform((current) => ({
- ...current,
- [platform]: e.target.checked,
- }))
- }
- className="sr-only peer"
- />
- <div className="w-11 h-6 bg-border rounded-full peer peer-checked:bg-success peer-focus:ring-2 peer-focus:ring-success/20 after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:after:translate-x-full"></div>
- </label>
+ {/* Recap card */}
+ <div className="overflow-hidden rounded-xl border border-border bg-background">
+ {recapRows.map((row, idx) => (
+ <div
+ key={row.label}
+ className={clsx(
+ 'flex items-center justify-between gap-4 px-5 py-3.5',
+ idx < recapRows.length - 1 && 'border-b border-border'
+ )}
+ >
+ <span className="text-[11px] font-semibold uppercase tracking-[0.12em] text-muted">{row.label}</span>
+ <span className="truncate font-mono text-[12px] text-foreground" title={row.value}>
+ {row.value}
+ </span>
</div>
))}
</div>
- {/* Auto Update Setting */}
- <div className="bg-panel border border-border rounded-lg p-4 shadow-sm">
- <div className="flex justify-between items-center">
- <div>
- <h3 className="text-sm font-medium text-text">{t('summary.autoUpdate')}</h3>
- <p className="text-xs text-muted mt-1">{t('summary.autoUpdateHint')}</p>
+ {/* Require Mention */}
+ {enabledPlatforms.length > 0 && (
+ <div className="rounded-xl border border-border bg-background px-5 py-4">
+ <div className="mb-3">
+ <h3 className="text-[13px] font-semibold text-foreground">{t('summary.requireMention')}</h3>
+ <p className="mt-0.5 text-[11px] text-muted">{t('summary.requireMentionHint')}</p>
+ </div>
+ <div className="flex flex-col gap-2.5">
+ {enabledPlatforms.map((platform) => (
+ <div
+ key={platform}
+ className="flex items-center justify-between rounded-lg border border-border bg-surface-2 px-3 py-2"
+ >
+ <span className="text-[12px] font-medium text-foreground">{titleCase(platform)}</span>
+ <Switch
+ checked={!!requireMentionByPlatform[platform]}
+ onChange={(value) =>
+ setRequireMentionByPlatform((current) => ({ ...current, [platform]: value }))
+ }
+ />
+ </div>
+ ))}
</div>
- <label className="relative inline-flex items-center cursor-pointer">
- <input
- type="checkbox"
- checked={autoUpdate}
- onChange={(e) => setAutoUpdate(e.target.checked)}
- className="sr-only peer"
- />
- <div className="w-11 h-6 bg-border rounded-full peer peer-checked:bg-success peer-focus:ring-2 peer-focus:ring-success/20 after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:after:translate-x-full"></div>
- </label>
</div>
+ )}
+
+ {/* Auto Update */}
+ <div className="flex items-center justify-between rounded-xl border border-border bg-background px-5 py-4">
+ <div>
+ <h3 className="text-[13px] font-semibold text-foreground">{t('summary.autoUpdate')}</h3>
+ <p className="mt-0.5 text-[11px] text-muted">{t('summary.autoUpdateHint')}</p>
+ </div>
+ <Switch checked={autoUpdate} onChange={setAutoUpdate} />
</div>
- {/* Usage Tips */}
- <div className="bg-panel border border-border rounded-lg p-4 shadow-sm">
- <h3 className="text-sm font-medium text-text mb-3">{t('summary.usageTips')}</h3>
+ {/* Quick start tips */}
+ <div className="rounded-xl border border-cyan/30 bg-cyan/[0.05] px-5 py-4">
+ <div className="mb-3 flex items-center gap-2">
+ <Sparkles size={14} className="text-cyan" />
+ <h3 className="text-[13px] font-semibold text-foreground">{t('summary.usageTips')}</h3>
+ </div>
<div className="space-y-3">
- <div className="flex items-start gap-3">
- <div className="w-8 h-8 bg-accent/10 text-accent rounded-lg flex items-center justify-center flex-shrink-0">
- <Terminal size={16} />
- </div>
- <div>
- <p className="text-sm font-medium text-text">{t('summary.tipStartCommand')}</p>
- <p className="text-xs text-muted">{t('summary.tipStartCommandDesc')}</p>
- </div>
- </div>
- <div className="flex items-start gap-3">
- <div className="w-8 h-8 bg-warning/10 text-warning rounded-lg flex items-center justify-center flex-shrink-0">
- <Zap size={16} />
- </div>
- <div>
- <p className="text-sm font-medium text-text">{t('summary.tipAgentSwitch')}</p>
- <p className="text-xs text-muted">{t('summary.tipAgentSwitchDesc')}</p>
- </div>
- </div>
- <div className="flex items-start gap-3">
- <div className="w-8 h-8 bg-success/10 text-success rounded-lg flex items-center justify-center flex-shrink-0">
- <MessageSquare size={16} />
- </div>
- <div>
- <p className="text-sm font-medium text-text">{t('summary.tipThread')}</p>
- <p className="text-xs text-muted">{t('summary.tipThreadDesc')}</p>
- </div>
- </div>
+ <Tip
+ icon={<Terminal size={14} />}
+ tone="cyan"
+ title={t('summary.tipStartCommand')}
+ description={t('summary.tipStartCommandDesc')}
+ />
+ <Tip
+ icon={<Zap size={14} />}
+ tone="gold"
+ title={t('summary.tipAgentSwitch')}
+ description={t('summary.tipAgentSwitchDesc')}
+ />
+ <Tip
+ icon={<MessageSquare size={14} />}
+ tone="mint"
+ title={t('summary.tipThread')}
+ description={t('summary.tipThreadDesc')}
+ />
</div>
</div>
- </div>
- {error && (
- <div className="p-4 bg-danger/10 text-danger border border-danger/20 rounded-lg mb-4 text-sm">
+ {error && (
+ <div className="rounded-lg border border-danger/30 bg-danger/10 px-4 py-3 text-[12px] text-danger">
{error}
+ </div>
+ )}
+
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ disabled={saving}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong disabled:opacity-50"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={saveAll}
+ disabled={saving}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-7 py-3 text-[14px] font-bold text-[#080812] shadow-[0_0_48px_-8px_rgba(91,255,160,0.7)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50 disabled:shadow-none"
+ >
+ {saving ? t('common.saving') : t('summary.finishAndStart')}
+ {!saving && <ArrowRight size={16} strokeWidth={2.25} />}
+ </button>
</div>
+ </WizardCard>
+ </div>
+ );
+};
+
+const Switch: React.FC<{ checked: boolean; onChange: (next: boolean) => void }> = ({ checked, onChange }) => (
+ <button
+ type="button"
+ role="switch"
+ aria-checked={checked}
+ onClick={() => onChange(!checked)}
+ className={clsx(
+ 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors focus:outline-none focus:ring-2 focus:ring-mint/40',
+ checked
+ ? 'border-mint/50 bg-mint shadow-[0_0_12px_-2px_rgba(91,255,160,0.6)]'
+ : 'border-border bg-surface-2'
+ )}
+ >
+ <span
+ className={clsx(
+ 'inline-block size-3.5 rounded-full bg-background shadow transition-transform',
+ checked ? 'translate-x-[18px]' : 'translate-x-1'
)}
+ />
+ </button>
+);
- <div className="mt-auto flex justify-between">
- <button
- onClick={onBack}
- className="px-6 py-2 text-muted hover:text-text font-medium transition-colors"
- >
- {t('common.back')}
- </button>
- <button
- onClick={saveAll}
- disabled={saving}
- className="px-8 py-3 bg-success hover:bg-success/90 text-white rounded-lg font-bold transition-colors shadow-sm"
- >
- {saving ? t('common.saving') : t('summary.finishAndStart')}
- </button>
+const Tip: React.FC<{
+ icon: React.ReactNode;
+ tone: 'cyan' | 'gold' | 'mint';
+ title: string;
+ description: string;
+}> = ({ icon, tone, title, description }) => {
+ const toneClasses = {
+ cyan: 'border-cyan/30 bg-cyan/[0.08] text-cyan',
+ gold: 'border-gold/30 bg-gold/10 text-gold',
+ mint: 'border-mint/30 bg-mint/[0.08] text-mint',
+ }[tone];
+ return (
+ <div className="flex items-start gap-3">
+ <div className={clsx('flex size-8 shrink-0 items-center justify-center rounded-lg border', toneClasses)}>
+ {icon}
+ </div>
+ <div className="min-w-0">
+ <p className="text-[12px] font-semibold text-foreground">{title}</p>
+ <p className="mt-0.5 text-[11px] leading-[1.5] text-muted">{description}</p>
</div>
</div>
);
};
-const Section = ({ title, value }: { title: string; value: any }) => (
- <div className="bg-panel border border-border rounded-lg p-4 shadow-sm flex justify-between items-center">
- <h3 className="text-sm font-medium text-muted uppercase tracking-wider">{title}</h3>
- <div className="text-text font-medium text-sm">{String(value)}</div>
- </div>
-);
+const titleCase = (value: string) => value.charAt(0).toUpperCase() + value.slice(1);
const mask = (value: string) => (value ? `${value.slice(0, 6)}...${value.slice(-4)}` : 'Not set');
@@ -354,7 +424,7 @@ const enabledAgents = (data: any) => {
const countConfiguredChannels = (channelConfigsByPlatform: Record<string, Record<string, any>> = {}) =>
Object.values(channelConfigsByPlatform).reduce(
(count, channels) => count + Object.values(channels || {}).filter((config: any) => config?.enabled).length,
- 0,
+ 0
);
const buildConfigPayload = (data: any) => {
@@ -370,9 +440,7 @@ const buildConfigPayload = (data: any) => {
mode: data.mode || 'self_host',
version: 'v2',
slack: {
- // Preserve all existing slack fields
...data.slack,
- // Override only the fields that setup modifies
bot_token: data.slack?.bot_token || '',
app_token: data.slack?.app_token || '',
require_mention: data.slack?.require_mention || false,
@@ -403,53 +471,47 @@ const buildConfigPayload = (data: any) => {
require_mention: data.wechat?.require_mention || false,
},
runtime: {
- // Preserve existing runtime config
...data.runtime,
default_cwd: data.default_cwd || data.runtime?.default_cwd || '_tmp',
},
agents: {
default_backend: data.default_backend || 'opencode',
opencode: {
- // Preserve existing opencode config
...agents.opencode,
enabled: agents.opencode?.enabled ?? true,
cli_path: agents.opencode?.cli_path || 'opencode',
default_agent: data.opencode_default_agent ?? agents.opencode?.default_agent ?? null,
default_model: data.opencode_default_model ?? agents.opencode?.default_model ?? null,
- default_reasoning_effort: data.opencode_default_reasoning_effort ?? agents.opencode?.default_reasoning_effort ?? null,
+ default_reasoning_effort:
+ data.opencode_default_reasoning_effort ?? agents.opencode?.default_reasoning_effort ?? null,
},
claude: {
- // Preserve existing claude config
...agents.claude,
enabled: agents.claude?.enabled ?? true,
cli_path: agents.claude?.cli_path || 'claude',
default_model: data.claude_default_model ?? agents.claude?.default_model ?? null,
},
codex: {
- // Preserve existing codex config
...agents.codex,
enabled: agents.codex?.enabled ?? false,
cli_path: agents.codex?.cli_path || 'codex',
default_model: data.codex_default_model ?? agents.codex?.default_model ?? null,
},
},
- // Preserve gateway config entirely
gateway: data.gateway,
ui: {
- // Preserve existing ui config
...data.ui,
setup_host: data.ui?.setup_host || '127.0.0.1',
setup_port: data.ui?.setup_port || 5123,
},
- // Preserve existing update config, only override auto_update from UI toggle
- update: data.update ? {
- ...data.update,
- auto_update: data.update.auto_update,
- } : undefined,
- // Preserve ack_mode
+ update: data.update
+ ? {
+ ...data.update,
+ auto_update: data.update.auto_update,
+ }
+ : undefined,
ack_mode: data.ack_mode,
show_duration: data.show_duration ?? false,
- // Preserve language
language: data.language,
};
};
diff --git a/ui/src/components/steps/TelegramConfig.tsx b/ui/src/components/steps/TelegramConfig.tsx
index 673439d7b..3c7af6b3e 100644
--- a/ui/src/components/steps/TelegramConfig.tsx
+++ b/ui/src/components/steps/TelegramConfig.tsx
@@ -1,5 +1,7 @@
import React, { useEffect, useMemo, useState } from 'react';
import {
+ ArrowLeft,
+ ArrowRight,
Check,
ChevronDown,
ChevronUp,
@@ -17,6 +19,7 @@ import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
import { copyTextToClipboard } from '../../lib/utils';
+import { EyebrowBadge, WizardCard } from '../visual';
interface TelegramConfigProps {
data: any;
@@ -24,6 +27,8 @@ interface TelegramConfigProps {
onBack: () => void;
}
+// Mirrors design.pen XCWAT (Slack creds wizard step) adapted for Telegram.
+// 920-wide WizardCard, mint eyebrow, 5-step accordion with mint accent on active row.
export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, onBack }) => {
const { t } = useTranslation();
const api = useApi();
@@ -33,7 +38,13 @@ export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, on
const [forumAutoTopic, setForumAutoTopic] = useState(data.telegram?.forum_auto_topic ?? true);
const [checking, setChecking] = useState(false);
const [authResult, setAuthResult] = useState<any>(null);
- const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({ 1: true, 2: true, 3: false, 4: false, 5: false });
+ const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({
+ 1: true,
+ 2: true,
+ 3: false,
+ 4: false,
+ 5: false,
+ });
const [copiedCommand, setCopiedCommand] = useState<string | null>(null);
const hasSavedToken = Boolean(data.telegram?.bot_token && botToken === data.telegram?.bot_token);
@@ -92,18 +103,18 @@ export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, on
}) => (
<button
onClick={() => toggleStep(step)}
- className="w-full px-4 py-3 flex items-center justify-between bg-neutral-50 hover:bg-neutral-100 transition-colors"
+ className="flex w-full items-center justify-between gap-3 px-5 py-4 text-left transition-colors hover:bg-white/[0.02]"
>
<div className="flex items-center gap-3">
<span
className={clsx(
- 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',
- completed ? 'bg-success text-white' : 'bg-accent text-white'
+ 'flex size-7 items-center justify-center rounded-full text-[12px] font-bold transition-colors',
+ completed ? 'bg-mint text-[#080812]' : 'bg-cyan/15 text-cyan'
)}
>
{completed ? <Check size={14} /> : step}
</span>
- <span className="flex items-center gap-2 font-semibold text-text">
+ <span className="flex items-center gap-2 text-[14px] font-semibold text-foreground">
{icon}
{title}
</span>
@@ -112,268 +123,326 @@ export const TelegramConfig: React.FC<TelegramConfigProps> = ({ data, onNext, on
</button>
);
- return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="mb-4">
- <h2 className="text-3xl font-display font-bold text-text">{t('telegramConfig.title')}</h2>
- <p className="text-muted mt-1">{t('telegramConfig.subtitle')}</p>
- </div>
+ const StepShell: React.FC<{ active: boolean; children: React.ReactNode }> = ({ active, children }) => (
+ <div
+ className={clsx(
+ 'overflow-hidden rounded-xl border transition-colors',
+ active
+ ? 'border-mint/35 bg-surface-2 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]'
+ : 'border-border bg-background'
+ )}
+ >
+ {children}
+ </div>
+ );
- <div className="space-y-3 overflow-y-auto flex-1 pr-1">
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={1}
- title={t('telegramConfig.step1Title')}
- icon={<MessageSquare size={16} className="text-accent" />}
- />
- {expandedSteps[1] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('telegramConfig.step1Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('telegramConfig.step1Item1')}</li>
- <li>{t('telegramConfig.step1Item2')}</li>
- <li>{t('telegramConfig.step1Item3')}</li>
- <li>{t('telegramConfig.step1Item4')}</li>
- </ol>
- <div className="flex flex-wrap gap-2">
- <button
- onClick={openBotFather}
- className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 transition-colors font-medium shadow-sm"
- >
- <ExternalLink size={16} />
- {t('telegramConfig.openBotFather')}
- </button>
- <button
- onClick={() => copyCommand('/newbot')}
- className="flex items-center gap-2 px-4 py-2 border border-border rounded-lg text-text hover:bg-neutral-50 transition-colors font-medium"
- >
- {copiedCommand === '/newbot' ? <Check size={16} className="text-success" /> : <Copy size={16} className="text-accent" />}
- {copiedCommand === '/newbot' ? t('telegramConfig.copiedCommand') : t('telegramConfig.copyNewBotCommand')}
- </button>
- </div>
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">
- <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step1Tip')}
- </div>
- </div>
- )}
- </div>
+ const completedCount = [
+ Boolean(botToken),
+ isValid,
+ Boolean(copiedCommand),
+ expandedSteps[4],
+ Boolean(requireMention || forumAutoTopic),
+ ].filter(Boolean).length;
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={2}
- title={t('telegramConfig.step2Title')}
- icon={<KeyRound size={16} className="text-accent" />}
- completed={isValid}
- />
- {expandedSteps[2] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('telegramConfig.step2Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('telegramConfig.step2Item1')}</li>
- <li>{t('telegramConfig.step2Item2')}</li>
- <li>{t('telegramConfig.step2Item3')}</li>
- </ol>
+ const botCommands: Array<{ command: string; title: string; description: string }> = [
+ {
+ command: '/setprivacy',
+ title: t('telegramConfig.step3Command1Title'),
+ description: t('telegramConfig.step3Command1Description'),
+ },
+ {
+ command: '/setjoingroups',
+ title: t('telegramConfig.step3Command2Title'),
+ description: t('telegramConfig.step3Command2Description'),
+ },
+ {
+ command: '/setcommands',
+ title: t('telegramConfig.step3Command3Title'),
+ description: t('telegramConfig.step3Command3Description'),
+ },
+ ];
- <div className="space-y-2 pt-2">
- <label className="text-sm font-medium text-text flex items-center gap-2">
- <KeyRound size={16} className="text-accent" />
- {t('telegramConfig.botToken')}
- </label>
- <input
- type="password"
- value={botToken}
- onChange={(e) => setBotToken(e.target.value)}
- placeholder={t('telegramConfig.botTokenPlaceholder')}
- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">Telegram</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('telegramConfig.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('telegramConfig.subtitle')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {completedCount} / 5
+ </span>
+ <div className="flex gap-1">
+ {[0, 1, 2, 3, 4].map((i) => (
+ <span
+ key={i}
+ className={clsx(
+ 'h-1 w-4 rounded-full',
+ i < completedCount ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' : 'bg-white/[0.08]'
+ )}
/>
- <p className="text-xs text-muted">{t('telegramConfig.botTokenHint')}</p>
+ ))}
+ </div>
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-3">
+ {/* Step 1: Open BotFather */}
+ <StepShell active={expandedSteps[1]}>
+ <StepHeader
+ step={1}
+ title={t('telegramConfig.step1Title')}
+ icon={<MessageSquare size={16} className="text-cyan" />}
+ />
+ {expandedSteps[1] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step1Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('telegramConfig.step1Item1')}</li>
+ <li>{t('telegramConfig.step1Item2')}</li>
+ <li>{t('telegramConfig.step1Item3')}</li>
+ <li>{t('telegramConfig.step1Item4')}</li>
+ </ol>
+ <div className="flex flex-wrap gap-2">
+ <button
+ onClick={openBotFather}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105"
+ >
+ <ExternalLink size={14} strokeWidth={2.25} />
+ {t('telegramConfig.openBotFather')}
+ </button>
+ <button
+ onClick={() => copyCommand('/newbot')}
+ className="inline-flex items-center gap-2 rounded-lg border border-border bg-white/[0.04] px-3 py-2 text-[12px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ {copiedCommand === '/newbot' ? <Check size={14} className="text-mint" /> : <Copy size={14} />}
+ {copiedCommand === '/newbot' ? t('telegramConfig.copiedCommand') : t('telegramConfig.copyNewBotCommand')}
+ </button>
+ </div>
+ <div className="rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2 text-[12px] leading-[1.55] text-cyan">
+ <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step1Tip')}
+ </div>
</div>
+ )}
+ </StepShell>
+
+ {/* Step 2: Paste token & validate */}
+ <StepShell active={expandedSteps[2]}>
+ <StepHeader
+ step={2}
+ title={t('telegramConfig.step2Title')}
+ icon={<KeyRound size={16} className="text-cyan" />}
+ completed={isValid}
+ />
+ {expandedSteps[2] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step2Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('telegramConfig.step2Item1')}</li>
+ <li>{t('telegramConfig.step2Item2')}</li>
+ <li>{t('telegramConfig.step2Item3')}</li>
+ </ol>
+
+ <div className="space-y-2 pt-1">
+ <label className="flex items-center gap-2 text-[12px] font-medium text-foreground">
+ <KeyRound size={14} className="text-cyan" />
+ {t('telegramConfig.botToken')}
+ </label>
+ <input
+ type="password"
+ value={botToken}
+ onChange={(e) => setBotToken(e.target.value)}
+ placeholder={t('telegramConfig.botTokenPlaceholder')}
+ className="w-full rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-[12px] text-foreground outline-none transition placeholder:text-muted/55 focus:border-cyan focus:ring-1 focus:ring-cyan/40"
+ />
+ <p className="text-[11px] text-muted">{t('telegramConfig.botTokenHint')}</p>
+ </div>
- <div className="flex items-center gap-3">
- <button
- onClick={runAuthTest}
- disabled={!botToken || checking}
- className="px-4 py-2 bg-accent text-white rounded-lg flex items-center gap-2 transition-colors font-medium shadow-sm hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed"
- >
- {checking ? <RefreshCw size={16} className="animate-spin" /> : <Shield size={16} />}
- {t('telegramConfig.validateToken')}
- </button>
- {authResult && (
- <span
- className={clsx(
- 'flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border',
- authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20'
- )}
+ <div className="flex flex-wrap items-center gap-3">
+ <button
+ onClick={runAuthTest}
+ disabled={!botToken || checking}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
>
- {authResult.ok ? (
- <>
- <Check size={14} />
- <span>{t('telegramConfig.tokenValidated')}</span>
- </>
- ) : (
- <span>{t('telegramConfig.authFailed')}: {authResult.error}</span>
- )}
- </span>
- )}
+ {checking ? <RefreshCw size={14} className="animate-spin" /> : <Shield size={14} strokeWidth={2.25} />}
+ {t('telegramConfig.validateToken')}
+ </button>
+ {authResult && (
+ <span
+ className={clsx(
+ 'inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-[12px] font-medium',
+ authResult.ok
+ ? 'border-mint/30 bg-mint/[0.08] text-mint'
+ : 'border-danger/30 bg-danger/10 text-danger'
+ )}
+ >
+ {authResult.ok ? <Check size={14} /> : null}
+ {authResult.ok
+ ? t('telegramConfig.tokenValidated')
+ : `${t('telegramConfig.authFailed')}: ${authResult.error}`}
+ </span>
+ )}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={3}
- title={t('telegramConfig.step3Title')}
- icon={<Shield size={16} className="text-accent" />}
- />
- {expandedSteps[3] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('telegramConfig.step3Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('telegramConfig.step3Item1')}</li>
- <li>{t('telegramConfig.step3Item2')}</li>
- <li>{t('telegramConfig.step3Item3')}</li>
- <li>{t('telegramConfig.step3Item4')}</li>
- </ol>
- <div className="grid gap-3">
- {[
- {
- command: '/setprivacy',
- title: t('telegramConfig.step3Command1Title'),
- description: t('telegramConfig.step3Command1Description'),
- },
- {
- command: '/setjoingroups',
- title: t('telegramConfig.step3Command2Title'),
- description: t('telegramConfig.step3Command2Description'),
- },
- {
- command: '/setcommands',
- title: t('telegramConfig.step3Command3Title'),
- description: t('telegramConfig.step3Command3Description'),
- },
- ].map((item) => (
- <div key={item.command} className="rounded-lg border border-border bg-neutral-50 p-3">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <div>
- <div className="text-sm font-semibold text-text">{item.title}</div>
- <p className="mt-1 text-xs text-muted">{item.description}</p>
+ {/* Step 3: Bot commands */}
+ <StepShell active={expandedSteps[3]}>
+ <StepHeader
+ step={3}
+ title={t('telegramConfig.step3Title')}
+ icon={<Shield size={16} className="text-cyan" />}
+ />
+ {expandedSteps[3] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step3Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('telegramConfig.step3Item1')}</li>
+ <li>{t('telegramConfig.step3Item2')}</li>
+ <li>{t('telegramConfig.step3Item3')}</li>
+ <li>{t('telegramConfig.step3Item4')}</li>
+ </ol>
+ <div className="grid gap-2">
+ {botCommands.map((item) => (
+ <div
+ key={item.command}
+ className="rounded-lg border border-border bg-background px-3 py-2.5"
+ >
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div>
+ <div className="text-[12px] font-semibold text-foreground">{item.title}</div>
+ <p className="mt-0.5 text-[11px] text-muted">{item.description}</p>
+ </div>
+ <button
+ onClick={() => copyCommand(item.command)}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-2.5 py-1.5 text-[11px] font-medium text-foreground transition hover:border-border-strong"
+ >
+ {copiedCommand === item.command ? <Check size={12} className="text-mint" /> : <Copy size={12} />}
+ <code className="font-mono">
+ {copiedCommand === item.command ? t('telegramConfig.copiedCommand') : item.command}
+ </code>
+ </button>
</div>
- <button
- onClick={() => copyCommand(item.command)}
- className="inline-flex items-center gap-2 rounded-lg border border-border bg-white px-3 py-1.5 text-sm font-medium text-text hover:bg-neutral-100 transition-colors"
- >
- {copiedCommand === item.command ? (
- <Check size={14} className="text-success" />
- ) : (
- <Copy size={14} className="text-accent" />
- )}
- <code>{copiedCommand === item.command ? t('telegramConfig.copiedCommand') : item.command}</code>
- </button>
</div>
- </div>
- ))}
- </div>
- <div className="bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-900">
- <strong>{t('telegramConfig.step3TipTitle')}:</strong> {t('telegramConfig.step3Tip')}
- </div>
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">
- <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step3ExtraTip')}
+ ))}
+ </div>
+ <div className="rounded-lg border border-gold/30 bg-gold/10 px-3 py-2 text-[12px] leading-[1.55] text-gold">
+ <strong>{t('telegramConfig.step3TipTitle')}:</strong> {t('telegramConfig.step3Tip')}
+ </div>
+ <div className="rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2 text-[12px] leading-[1.55] text-cyan">
+ <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step3ExtraTip')}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={4}
- title={t('telegramConfig.step4Title')}
- icon={<ExternalLink size={16} className="text-accent" />}
- />
- {expandedSteps[4] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('telegramConfig.step4Description')}</p>
- <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">
- <li>{t('telegramConfig.step4Item1')}</li>
- <li>{t('telegramConfig.step4Item2')}</li>
- <li>{t('telegramConfig.step4Item3')}</li>
- <li>{t('telegramConfig.step4Item4')}</li>
- </ol>
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">
- <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step4Tip')}
+ {/* Step 4: Add bot to group */}
+ <StepShell active={expandedSteps[4]}>
+ <StepHeader
+ step={4}
+ title={t('telegramConfig.step4Title')}
+ icon={<ExternalLink size={16} className="text-cyan" />}
+ />
+ {expandedSteps[4] && (
+ <div className="space-y-4 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step4Description')}</p>
+ <ol className="list-inside list-decimal space-y-1.5 pl-1 text-[12px] leading-[1.55] text-muted">
+ <li>{t('telegramConfig.step4Item1')}</li>
+ <li>{t('telegramConfig.step4Item2')}</li>
+ <li>{t('telegramConfig.step4Item3')}</li>
+ <li>{t('telegramConfig.step4Item4')}</li>
+ </ol>
+ <div className="rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2 text-[12px] leading-[1.55] text-cyan">
+ <strong>{t('slackConfig.tip')}:</strong> {t('telegramConfig.step4Tip')}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </StepShell>
- <div className="bg-panel border border-border rounded-xl overflow-hidden">
- <StepHeader
- step={5}
- title={t('telegramConfig.step5Title')}
- icon={<Settings2 size={16} className="text-accent" />}
- />
- {expandedSteps[5] && (
- <div className="p-4 space-y-4 border-t border-border">
- <p className="text-sm text-muted">{t('telegramConfig.step5Description')}</p>
+ {/* Step 5: Behavior toggles */}
+ <StepShell active={expandedSteps[5]}>
+ <StepHeader
+ step={5}
+ title={t('telegramConfig.step5Title')}
+ icon={<Settings2 size={16} className="text-cyan" />}
+ />
+ {expandedSteps[5] && (
+ <div className="space-y-3 border-t border-border px-5 py-4">
+ <p className="text-[13px] leading-[1.55] text-muted">{t('telegramConfig.step5Description')}</p>
- <label className="flex items-start justify-between gap-4">
- <div>
- <div className="text-sm font-medium text-text">{t('telegramConfig.requireMention')}</div>
- <p className="text-xs text-muted mt-1">{t('telegramConfig.requireMentionHint')}</p>
- </div>
- <input
- type="checkbox"
- checked={requireMention}
- onChange={(e) => setRequireMention(e.target.checked)}
- className="mt-1 h-4 w-4"
- />
- </label>
+ <label className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
+ <div>
+ <div className="text-[12px] font-semibold text-foreground">
+ {t('telegramConfig.requireMention')}
+ </div>
+ <p className="mt-0.5 text-[11px] text-muted">{t('telegramConfig.requireMentionHint')}</p>
+ </div>
+ <input
+ type="checkbox"
+ checked={requireMention}
+ onChange={(e) => setRequireMention(e.target.checked)}
+ className="mt-1 size-4 accent-mint"
+ />
+ </label>
- <label className="flex items-start justify-between gap-4">
- <div className="pr-4">
- <div className="text-sm font-medium text-text flex items-center gap-2">
- <SplitSquareVertical size={16} className="text-accent" />
- {t('telegramConfig.forumAutoTopic')}
+ <label className="flex items-start justify-between gap-4 rounded-lg border border-border bg-background px-3 py-2.5">
+ <div className="pr-4">
+ <div className="flex items-center gap-2 text-[12px] font-semibold text-foreground">
+ <SplitSquareVertical size={14} className="text-cyan" />
+ {t('telegramConfig.forumAutoTopic')}
+ </div>
+ <p className="mt-0.5 text-[11px] text-muted">{t('telegramConfig.forumAutoTopicHint')}</p>
</div>
- <p className="text-xs text-muted mt-1">{t('telegramConfig.forumAutoTopicHint')}</p>
- </div>
- <input
- type="checkbox"
- checked={forumAutoTopic}
- onChange={(e) => setForumAutoTopic(e.target.checked)}
- className="mt-1 h-4 w-4"
- />
- </label>
- </div>
- )}
+ <input
+ type="checkbox"
+ checked={forumAutoTopic}
+ onChange={(e) => setForumAutoTopic(e.target.checked)}
+ className="mt-1 size-4 accent-mint"
+ />
+ </label>
+ </div>
+ )}
+ </StepShell>
</div>
- </div>
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium transition-colors">
- {t('common.back')}
- </button>
- <button
- onClick={() =>
- onNext({
- platform: 'telegram',
- telegram: {
- ...(data.telegram || {}),
- bot_token: botToken,
- require_mention: requireMention,
- forum_auto_topic: forumAutoTopic,
- },
- })
- }
- disabled={!isValid}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- isValid ? 'bg-accent hover:bg-accent/90 text-white' : 'bg-neutral-200 text-muted cursor-not-allowed'
- )}
- >
- {t('common.continue')}
- </button>
- </div>
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() =>
+ onNext({
+ platform: 'telegram',
+ telegram: {
+ ...(data.telegram || {}),
+ bot_token: botToken,
+ require_mention: requireMention,
+ forum_auto_topic: forumAutoTopic,
+ },
+ })
+ }
+ disabled={!isValid}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/steps/UserList.tsx b/ui/src/components/steps/UserList.tsx
index a9e9054b4..113e93c7c 100644
--- a/ui/src/components/steps/UserList.tsx
+++ b/ui/src/components/steps/UserList.tsx
@@ -1,31 +1,27 @@
-import React, { useEffect, useState } from 'react';
-import { User, Shield, ShieldOff, Copy, Check, Plus, Trash2, FolderOpen, HelpCircle, X } from 'lucide-react';
+import React, { useEffect, useMemo, useState } from 'react';
+import {
+ Bot,
+ Check,
+ ChevronDown,
+ ChevronUp,
+ Copy,
+ KeyRound,
+ Plus,
+ RefreshCw,
+ Search,
+ Shield,
+ Trash2,
+ X,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
import { useToast } from '../../context/ToastContext';
import { getEnabledPlatforms } from '../../lib/platforms';
-import { Combobox } from '../ui/combobox';
import { DirectoryBrowser } from '../ui/directory-browser';
-import clsx from 'clsx';
import { copyTextToClipboard } from '../../lib/utils';
-
-/** Input that only commits value on blur */
-function BlurInput({
- value,
- onCommit,
- ...props
-}: { value: string; onCommit: (v: string) => void } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onBlur'>) {
- const [local, setLocal] = useState(value);
- useEffect(() => setLocal(value), [value]);
- return (
- <input
- {...props}
- value={local}
- onChange={(e) => setLocal(e.target.value)}
- onBlur={() => { if (local !== value) onCommit(local); }}
- />
- );
-}
+import { PlatformIcon } from '../visual';
+import { RoutingConfigPanel } from '../shared/RoutingConfigPanel';
interface UserConfig {
display_name: string;
@@ -57,19 +53,68 @@ interface BindCodeItem {
used_by: string[];
}
+interface AggregatedUser {
+ key: string; // `${platform}::${userId}`
+ platform: string;
+ userId: string;
+ config: UserConfig;
+}
+
+const AVATAR_TONES = [
+ { textCls: 'text-mint', bg: 'rgba(91,255,160,0.12)', border: 'rgba(91,255,160,0.33)' },
+ { textCls: 'text-cyan', bg: 'rgba(63,224,229,0.12)', border: 'rgba(63,224,229,0.33)' },
+ { textCls: 'text-violet', bg: 'rgba(124,91,255,0.12)', border: 'rgba(124,91,255,0.33)' },
+ { textCls: 'text-gold', bg: 'rgba(255,200,87,0.12)', border: 'rgba(255,200,87,0.33)' },
+];
+
+const hashCode = (s: string) => {
+ let h = 0;
+ for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0;
+ return Math.abs(h);
+};
+
+const getInitials = (name: string, fallback: string): string => {
+ const trimmed = (name || '').trim();
+ if (!trimmed) return (fallback || '??').slice(0, 2).toUpperCase();
+ const parts = trimmed.split(/\s+/);
+ if (parts.length >= 2) return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
+ const onlyAlpha = trimmed.replace(/[^a-zA-Z]/g, '');
+ return (onlyAlpha || trimmed).slice(0, 2).toUpperCase();
+};
+
+const formatExpiry = (expiresAt: string | null): string => {
+ if (!expiresAt) return '';
+ const ms = new Date(expiresAt).getTime() - Date.now();
+ if (ms <= 0) return '00:00';
+ const totalSeconds = Math.floor(ms / 1000);
+ const days = Math.floor(totalSeconds / 86_400);
+ if (days > 0) return `${days}d`;
+ const hours = Math.floor(totalSeconds / 3600);
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
+ const seconds = totalSeconds % 60;
+ if (hours > 0) return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
+ return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
+};
+
// ─── Bind Code Section ───────────────────────────────────────────────────
-const BindCodeSection: React.FC = () => {
+interface BindCodeCardProps {
+ refreshTrigger: number;
+ onCodesChanged: () => void;
+}
+
+const BindCodeCard: React.FC<BindCodeCardProps> = ({ refreshTrigger, onCodesChanged }) => {
const { t } = useTranslation();
const api = useApi();
const { showToast } = useToast();
const [codes, setCodes] = useState<BindCodeItem[]>([]);
- const [showForm, setShowForm] = useState(false);
+ const [showFormModal, setShowFormModal] = useState(false);
+ const [showAllModal, setShowAllModal] = useState(false);
const [newType, setNewType] = useState<'one_time' | 'expiring'>('one_time');
const [newExpiry, setNewExpiry] = useState('');
const [copiedCode, setCopiedCode] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
- const [showUnavailableModal, setShowUnavailableModal] = useState(false);
+ const [tick, setTick] = useState(0);
const loadCodes = async () => {
try {
@@ -80,7 +125,24 @@ const BindCodeSection: React.FC = () => {
}
};
- useEffect(() => { loadCodes(); }, []);
+ useEffect(() => { loadCodes(); }, [refreshTrigger]);
+
+ // Tick every second to refresh the countdown for expiring codes
+ useEffect(() => {
+ const id = setInterval(() => setTick((v) => v + 1), 1000);
+ return () => clearInterval(id);
+ }, []);
+
+ const getCodeStatus = (bc: BindCodeItem) => {
+ if (!bc.is_active) return bc.type === 'one_time' && bc.used_by.length > 0 ? 'used' : 'inactive';
+ if (bc.type === 'expiring' && bc.expires_at && new Date(bc.expires_at) < new Date()) return 'expired';
+ return 'active';
+ };
+
+ const activeCodes = useMemo(() => codes.filter((bc) => getCodeStatus(bc) === 'active'), [codes, tick]);
+ const otherCodes = useMemo(() => codes.filter((bc) => getCodeStatus(bc) !== 'active'), [codes, tick]);
+ const primary = activeCodes[0];
+ const moreCount = Math.max(0, activeCodes.length - 1);
const handleCreate = async () => {
setLoading(true);
@@ -88,10 +150,11 @@ const BindCodeSection: React.FC = () => {
const result = await api.createBindCode(newType, newType === 'expiring' ? newExpiry : undefined);
if (result.ok) {
showToast(t('bindCode.created'));
- setShowForm(false);
+ setShowFormModal(false);
setNewType('one_time');
setNewExpiry('');
loadCodes();
+ onCodesChanged();
}
} catch (e) {
console.error('Failed to create bind code:', e);
@@ -106,6 +169,7 @@ const BindCodeSection: React.FC = () => {
if (result.ok) {
showToast(t('bindCode.deleted'));
loadCodes();
+ onCodesChanged();
}
} catch (e) {
console.error('Failed to delete bind code:', e);
@@ -118,186 +182,255 @@ const BindCodeSection: React.FC = () => {
showToast(t('common.copyFailed'), 'error');
return;
}
-
setCopiedCode(code);
setTimeout(() => setCopiedCode(null), 2000);
};
- const getCodeStatus = (bc: BindCodeItem) => {
- if (!bc.is_active) {
- return bc.type === 'one_time' && bc.used_by.length > 0 ? 'used' : 'inactive';
- }
- if (bc.type === 'expiring' && bc.expires_at) {
- if (new Date(bc.expires_at) < new Date()) return 'expired';
- }
- return 'active';
- };
-
- const statusColors: Record<string, string> = {
- active: 'bg-success/10 text-success border-success/20',
- used: 'bg-neutral-100 text-muted border-border',
- expired: 'bg-warning/10 text-warning border-warning/20',
- inactive: 'bg-neutral-100 text-muted border-border',
- };
-
- const activeCodes = codes.filter((bc) => getCodeStatus(bc) === 'active');
- const unavailableCodes = codes.filter((bc) => getCodeStatus(bc) !== 'active');
-
- const renderCodeRow = (bc: BindCodeItem) => {
- const status = getCodeStatus(bc);
- return (
- <div key={bc.code} className="flex items-center justify-between py-2.5">
- <div className="flex items-center gap-3 flex-wrap">
- <code className="font-mono text-sm bg-bg px-2 py-0.5 rounded border border-border">{bc.code}</code>
- <span className={clsx('text-xs px-2 py-0.5 rounded-full border', statusColors[status])}>
- {t(`bindCode.${status}`)}
- </span>
- <span className="text-xs text-muted">
- {bc.type === 'one_time' ? t('bindCode.oneTime') : t('bindCode.expiring')}
- </span>
- {bc.used_by.length > 0 && (
- <span className="text-xs text-muted">{t('bindCode.usedBy', { count: bc.used_by.length })}</span>
- )}
- {bc.type === 'expiring' && bc.expires_at && (
- <span className="text-xs text-muted">
- {t('bindCode.expiresAt', { date: new Date(bc.expires_at).toLocaleDateString() })}
- </span>
- )}
- </div>
- <div className="flex items-center gap-2">
- <button
- onClick={() => handleCopy(bc.code)}
- className="p-1.5 text-muted hover:text-text transition-colors"
- title={t('bindCode.copy')}
- >
- {copiedCode === bc.code ? <Check size={14} className="text-success" /> : <Copy size={14} />}
- </button>
- {bc.is_active && (
- <button
- onClick={() => handleDelete(bc.code)}
- className="p-1.5 text-muted hover:text-danger transition-colors"
- title={t('bindCode.delete')}
- >
- <Trash2 size={14} />
- </button>
- )}
- </div>
- </div>
- );
- };
-
return (
<>
- <div className="mb-6 bg-panel border border-border rounded-xl p-4 shadow-sm">
- <div className="flex items-center justify-between mb-3 gap-2">
- <h3 className="text-lg font-semibold font-display">{t('bindCode.title')}</h3>
- <div className="flex items-center gap-2">
- {unavailableCodes.length > 0 && (
+ <div
+ className="flex flex-col gap-5 rounded-2xl border bg-surface-2/40 p-5 shadow-[0_24px_48px_-30px_rgba(91,255,160,0.20)] md:flex-row md:flex-wrap md:items-stretch md:justify-between md:gap-6 md:p-6"
+ style={{ borderColor: 'rgba(91,255,160,0.33)' }}
+ >
+ {/* Actions area — appears first on mobile, right on desktop */}
+ <div className="-order-1 flex flex-col items-stretch gap-3 md:order-none md:shrink-0 md:items-end">
+ {primary ? (
+ <ActiveCodeBox
+ code={primary}
+ onCopy={() => handleCopy(primary.code)}
+ copied={copiedCode === primary.code}
+ t={t}
+ />
+ ) : (
+ <span className="inline-flex items-center gap-1.5 font-mono text-[10px] font-bold tracking-[0.12em] text-muted">
+ <span className="size-1.5 rounded-full bg-muted" />
+ {t('bindCode.noActiveCode')}
+ </span>
+ )}
+ <div className="flex flex-wrap items-center gap-2">
+ {moreCount > 0 || otherCodes.length > 0 ? (
+ <button
+ type="button"
+ onClick={() => setShowAllModal(true)}
+ className="rounded-md border border-border bg-white/[0.04] px-3.5 py-2 text-[12px] font-medium text-muted transition-colors hover:border-border-strong hover:text-foreground"
+ >
+ {moreCount > 0
+ ? t('bindCode.viewMore', { count: moreCount })
+ : t('bindCode.viewUnavailable', { count: otherCodes.length })}
+ </button>
+ ) : null}
+ {primary && (
<button
- onClick={() => setShowUnavailableModal(true)}
- className="px-3 py-1.5 bg-neutral-100 hover:bg-neutral-200 text-text rounded text-sm font-medium transition-colors"
+ type="button"
+ onClick={() => handleDelete(primary.code)}
+ className="rounded-md border border-border bg-white/[0.04] px-3.5 py-2 text-[12px] font-medium text-muted transition-colors hover:border-danger/40 hover:text-danger"
>
- {t('bindCode.viewUnavailable', { count: unavailableCodes.length })}
+ {t('bindCode.revoke')}
</button>
)}
<button
- onClick={() => setShowForm(!showForm)}
- className="flex items-center gap-1.5 px-3 py-1.5 bg-accent hover:bg-accent/90 text-white rounded text-sm font-medium transition-colors"
+ type="button"
+ onClick={() => setShowFormModal(true)}
+ className="inline-flex items-center gap-1.5 rounded-md bg-mint px-3.5 py-2 text-[12px] font-bold text-background shadow-[0_0_16px_rgba(91,255,160,0.35)] transition hover:brightness-110"
>
- <Plus size={14} /> {t('bindCode.newCode')}
+ <Plus size={14} strokeWidth={2.4} />
+ {primary ? t('bindCode.newCode') : t('bindCode.createCode')}
</button>
</div>
</div>
- <div className="mb-4 rounded-lg border border-blue-200 bg-blue-50 p-3 text-sm text-blue-900">
- <div className="flex items-center gap-2 font-medium text-blue-800">
- <HelpCircle size={14} /> {t('bindCode.usageTitle')}
- </div>
- <p className="mt-1 text-blue-900">{t('bindCode.usageHint')}</p>
+ {/* Invite copy — appears below actions on mobile, left on desktop */}
+ <div className="flex min-w-0 flex-col gap-2.5 md:flex-1">
+ <span className="inline-flex w-max items-center gap-1.5 rounded-full border border-mint/40 bg-mint-soft px-2.5 py-1 font-mono text-[10px] font-bold tracking-[0.12em] text-mint">
+ <KeyRound size={11} strokeWidth={2.4} />
+ {t('bindCode.badge')}
+ </span>
+ <h3 className="text-[18px] font-bold leading-tight tracking-[-0.3px] text-foreground">
+ {t('bindCode.inviteTitle')}
+ </h3>
+ <p className="max-w-[560px] text-[13px] leading-[1.55] text-muted">
+ {t('bindCode.inviteDescription')}
+ </p>
</div>
+ </div>
- {showForm && (
- <div className="mb-4 p-3 bg-bg border border-border rounded-lg space-y-3">
+ {showFormModal && (
+ <Modal title={t('bindCode.newCode')} onClose={() => setShowFormModal(false)}>
+ <div className="space-y-4 p-4 text-sm">
<div className="flex items-center gap-4">
- <label className="text-sm text-muted">{t('bindCode.codeType')}</label>
- <label className="flex items-center gap-1.5 text-sm">
- <input type="radio" checked={newType === 'one_time'} onChange={() => setNewType('one_time')} className="text-accent" />
+ <span className="text-muted">{t('bindCode.codeType')}</span>
+ <label className="flex items-center gap-1.5 text-foreground">
+ <input
+ type="radio"
+ checked={newType === 'one_time'}
+ onChange={() => setNewType('one_time')}
+ className="text-mint"
+ />
{t('bindCode.oneTime')}
</label>
- <label className="flex items-center gap-1.5 text-sm">
- <input type="radio" checked={newType === 'expiring'} onChange={() => setNewType('expiring')} className="text-accent" />
+ <label className="flex items-center gap-1.5 text-foreground">
+ <input
+ type="radio"
+ checked={newType === 'expiring'}
+ onChange={() => setNewType('expiring')}
+ className="text-mint"
+ />
{t('bindCode.expiring')}
</label>
</div>
{newType === 'expiring' && (
<div className="flex items-center gap-3">
- <label className="text-sm text-muted">{t('bindCode.expirationDate')}</label>
+ <label className="text-muted">{t('bindCode.expirationDate')}</label>
<input
type="date"
value={newExpiry}
onChange={(e) => setNewExpiry(e.target.value)}
min={new Date().toISOString().split('T')[0]}
- className="bg-bg border border-border rounded px-3 py-1.5 text-sm focus:outline-none focus:border-accent text-text"
+ className="rounded-lg border border-border bg-surface px-3 py-1.5 text-foreground focus:border-cyan focus:outline-none"
/>
</div>
)}
<button
+ type="button"
onClick={handleCreate}
disabled={loading || (newType === 'expiring' && !newExpiry)}
- className="px-4 py-1.5 bg-accent hover:bg-accent/90 text-white rounded text-sm font-medium disabled:opacity-50 transition-colors"
+ className="rounded-md bg-mint px-4 py-1.5 text-[12px] font-bold text-background shadow-[0_0_16px_rgba(91,255,160,0.35)] transition hover:brightness-110 disabled:opacity-50"
>
{t('bindCode.generate')}
</button>
</div>
- )}
-
- {codes.length === 0 ? (
- <p className="text-sm text-muted">{t('bindCode.noCodes')}</p>
- ) : activeCodes.length === 0 ? (
- <p className="text-sm text-muted">{t('bindCode.noAvailableCodes')}</p>
- ) : (
- <div className="divide-y divide-border">
- {activeCodes.map(renderCodeRow)}
- </div>
- )}
- </div>
+ </Modal>
+ )}
- {showUnavailableModal && (
- <div
- className="fixed inset-0 z-50 flex items-center justify-center bg-black/40"
- role="dialog"
- aria-modal="true"
- aria-label={t('bindCode.unavailableTitle')}
- onClick={() => setShowUnavailableModal(false)}
- >
- <div
- className="bg-panel border border-border rounded-xl shadow-xl w-full max-w-2xl max-h-[75vh] flex flex-col"
- onClick={(e) => e.stopPropagation()}
- >
- <div className="flex items-center justify-between px-4 py-3 border-b border-border">
- <h4 className="text-base font-semibold text-text">{t('bindCode.unavailableTitle')}</h4>
- <button
- onClick={() => setShowUnavailableModal(false)}
- className="text-muted hover:text-text transition-colors"
- title={t('bindCode.close')}
- >
- <X size={16} />
- </button>
- </div>
- <div className="px-4 py-2 overflow-y-auto">
- {unavailableCodes.length === 0 ? (
- <p className="text-sm text-muted py-4">{t('bindCode.noUnavailableCodes')}</p>
- ) : (
- <div className="divide-y divide-border">{unavailableCodes.map(renderCodeRow)}</div>
- )}
- </div>
+ {showAllModal && (
+ <Modal title={t('bindCode.allCodesTitle')} onClose={() => setShowAllModal(false)}>
+ <div className="max-h-[60vh] overflow-y-auto p-2">
+ {codes.length === 0 ? (
+ <p className="p-4 text-sm text-muted">{t('bindCode.noCodes')}</p>
+ ) : (
+ <div className="divide-y divide-border">
+ {codes.map((bc) => {
+ const status = getCodeStatus(bc);
+ return (
+ <div key={bc.code} className="flex flex-wrap items-center justify-between gap-3 px-3 py-2.5">
+ <div className="flex flex-wrap items-center gap-2">
+ <code className="rounded border border-border bg-surface px-2 py-0.5 font-mono text-[12px] text-foreground">{bc.code}</code>
+ <span
+ className={clsx(
+ 'rounded-full border px-2 py-0.5 text-[10px] font-mono font-bold tracking-[0.12em]',
+ status === 'active' && 'border-mint/40 bg-mint-soft text-mint',
+ status === 'used' && 'border-border bg-white/[0.04] text-muted',
+ status === 'expired' && 'border-gold/40 bg-gold/10 text-gold',
+ status === 'inactive' && 'border-border bg-white/[0.04] text-muted',
+ )}
+ >
+ {t(`bindCode.${status}`)}
+ </span>
+ <span className="text-[11px] text-muted">
+ {bc.type === 'one_time' ? t('bindCode.oneTime') : t('bindCode.expiring')}
+ </span>
+ {bc.used_by.length > 0 && (
+ <span className="text-[11px] text-muted">{t('bindCode.usedBy', { count: bc.used_by.length })}</span>
+ )}
+ {bc.expires_at && (
+ <span className="text-[11px] text-muted">
+ {t('bindCode.expiresAt', { date: new Date(bc.expires_at).toLocaleDateString() })}
+ </span>
+ )}
+ </div>
+ <div className="flex items-center gap-1.5">
+ <button
+ type="button"
+ onClick={() => handleCopy(bc.code)}
+ title={t('bindCode.copy')}
+ className="rounded p-1.5 text-muted transition-colors hover:text-foreground"
+ >
+ {copiedCode === bc.code ? <Check size={14} className="text-mint" /> : <Copy size={14} />}
+ </button>
+ {bc.is_active && (
+ <button
+ type="button"
+ onClick={() => handleDelete(bc.code)}
+ title={t('bindCode.delete')}
+ className="rounded p-1.5 text-muted transition-colors hover:text-danger"
+ >
+ <Trash2 size={14} />
+ </button>
+ )}
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ )}
</div>
- </div>
+ </Modal>
)}
</>
);
};
+const ActiveCodeBox: React.FC<{
+ code: BindCodeItem;
+ onCopy: () => void;
+ copied: boolean;
+ t: (k: string, opts?: any) => string;
+}> = ({ code, onCopy, copied, t }) => {
+ const expiryLabel = code.type === 'expiring' && code.expires_at
+ ? t('bindCode.expiresIn', { time: formatExpiry(code.expires_at) })
+ : t('bindCode.noExpiry');
+
+ return (
+ <div className="flex flex-col items-stretch gap-1 md:items-end">
+ <span className="font-mono text-[10px] font-bold tracking-[0.12em] text-gold">
+ {t('bindCode.activeCodeLabel')} · {expiryLabel}
+ </span>
+ <button
+ type="button"
+ onClick={onCopy}
+ className="inline-flex items-center justify-between gap-2.5 rounded-lg border bg-background px-4 py-2.5 transition-colors hover:brightness-110 md:justify-start"
+ style={{ borderColor: 'rgba(255,200,87,0.33)' }}
+ title={t('bindCode.copy')}
+ >
+ <span className="font-mono text-[18px] font-bold tracking-[0.12em] text-gold">{code.code}</span>
+ {copied ? (
+ <Check size={14} className="shrink-0 text-mint" />
+ ) : (
+ <Copy size={14} className="shrink-0 text-muted" />
+ )}
+ </button>
+ </div>
+ );
+};
+
+const Modal: React.FC<{ title: string; onClose: () => void; children: React.ReactNode }> = ({ title, onClose, children }) => (
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4"
+ role="dialog"
+ aria-modal="true"
+ aria-label={title}
+ onClick={onClose}
+ >
+ <div
+ className="flex max-h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-border bg-surface-2 shadow-[0_42px_80px_-42px_rgba(0,0,0,0.85)]"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <div className="flex items-center justify-between border-b border-border px-4 py-3">
+ <h4 className="text-base font-semibold text-foreground">{title}</h4>
+ <button
+ type="button"
+ onClick={onClose}
+ className="rounded text-muted transition-colors hover:text-foreground"
+ title={title}
+ >
+ <X size={16} />
+ </button>
+ </div>
+ {children}
+ </div>
+ </div>
+);
+
// ─── User List Page ──────────────────────────────────────────────────────
export const UserList: React.FC = () => {
@@ -305,7 +438,7 @@ export const UserList: React.FC = () => {
const api = useApi();
const { showToast } = useToast();
const [, setLoading] = useState(false);
- const [users, setUsers] = useState<Record<string, UserConfig>>({});
+ const [usersByPlatform, setUsersByPlatform] = useState<Record<string, Record<string, UserConfig>>>({});
const [config, setConfig] = useState<any>({});
const [opencodeOptionsByCwd, setOpencodeOptionsByCwd] = useState<Record<string, any>>({});
const [claudeAgentsByCwd, setClaudeAgentsByCwd] = useState<Record<string, any[]>>({});
@@ -314,30 +447,36 @@ export const UserList: React.FC = () => {
const [claudeReasoningOptions, setClaudeReasoningOptions] = useState<Record<string, { value: string; label: string }[]>>({});
const [codexModels, setCodexModels] = useState<string[]>([]);
const [browsingCwdFor, setBrowsingCwdFor] = useState<string | null>(null);
- const [selectedPlatform, setSelectedPlatform] = useState<string>('slack');
+ const [searchQuery, setSearchQuery] = useState('');
+ const [showDisabled, setShowDisabled] = useState(false);
+ const [expandedKey, setExpandedKey] = useState<string | null>(null);
+ const [refreshTrigger, setRefreshTrigger] = useState(0);
- useEffect(() => {
- api.getConfig().then((loadedConfig) => {
- setConfig(loadedConfig);
- const enabled = getEnabledPlatforms(loadedConfig);
- setSelectedPlatform(enabled[0] || 'slack');
- });
- }, []);
+ const enabledPlatforms = useMemo(() => getEnabledPlatforms(config), [config]);
useEffect(() => {
- if (!selectedPlatform) return;
- loadUsers(selectedPlatform);
- }, [selectedPlatform]);
+ api.getConfig().then((loadedConfig) => setConfig(loadedConfig));
+ }, []);
- const loadUsers = async (platform: string) => {
- try {
- const result = await api.getUsers(platform);
- if (result.ok) setUsers(result.users || {});
- } catch (e) {
- console.error('Failed to load users:', e);
- }
+ const loadAllUsers = async () => {
+ if (!enabledPlatforms.length) return;
+ const results = await Promise.all(
+ enabledPlatforms.map(async (p) => {
+ try {
+ const r = await api.getUsers(p);
+ return [p, r.ok ? (r.users || {}) : {}] as const;
+ } catch {
+ return [p, {}] as const;
+ }
+ })
+ );
+ const next: Record<string, Record<string, UserConfig>> = {};
+ for (const [p, u] of results) next[p] = u as Record<string, UserConfig>;
+ setUsersByPlatform(next);
};
+ useEffect(() => { loadAllUsers(); }, [enabledPlatforms.join(','), refreshTrigger]);
+
const loadOpenCodeOptions = async (cwd: string) => {
try {
const result = await api.opencodeOptions(cwd);
@@ -374,24 +513,52 @@ export const UserList: React.FC = () => {
if (config.agents?.codex?.enabled) api.codexModels().then(r => r.ok && setCodexModels(r.models || []));
}, [config.agents?.codex?.enabled]);
- // Load agent options for enabled users
+ // Aggregate users
+ const aggregated = useMemo<AggregatedUser[]>(() => {
+ const flat: AggregatedUser[] = [];
+ for (const [platform, users] of Object.entries(usersByPlatform)) {
+ for (const [userId, cfg] of Object.entries(users)) {
+ flat.push({ key: `${platform}::${userId}`, platform, userId, config: cfg });
+ }
+ }
+ return flat.sort(
+ (a, b) =>
+ Number(b.config.is_admin) - Number(a.config.is_admin) ||
+ a.config.display_name.localeCompare(b.config.display_name) ||
+ a.userId.localeCompare(b.userId)
+ );
+ }, [usersByPlatform]);
+
+ // Filtered and search-applied list
+ const visibleUsers = useMemo(() => {
+ const q = searchQuery.trim().toLowerCase();
+ return aggregated.filter((u) => {
+ if (!showDisabled && !u.config.enabled) return false;
+ if (!q) return true;
+ const name = (u.config.display_name || '').toLowerCase();
+ const id = u.userId.toLowerCase();
+ return name.includes(q) || id.includes(q);
+ });
+ }, [aggregated, searchQuery, showDisabled]);
+
+ // Load agent options for visible enabled users
useEffect(() => {
const defaultCwd = config.runtime?.default_cwd || '~/work';
const defaultBackend = config.agents?.default_backend || 'opencode';
- Object.values(users).forEach((u) => {
- if (!u.enabled) return;
- const cwd = u.custom_cwd || defaultCwd;
- const backend = u.routing?.agent_backend || defaultBackend;
+ aggregated.forEach((u) => {
+ if (!u.config.enabled) return;
+ const cwd = u.config.custom_cwd || defaultCwd;
+ const backend = u.config.routing?.agent_backend || defaultBackend;
if (backend === 'opencode' && config.agents?.opencode?.enabled && !opencodeOptionsByCwd[cwd]) loadOpenCodeOptions(cwd);
if (backend === 'claude' && config.agents?.claude?.enabled && !claudeAgentsByCwd[cwd]) loadClaudeAgents(cwd);
if (backend === 'codex' && config.agents?.codex?.enabled && !codexAgentsByCwd[cwd]) loadCodexAgents(cwd);
});
- }, [users, config]);
+ }, [aggregated, config]);
- const persistUsers = async (next: Record<string, UserConfig>) => {
+ const persistUsers = async (platform: string, next: Record<string, UserConfig>) => {
setLoading(true);
try {
- await api.saveUsers({ users: next }, selectedPlatform);
+ await api.saveUsers({ users: next }, platform);
showToast(t('userList.settingsSaved'));
} catch {
showToast(t('userList.settingsSaveFailed'), 'error');
@@ -400,28 +567,30 @@ export const UserList: React.FC = () => {
}
};
- const updateUser = (userId: string, patch: Partial<UserConfig>) => {
- const base = users[userId] || defaultUserConfig();
+ const updateUser = (platform: string, userId: string, patch: Partial<UserConfig>) => {
+ const platformUsers = usersByPlatform[platform] || {};
+ const base = platformUsers[userId] || defaultUserConfig();
const next = { ...base, ...patch };
if (!next.routing || typeof next.routing !== 'object') {
next.routing = { agent_backend: config.agents?.default_backend || 'opencode' };
}
- const nextUsers = { ...users, [userId]: next };
- setUsers(nextUsers);
- void persistUsers(nextUsers);
+ const nextPlatformUsers = { ...platformUsers, [userId]: next };
+ setUsersByPlatform((prev) => ({ ...prev, [platform]: nextPlatformUsers }));
+ void persistUsers(platform, nextPlatformUsers);
};
- const handleToggleAdmin = async (userId: string, isAdmin: boolean) => {
- const current = users[userId];
- const currentAdminCount = Object.values(users).filter((u) => u.is_admin).length;
- if (current?.is_admin && !isAdmin && currentAdminCount <= 1) {
+ const handleToggleAdmin = async (platform: string, userId: string, isAdmin: boolean) => {
+ const platformUsers = usersByPlatform[platform] || {};
+ const current = platformUsers[userId];
+ const adminCount = Object.values(platformUsers).filter((u) => u.is_admin).length;
+ if (current?.is_admin && !isAdmin && adminCount <= 1) {
if (!confirm(t('userList.lastAdminDemoteWarning'))) return;
}
try {
- const result = await api.toggleAdmin(userId, isAdmin, selectedPlatform);
+ const result = await api.toggleAdmin(userId, isAdmin, platform);
if (result.ok) {
showToast(t('userList.adminToggled'));
- loadUsers(selectedPlatform);
+ loadAllUsers();
} else {
showToast(result.error || t('userList.cannotRemoveLastAdmin'), 'error');
}
@@ -430,16 +599,17 @@ export const UserList: React.FC = () => {
}
};
- const handleRemoveUser = async (userId: string) => {
- const current = users[userId];
- const currentAdminCount = Object.values(users).filter((u) => u.is_admin).length;
- const warningKey = current?.is_admin && currentAdminCount <= 1 ? 'userList.lastAdminRemoveWarning' : 'userList.removeConfirm';
+ const handleRemoveUser = async (platform: string, userId: string) => {
+ const platformUsers = usersByPlatform[platform] || {};
+ const current = platformUsers[userId];
+ const adminCount = Object.values(platformUsers).filter((u) => u.is_admin).length;
+ const warningKey = current?.is_admin && adminCount <= 1 ? 'userList.lastAdminRemoveWarning' : 'userList.removeConfirm';
if (!confirm(t(warningKey))) return;
try {
- const result = await api.removeUser(userId, selectedPlatform);
+ const result = await api.removeUser(userId, platform);
if (result.ok) {
showToast(t('userList.userRemoved'));
- loadUsers(selectedPlatform);
+ loadAllUsers();
} else {
showToast(result.error || '', 'error');
}
@@ -469,394 +639,281 @@ export const UserList: React.FC = () => {
},
});
- const getReasoningOptions = (cwd: string, modelKey: string) => {
- const lookup = opencodeOptionsByCwd[cwd]?.reasoning_options || {};
- return (lookup as Record<string, { value: string; label: string }[]>)[modelKey] || [];
- };
-
- const getClaudeReasoningOptions = (model: string) => {
- const modelKey = model || '';
- const cached = claudeReasoningOptions[modelKey];
- if (cached?.length) return cached;
-
- const fallback = claudeReasoningOptions[''] || [];
- const normalizedModel = modelKey.toLowerCase();
- if (normalizedModel.includes('claude-opus-4-7') || normalizedModel === 'opus' || normalizedModel === 'opus[1m]') {
- const options = [...fallback];
- if (!options.some((option) => option.value === 'xhigh')) {
- options.push({ value: 'xhigh', label: 'Extra High' });
- }
- if (!options.some((option) => option.value === 'max')) {
- options.push({ value: 'max', label: 'Max' });
- }
- return options;
- }
- if (normalizedModel.includes('claude-opus-4-6') || normalizedModel.includes('claude-sonnet-4-6')) {
- return fallback.some((option) => option.value === 'max')
- ? fallback
- : [...fallback, { value: 'max', label: 'Max' }];
- }
-
- return fallback;
- };
+ const totalCount = aggregated.length;
- const getReasoningLabel = (value: string, fallback: string) => {
- switch (value) {
- case 'low':
- return t('channelList.reasoningLow');
- case 'medium':
- return t('channelList.reasoningMedium');
- case 'high':
- return t('channelList.reasoningHigh');
- case 'xhigh':
- return t('channelList.reasoningXHigh');
- case 'max':
- return t('channelList.reasoningMax');
- default:
- return fallback;
- }
+ // Backend label helper
+ const backendLabel = (backend: string) => {
+ if (backend === 'claude') return 'Claude';
+ if (backend === 'codex') return 'Codex';
+ return 'OpenCode';
};
- const userEntries = Object.entries(users).sort(
- (a, b) => Number(b[1].is_admin) - Number(a[1].is_admin) || a[1].display_name.localeCompare(b[1].display_name)
- );
- const enabledPlatforms = getEnabledPlatforms(config);
-
return (
<>
- <div className="max-w-5xl mx-auto flex flex-col h-full">
- <div className="flex justify-between items-center mb-6">
- <div>
- <h2 className="text-3xl font-display font-bold">{t('userList.title')}</h2>
- <p className="text-muted">{t('userList.subtitle')}</p>
+ <div className="flex h-full flex-col gap-5">
+ {/* Page header */}
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="flex flex-col gap-1.5">
+ <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('userList.title')}
+ </h1>
+ <p className="text-[14px] leading-[1.55] text-muted">{t('userList.subtitle')}</p>
+ </div>
+ <div className="flex items-center gap-2">
+ <div className="relative">
+ <Search size={14} className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted" />
+ <input
+ type="search"
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ placeholder={t('userList.filterPlaceholder')}
+ className="h-9 w-[280px] rounded-lg border border-border bg-surface pl-9 pr-3 text-[13px] text-foreground placeholder:text-muted focus:border-mint/50 focus:outline-none"
+ />
+ </div>
+ <button
+ type="button"
+ onClick={() => setRefreshTrigger((v) => v + 1)}
+ className="inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-3 text-[13px] font-medium text-foreground transition-colors hover:border-border-strong"
+ title={t('common.refresh', { defaultValue: 'Refresh' })}
+ >
+ <RefreshCw size={14} />
+ </button>
+ </div>
</div>
- </div>
- <div className="mb-4 flex flex-wrap gap-2">
- {enabledPlatforms.map((platform) => (
- <button
- key={platform}
- onClick={() => setSelectedPlatform(platform)}
- className={clsx(
- 'px-3 py-1.5 rounded-full text-sm border transition-colors',
- selectedPlatform === platform ? 'bg-accent text-white border-accent' : 'bg-panel text-text border-border hover:border-accent/60'
- )}
- >
- {t(`platform.${platform}.title`)}
- </button>
- ))}
- </div>
+ {/* Bind code card */}
+ <BindCodeCard
+ refreshTrigger={refreshTrigger}
+ onCodesChanged={() => setRefreshTrigger((v) => v + 1)}
+ />
- {selectedPlatform === 'wechat' ? (
- <div className="mb-6 bg-panel border border-border rounded-xl p-4 shadow-sm">
- <p className="text-sm text-muted">{t('wechat.userBound')}</p>
+ {/* List header */}
+ <div className="flex items-center justify-between px-1 py-2">
+ <div className="flex items-center gap-2">
+ <span className="text-[15px] font-semibold text-foreground">{t('userList.allUsers')}</span>
+ <span className="rounded-full bg-white/[0.08] px-1.5 py-0.5 font-mono text-[11px] font-bold text-muted">
+ {totalCount}
+ </span>
+ </div>
+ <label className="flex cursor-pointer items-center gap-1.5 text-[12px] text-muted">
+ <span>{t('userList.showDisabled')}</span>
+ <input
+ type="checkbox"
+ checked={showDisabled}
+ onChange={(e) => setShowDisabled(e.target.checked)}
+ className="sr-only"
+ />
+ <span
+ className={clsx(
+ 'relative inline-flex h-[18px] w-[30px] items-center rounded-full transition-colors',
+ showDisabled ? 'bg-mint' : 'bg-white/[0.08]'
+ )}
+ >
+ <span
+ className={clsx(
+ 'inline-block h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-transform',
+ showDisabled ? 'translate-x-[14px]' : 'translate-x-0.5'
+ )}
+ />
+ </span>
+ </label>
</div>
- ) : (
- <BindCodeSection />
- )}
- <div className="flex-1 overflow-y-auto border border-border rounded-xl divide-y divide-border bg-panel shadow-sm">
- {userEntries.length === 0 ? (
- <div className="p-8 text-center text-muted">{t('userList.noUsers')}</div>
- ) : (
- userEntries.map(([userId, userConfig]) => {
- const effectiveCwd = userConfig.custom_cwd || config.runtime?.default_cwd || '~/work';
- const effectiveBackend = userConfig.routing?.agent_backend || config.agents?.default_backend || 'opencode';
- const opencodeOptions = opencodeOptionsByCwd[effectiveCwd];
- const claudeAgents = claudeAgentsByCwd[effectiveCwd] || [];
- const codexAgents = codexAgentsByCwd[effectiveCwd] || [];
- return (
- <div key={userId} className="p-4 hover:bg-neutral-50/50 transition-colors">
- {/* User header row */}
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-3">
- <User size={20} className="text-muted" />
- <div>
- <div className="font-medium flex items-center gap-2 text-text">
- {userConfig.display_name || userId}
- {userConfig.is_admin && (
- <span className="text-xs px-1.5 py-0.5 rounded bg-accent/10 text-accent border border-accent/20 font-medium">{t('userList.admin')}</span>
- )}
- </div>
- <div className="text-xs text-muted font-mono">ID: {userId}</div>
- {userConfig.bound_at && (
- <div className="text-xs text-muted">
- {t('userList.boundAt')}: {new Date(userConfig.bound_at).toLocaleDateString()}
- </div>
- )}
- </div>
- </div>
- <div className="flex items-center gap-2">
- {/* Admin toggle */}
- <button
- onClick={() => handleToggleAdmin(userId, !userConfig.is_admin)}
+ {/* User cards — design.pen asPXu (VR/RoutingConfig) shared with /groups */}
+ <div className="flex-1 space-y-3 overflow-y-auto">
+ {visibleUsers.length === 0 ? (
+ <div className="rounded-xl border border-dashed border-border bg-surface-3/60 p-8 text-center text-[13px] text-muted">
+ {searchQuery ? t('userList.noUsersForSearch') : t('userList.noUsers')}
+ </div>
+ ) : (
+ visibleUsers.map((u) => {
+ const expanded = expandedKey === u.key;
+ const userConfig = u.config;
+ const defaultBackend = config.agents?.default_backend || 'opencode';
+ const effectiveBackend = userConfig.routing?.agent_backend || defaultBackend;
+ const effectiveCwd = userConfig.custom_cwd || config.runtime?.default_cwd || '~/work';
+ const opencodeOptions = opencodeOptionsByCwd[effectiveCwd];
+ const claudeAgents = claudeAgentsByCwd[effectiveCwd] || [];
+ const codexAgents = codexAgentsByCwd[effectiveCwd] || [];
+ const isBot = !userConfig.is_admin && (userConfig.display_name || u.userId).toLowerCase().includes('bot');
+ const tone = AVATAR_TONES[hashCode(u.userId) % AVATAR_TONES.length];
+ const initials = getInitials(userConfig.display_name, u.userId);
+ const backendModel = effectiveBackend === 'claude'
+ ? userConfig.routing.claude_model
+ : effectiveBackend === 'codex'
+ ? userConfig.routing.codex_model
+ : userConfig.routing.opencode_model;
+
+ const updateRow = (patch: Partial<UserConfig>) => updateUser(u.platform, u.userId, patch);
+ const toggleEnabled = () => updateRow({ enabled: !userConfig.enabled });
+ const toggleAdmin = () => handleToggleAdmin(u.platform, u.userId, !userConfig.is_admin);
+
+ return (
+ <div
+ key={u.key}
+ className={clsx(
+ 'rounded-xl border transition-colors',
+ expanded
+ ? 'border-mint/30 bg-surface-2/70 shadow-[0_0_32px_-8px_rgba(91,255,160,0.45)]'
+ : userConfig.enabled
+ ? 'border-border bg-background hover:border-border-strong'
+ : 'border-border bg-background/60 opacity-70'
+ )}
+ >
+ {/* Master row — matches /groups layout */}
+ <button
+ type="button"
+ onClick={() => setExpandedKey(expanded ? null : u.key)}
+ className="flex w-full items-center gap-3.5 px-5 py-3.5 text-left"
+ >
+ {/* Enabled toggle */}
+ <span
+ role="switch"
+ aria-checked={userConfig.enabled}
+ tabIndex={0}
+ onClick={(e) => { e.stopPropagation(); toggleEnabled(); }}
+ onKeyDown={(e) => {
+ if (e.key === ' ' || e.key === 'Enter') {
+ e.preventDefault();
+ e.stopPropagation();
+ toggleEnabled();
+ }
+ }}
className={clsx(
- 'flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors border',
- userConfig.is_admin
- ? 'bg-accent/10 text-accent border-accent/20 hover:bg-accent/20'
- : 'bg-neutral-100 text-muted border-border hover:bg-neutral-200'
+ 'relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors',
+ userConfig.enabled ? 'bg-mint' : 'bg-neutral-300'
)}
- title={userConfig.is_admin ? 'Remove admin' : 'Make admin'}
- >
- {userConfig.is_admin ? <Shield size={12} /> : <ShieldOff size={12} />}
- {userConfig.is_admin ? t('userList.admin') : t('userList.user')}
- </button>
- {/* Remove */}
- <button
- onClick={() => handleRemoveUser(userId)}
- className="p-1.5 text-muted hover:text-danger transition-colors"
- title={t('userList.removeUser')}
>
- <Trash2 size={14} />
- </button>
- </div>
- </div>
-
- {/* User settings (always shown for enabled users) */}
- {userConfig.enabled && (
- <div className="mt-4 pl-8 space-y-4">
- {/* Basic Settings */}
- <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
- <div className="space-y-1">
- <label className="text-xs font-medium text-muted uppercase">{t('channelList.workingDirectory')}</label>
- <div className="flex gap-1.5">
- <BlurInput
- type="text"
- placeholder={config.runtime?.default_cwd || t('channelList.useGlobalDefault')}
- value={userConfig.custom_cwd}
- onCommit={(v) => updateUser(userId, { custom_cwd: v })}
- className="flex-1 bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text placeholder:text-muted/50 font-mono"
- />
- <button
- type="button"
- onClick={() => setBrowsingCwdFor(userId)}
- title={t('directoryBrowser.title')}
- className="px-2 py-2 bg-neutral-100 hover:bg-neutral-200 border border-border rounded text-muted hover:text-text transition-colors shrink-0"
- >
- <FolderOpen size={14} />
- </button>
- </div>
- </div>
- <div className="space-y-1">
- <label className="text-xs font-medium text-muted uppercase">{t('channelList.backend')}</label>
- <select
- value={effectiveBackend}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, agent_backend: e.target.value } })}
- className="w-full bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text"
- >
- <option value="opencode">OpenCode</option>
- <option value="claude">ClaudeCode</option>
- <option value="codex">Codex</option>
- </select>
- </div>
- </div>
-
- {/* Show Message Types */}
- <div className="space-y-2">
- <div className="text-xs font-medium text-muted uppercase flex items-center gap-1">
- {t('channelList.showMessageTypes')}
- <span className="relative group">
- <HelpCircle size={12} className="text-muted/50 cursor-help" />
- <span className="absolute bottom-full left-0 mb-2 px-3 py-2 bg-text text-bg text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 w-64 whitespace-normal font-normal normal-case">
- {t('channelList.showMessageTypesHint')}
- </span>
- </span>
- </div>
- <div className="flex flex-wrap gap-3 text-sm">
- {['system', 'assistant', 'toolcall'].map((msgType) => {
- const checked = (userConfig.show_message_types || []).includes(msgType);
- return (
- <label key={msgType} className="flex items-center gap-2 text-text">
- <input
- type="checkbox"
- checked={checked}
- onChange={() => {
- const next = checked
- ? userConfig.show_message_types.filter((v) => v !== msgType)
- : [...(userConfig.show_message_types || []), msgType];
- updateUser(userId, { show_message_types: next });
- }}
- className="h-4 w-4 rounded border-border text-accent focus:ring-accent"
- />
- <span className="capitalize">{msgType === 'toolcall' ? 'Toolcall' : msgType}</span>
- </label>
- );
- })}
- </div>
- </div>
-
- {/* OpenCode Settings */}
- {effectiveBackend === 'opencode' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.opencodeSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={userConfig.routing.opencode_agent || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, opencode_agent: e.target.value || null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {(opencodeOptions?.agents || []).map((a: any) => (
- <option key={a.name} value={a.name}>{a.name}</option>
- ))}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <select
- value={userConfig.routing.opencode_model || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, opencode_model: e.target.value || null, opencode_reasoning_effort: null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {(opencodeOptions?.models?.providers || []).flatMap((provider: any) => {
- const pid = provider.id || provider.provider_id || provider.name;
- const pLabel = provider.name || pid;
- const models = provider.models || {};
- if (Array.isArray(models)) {
- return models.map((m: any) => {
- const mid = typeof m === 'string' ? m : m.id;
- return <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>;
- });
- }
- return Object.keys(models).map((mid) => (
- <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>
- ));
- })}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={userConfig.routing.opencode_reasoning_effort || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, opencode_reasoning_effort: e.target.value || null } })}
- disabled={!getReasoningOptions(effectiveCwd, userConfig.routing.opencode_model || '').length}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm disabled:opacity-50"
- >
- <option value="">{t('common.default')}</option>
- {getReasoningOptions(effectiveCwd, userConfig.routing.opencode_model || '').map((opt) => (
- <option key={opt.value} value={opt.value}>{opt.label}</option>
- ))}
- </select>
- </div>
- </div>
- </div>
- )}
-
- {/* Claude Settings */}
- {effectiveBackend === 'claude' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.claudeSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={userConfig.routing.claude_agent || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, claude_agent: e.target.value || null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {claudeAgents.map((a: any) => <option key={a.id} value={a.id}>{a.name}</option>)}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <Combobox
- options={[{ value: '', label: t('common.default') }, ...claudeModels.map(m => ({ value: m, label: m }))]}
- value={userConfig.routing.claude_model || ''}
- onValueChange={(v) => updateUser(userId, { routing: { ...userConfig.routing, claude_model: v || null, claude_reasoning_effort: null } })}
- placeholder={t('channelList.claudeModelPlaceholder')}
- searchPlaceholder={t('channelList.searchModel')}
- allowCustomValue={true}
- />
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={userConfig.routing.claude_reasoning_effort || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, claude_reasoning_effort: e.target.value || null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {getClaudeReasoningOptions(userConfig.routing.claude_model || '')
- .filter((option) => option.value !== '__default__')
- .map((option) => (
- <option key={option.value} value={option.value}>
- {getReasoningLabel(option.value, option.label)}
- </option>
- ))}
- </select>
- </div>
- </div>
- </div>
+ <span
+ className={clsx(
+ 'inline-block h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-transform',
+ userConfig.enabled ? 'translate-x-[14px]' : 'translate-x-0.5'
+ )}
+ />
+ </span>
+
+ {/* Avatar — tone-colored ring with platform corner badge */}
+ <span className="relative shrink-0">
+ <span
+ className="flex size-[34px] items-center justify-center rounded-full border font-mono text-[12px] font-bold"
+ style={{ backgroundColor: tone.bg, borderColor: tone.border }}
+ >
+ {isBot ? (
+ <Bot size={14} className="text-muted" />
+ ) : (
+ <span className={tone.textCls}>{initials}</span>
+ )}
+ </span>
+ <span
+ className="absolute -bottom-0.5 -right-0.5 flex size-[14px] items-center justify-center rounded-full border border-border bg-background"
+ title={t(`platform.${u.platform}.title`)}
+ >
+ <PlatformIcon platform={u.platform} size={9} />
+ </span>
+ </span>
+
+ {/* Name + meta */}
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-[13px] font-semibold text-foreground">
+ {userConfig.display_name || u.userId}
+ </span>
+ <span className="block truncate font-mono text-[11px] text-muted">
+ {userConfig.enabled
+ ? `${backendLabel(effectiveBackend)}${backendModel ? `/${backendModel}` : ''} · ${u.userId}`
+ : u.userId}
+ </span>
+ </span>
+
+ {/* Admin badge — clickable; bot renders as static label */}
+ {isBot ? (
+ <span className="inline-flex shrink-0 items-center rounded-full border border-border bg-white/[0.04] px-2 py-0.5 text-[11px] font-semibold text-muted">
+ {t('userList.bot')}
+ </span>
+ ) : (
+ <span
+ role="button"
+ tabIndex={0}
+ aria-pressed={userConfig.is_admin}
+ onClick={(e) => { e.stopPropagation(); toggleAdmin(); }}
+ onKeyDown={(e) => {
+ if (e.key === ' ' || e.key === 'Enter') {
+ e.preventDefault();
+ e.stopPropagation();
+ toggleAdmin();
+ }
+ }}
+ title={userConfig.is_admin
+ ? t('userList.demoteAdminTitle', { defaultValue: 'Demote admin' })
+ : t('userList.promoteAdminTitle', { defaultValue: 'Promote to admin' })}
+ className={clsx(
+ 'inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors',
+ userConfig.is_admin
+ ? 'border-gold/40 bg-gold/10 font-bold text-gold hover:bg-gold/15'
+ : 'border-border bg-white/[0.04] text-muted hover:border-border-strong hover:text-foreground'
+ )}
+ >
+ <Shield size={11} strokeWidth={2.4} />
+ {userConfig.is_admin ? t('userList.admin') : t('userList.user')}
+ </span>
)}
- {/* Codex Settings */}
- {effectiveBackend === 'codex' && (
- <div className="space-y-3">
- <div className="text-xs font-medium text-muted uppercase">{t('channelList.codexSettings')}</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 bg-bg/50 p-3 rounded border border-border">
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.agent')}</label>
- <select
- value={userConfig.routing.codex_agent || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, codex_agent: e.target.value || null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- {codexAgents.map((a: any) => <option key={a.id} value={a.id}>{a.name}</option>)}
- </select>
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.model')}</label>
- <Combobox
- options={[{ value: '', label: t('common.default') }, ...codexModels.map(m => ({ value: m, label: m }))]}
- value={userConfig.routing.codex_model || ''}
- onValueChange={(v) => updateUser(userId, { routing: { ...userConfig.routing, codex_model: v || null } })}
- placeholder={t('channelList.codexModelPlaceholder')}
- searchPlaceholder={t('channelList.searchModel')}
- allowCustomValue={true}
- />
- </div>
- <div className="space-y-1">
- <label className="text-xs text-muted">{t('channelList.reasoningEffort')}</label>
- <select
- value={userConfig.routing.codex_reasoning_effort || ''}
- onChange={(e) => updateUser(userId, { routing: { ...userConfig.routing, codex_reasoning_effort: e.target.value || null } })}
- className="w-full bg-panel border border-border rounded px-3 py-2 text-sm"
- >
- <option value="">{t('common.default')}</option>
- <option value="low">{t('channelList.reasoningLow')}</option>
- <option value="medium">{t('channelList.reasoningMedium')}</option>
- <option value="high">{t('channelList.reasoningHigh')}</option>
- <option value="xhigh">{t('channelList.reasoningXHigh')}</option>
- </select>
- </div>
- </div>
- </div>
+ {/* Chevron */}
+ {expanded ? (
+ <ChevronUp size={18} className="shrink-0 text-muted" />
+ ) : (
+ <ChevronDown size={18} className="shrink-0 text-muted" />
)}
- </div>
- )}
- </div>
- );
- })
- )}
+ </button>
+
+ {/* Expanded body — design.pen asPXu (VR/RoutingConfig) shared with /groups, no @mention toggle */}
+ {expanded && (
+ <RoutingConfigPanel
+ value={userConfig}
+ onChange={(patch) => updateRow(patch)}
+ onBrowseDirectory={() => setBrowsingCwdFor(u.key)}
+ globalConfig={config}
+ showRequireMention={false}
+ opencodeOptions={opencodeOptions}
+ claudeAgents={claudeAgents}
+ claudeModels={claudeModels}
+ claudeReasoningOptions={claudeReasoningOptions}
+ codexAgents={codexAgents}
+ codexModels={codexModels}
+ footerActions={
+ <button
+ type="button"
+ onClick={() => handleRemoveUser(u.platform, u.userId)}
+ title={t('userList.removeUser')}
+ className="inline-flex items-center gap-1.5 rounded-md border border-border bg-white/[0.04] px-3 py-1.5 text-[12px] font-medium text-muted transition-colors hover:border-danger/40 hover:text-danger"
+ >
+ <Trash2 size={12} />
+ {t('userList.removeUser')}
+ </button>
+ }
+ />
+ )}
+ </div>
+ );
+ })
+ )}
+ </div>
</div>
- </div>
- {/* Directory browser modal */}
- {browsingCwdFor && (
- <DirectoryBrowser
- initialPath={users[browsingCwdFor]?.custom_cwd || config.runtime?.default_cwd || '~/work'}
- onSelect={(path) => {
- updateUser(browsingCwdFor, { custom_cwd: path });
- setBrowsingCwdFor(null);
- }}
- onClose={() => setBrowsingCwdFor(null)}
- />
- )}
+ {/* Directory browser modal */}
+ {browsingCwdFor && (() => {
+ const found = aggregated.find((u) => u.key === browsingCwdFor);
+ if (!found) return null;
+ return (
+ <DirectoryBrowser
+ initialPath={found.config.custom_cwd || config.runtime?.default_cwd || '~/work'}
+ onSelect={(path) => {
+ updateUser(found.platform, found.userId, { custom_cwd: path });
+ setBrowsingCwdFor(null);
+ }}
+ onClose={() => setBrowsingCwdFor(null)}
+ />
+ );
+ })()}
</>
);
};
diff --git a/ui/src/components/steps/WeChatConfig.tsx b/ui/src/components/steps/WeChatConfig.tsx
index 45fcedd57..c3467b33b 100644
--- a/ui/src/components/steps/WeChatConfig.tsx
+++ b/ui/src/components/steps/WeChatConfig.tsx
@@ -1,9 +1,20 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { QRCodeSVG } from 'qrcode.react';
-import { Check, RefreshCw, Smartphone, Wifi, AlertTriangle, Loader2, KeyRound } from 'lucide-react';
+import {
+ AlertTriangle,
+ ArrowLeft,
+ ArrowRight,
+ Check,
+ KeyRound,
+ Loader2,
+ RefreshCw,
+ Smartphone,
+ Wifi,
+} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '../../context/ApiContext';
+import { EyebrowBadge, WizardCard } from '../visual';
interface WeChatConfigProps {
data: Record<string, any>;
@@ -13,11 +24,15 @@ interface WeChatConfigProps {
const QR_POLL_INTERVAL_MS = 5000;
+// Mirrors design.pen XCWAT visual treatment for the QR-driven WeChat onboarding.
+// Three-stop horizontal stepper, mint-bordered QR card, mint primary actions.
export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack }) => {
const { t } = useTranslation();
const api = useApi();
- const [loginState, setLoginState] = useState<'idle' | 'qr_ready' | 'scanning' | 'confirming' | 'connected' | 'error'>('idle');
+ const [loginState, setLoginState] = useState<
+ 'idle' | 'qr_ready' | 'scanning' | 'confirming' | 'connected' | 'error'
+ >('idle');
const [qrCodeUrl, setQrCodeUrl] = useState<string>('');
const [message, setMessage] = useState<string>('');
const [botToken, setBotToken] = useState<string>(data.wechat?.bot_token || '');
@@ -35,7 +50,6 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack
}
}, []);
- // Cleanup on unmount
useEffect(() => {
return () => {
stopPolling();
@@ -67,7 +81,6 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack
setMessage(result.message || '');
setLoginState('qr_ready');
- // Start polling
if (result.session_key) {
activeSessionKeyRef.current = result.session_key;
startPolling(result.session_key);
@@ -101,7 +114,6 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack
if (autoStartedRef.current) return;
if (starting) return;
if (loginState !== 'idle') return;
- // Don't auto-start QR flow if we already have a token from previous config
if (data.wechat?.bot_token) return;
autoStartedRef.current = true;
@@ -144,7 +156,6 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack
stopPolling();
return;
}
- // status === 'wait' — schedule next poll after the server-side long poll window
pollTimerRef.current = setTimeout(() => {
void pollOnce();
}, QR_POLL_INTERVAL_MS);
@@ -159,207 +170,250 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack
void pollOnce();
};
- // Allow proceeding if we have a token (either freshly scanned or from existing config)
const canProceed = !!botToken;
- // Whether we're showing the "already bound" idle state (existing token, QR not started)
const isAlreadyBound = loginState === 'idle' && !!botToken;
- const stepIndicator = (stepNum: number, label: string, active: boolean, completed: boolean) => (
- <div className="flex items-center gap-2">
- <span
- className={clsx(
- 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',
- completed ? 'bg-success text-white' : active ? 'bg-accent text-white' : 'bg-neutral-200 text-muted'
- )}
- >
- {completed ? <Check size={14} /> : stepNum}
- </span>
- <span className={clsx('text-sm font-medium', active || completed ? 'text-text' : 'text-muted')}>{label}</span>
- </div>
- );
-
const getStepState = () => {
if (isAlreadyBound) return { step: 3, scanning: false, connected: true };
if (loginState === 'idle') return { step: 1, scanning: false, connected: false };
if (loginState === 'qr_ready') return { step: 2, scanning: false, connected: false };
if (loginState === 'scanning' || loginState === 'confirming') return { step: 2, scanning: true, connected: false };
if (loginState === 'connected') return { step: 3, scanning: false, connected: true };
- return { step: 1, scanning: false, connected: false }; // error
+ return { step: 1, scanning: false, connected: false };
};
const { step, connected } = getStepState();
- return (
- <div className="flex flex-col h-full max-w-2xl mx-auto">
- <div className="mb-4">
- <h2 className="text-3xl font-display font-bold text-text">{t('wechatConfig.title')}</h2>
- <p className="text-muted mt-1">{t('wechatConfig.subtitle')}</p>
- </div>
+ const completedDots = connected ? 3 : step;
- {/* Step indicators */}
- <div className="mb-6 bg-panel border border-border rounded-xl p-4">
- <div className="flex items-center justify-between">
- {stepIndicator(1, t('wechatConfig.stepStart'), step === 1 && loginState !== 'error', step > 1)}
- <div className="flex-1 h-px bg-border mx-3" />
- {stepIndicator(2, t('wechatConfig.stepScan'), step === 2, step > 2)}
- <div className="flex-1 h-px bg-border mx-3" />
- {stepIndicator(3, t('wechatConfig.stepDone'), false, connected)}
- </div>
- </div>
+ const stepLabels = [t('wechatConfig.stepStart'), t('wechatConfig.stepScan'), t('wechatConfig.stepDone')];
- <div className="flex-1 space-y-4 overflow-y-auto pr-1">
- {/* Already bound — existing token, no QR needed */}
- {isAlreadyBound && (
- <div className="bg-panel border border-border rounded-xl p-6 space-y-4">
- <div className="flex flex-col items-center space-y-4">
- <div className="w-20 h-20 bg-success/10 text-success rounded-full flex items-center justify-center">
- <Check size={40} />
- </div>
- <div className="text-center">
- <h3 className="text-lg font-semibold text-text">{t('wechatConfig.alreadyBound')}</h3>
- <p className="text-sm text-muted mt-1">{t('wechatConfig.alreadyBoundDesc')}</p>
- </div>
- <div className="w-full bg-bg border border-border rounded-lg p-3">
- <div className="text-xs text-muted mb-1 flex items-center gap-1"><KeyRound size={12} /> Token</div>
- <div className="text-sm font-mono text-text truncate">{botToken.slice(0, 12)}{'•'.repeat(16)}</div>
- </div>
- <button
- onClick={() => {
- autoStartedRef.current = true;
- void startLogin();
- }}
- disabled={starting}
- className="px-4 py-2 bg-panel border border-border text-text rounded-lg flex items-center gap-2 text-sm font-medium hover:bg-neutral-50 transition-colors disabled:opacity-50"
- >
- <RefreshCw size={14} className={starting ? 'animate-spin' : ''} />
- {t('wechatConfig.rebind')}
- </button>
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard className="gap-6">
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="space-y-2">
+ <EyebrowBadge tone="mint">WeChat</EyebrowBadge>
+ <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {t('wechatConfig.title')}
+ </h2>
+ <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">
+ {t('wechatConfig.subtitle')}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-full border border-border bg-white/[0.04] px-3 py-1.5">
+ <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint">
+ {completedDots} / 3
+ </span>
+ <div className="flex gap-1">
+ {[0, 1, 2].map((i) => (
+ <span
+ key={i}
+ className={clsx(
+ 'h-1 w-6 rounded-full',
+ i < completedDots ? 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' : 'bg-white/[0.08]'
+ )}
+ />
+ ))}
</div>
</div>
- )}
+ </div>
- {/* Start Login — only when no existing token */}
- {loginState === 'idle' && !botToken && (
- <div className="bg-panel border border-border rounded-xl p-6 text-center space-y-4">
- <div className="w-16 h-16 bg-accent/10 text-accent rounded-full flex items-center justify-center mx-auto">
- <Loader2 size={32} className="animate-spin" />
- </div>
- <p className="text-sm text-muted">{starting ? t('wechatConfig.starting') : t('wechatConfig.startDescription')}</p>
+ {/* Horizontal stepper */}
+ <div className="rounded-xl border border-border bg-background px-5 py-4">
+ <div className="flex items-center justify-between gap-3">
+ {stepLabels.map((label, idx) => {
+ const num = idx + 1;
+ const isCompleted = num < step || (connected && num <= 3);
+ const isActive = !connected && num === step && loginState !== 'error';
+ return (
+ <React.Fragment key={label}>
+ <div className="flex items-center gap-2">
+ <span
+ className={clsx(
+ 'flex size-7 items-center justify-center rounded-full text-[12px] font-bold transition-colors',
+ isCompleted
+ ? 'bg-mint text-[#080812]'
+ : isActive
+ ? 'bg-cyan/15 text-cyan'
+ : 'bg-white/[0.06] text-muted'
+ )}
+ >
+ {isCompleted ? <Check size={14} /> : num}
+ </span>
+ <span
+ className={clsx(
+ 'text-[12px] font-semibold',
+ isCompleted || isActive ? 'text-foreground' : 'text-muted'
+ )}
+ >
+ {label}
+ </span>
+ </div>
+ {idx < stepLabels.length - 1 && <span className="mx-2 h-px flex-1 bg-border" />}
+ </React.Fragment>
+ );
+ })}
</div>
- )}
+ </div>
- {/* QR Code Display */}
- {(loginState === 'qr_ready' || loginState === 'scanning' || loginState === 'confirming') && (
- <div className="bg-panel border border-border rounded-xl p-6 space-y-4">
- <div className="flex flex-col items-center space-y-4">
- {/* QR Code */}
- <div className="bg-white p-4 rounded-xl shadow-sm border border-neutral-100">
- <QRCodeSVG
- value={qrCodeUrl}
- size={256}
- level="M"
- includeMargin={false}
- />
+ <div className="space-y-4">
+ {/* Already bound */}
+ {isAlreadyBound && (
+ <div className="rounded-xl border border-border bg-background px-6 py-6">
+ <div className="flex flex-col items-center gap-4 text-center">
+ <div className="flex size-16 items-center justify-center rounded-full border border-mint/30 bg-mint/[0.08] text-mint shadow-[0_0_32px_-6px_rgba(91,255,160,0.5)]">
+ <Check size={32} />
+ </div>
+ <div>
+ <h3 className="text-[16px] font-semibold text-foreground">{t('wechatConfig.alreadyBound')}</h3>
+ <p className="mt-1 text-[12px] text-muted">{t('wechatConfig.alreadyBoundDesc')}</p>
+ </div>
+ <div className="w-full max-w-md rounded-lg border border-border bg-surface-2 px-3 py-2.5 text-left">
+ <div className="mb-1 flex items-center gap-1 text-[11px] text-muted">
+ <KeyRound size={12} /> Token
+ </div>
+ <div className="truncate font-mono text-[12px] text-foreground">
+ {botToken.slice(0, 12)}
+ {'•'.repeat(16)}
+ </div>
+ </div>
+ <button
+ onClick={() => {
+ autoStartedRef.current = true;
+ void startLogin();
+ }}
+ disabled={starting}
+ className="inline-flex items-center gap-2 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[12px] font-medium text-foreground transition hover:border-border-strong disabled:opacity-50"
+ >
+ <RefreshCw size={14} className={starting ? 'animate-spin' : ''} />
+ {t('wechatConfig.rebind')}
+ </button>
</div>
+ </div>
+ )}
- {/* Status indicator */}
- <div className={clsx(
- 'flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium border',
- loginState === 'qr_ready' && 'bg-blue-50 border-blue-200 text-blue-800',
- loginState === 'scanning' && 'bg-amber-50 border-amber-200 text-amber-800',
- loginState === 'confirming' && 'bg-amber-50 border-amber-200 text-amber-800',
- )}>
- {loginState === 'qr_ready' && (
- <>
- <Loader2 size={16} className="animate-spin" />
- {t('wechatConfig.waitingForScan')}
- </>
- )}
- {(loginState === 'scanning' || loginState === 'confirming') && (
- <>
- <Smartphone size={16} />
- {t('wechatConfig.confirmOnPhone')}
- </>
- )}
+ {/* Starting */}
+ {loginState === 'idle' && !botToken && (
+ <div className="rounded-xl border border-border bg-background px-6 py-8 text-center">
+ <div className="mx-auto flex size-14 items-center justify-center rounded-full border border-cyan/30 bg-cyan/[0.06] text-cyan">
+ <Loader2 size={26} className="animate-spin" />
</div>
-
- <p className="text-xs text-muted text-center">{t('wechatConfig.scanHint')}</p>
+ <p className="mt-3 text-[13px] text-muted">
+ {starting ? t('wechatConfig.starting') : t('wechatConfig.startDescription')}
+ </p>
</div>
- </div>
- )}
+ )}
- {/* Connected */}
- {loginState === 'connected' && (
- <div className="bg-panel border border-border rounded-xl p-6 space-y-4">
- <div className="flex flex-col items-center space-y-4">
- <div className="w-20 h-20 bg-success/10 text-success rounded-full flex items-center justify-center animate-in fade-in zoom-in duration-300">
- <Check size={40} />
- </div>
- <div className="text-center">
- <h3 className="text-lg font-semibold text-text">{t('wechatConfig.connectedTitle')}</h3>
- <p className="text-sm text-muted mt-1">{message}</p>
- </div>
- <div className="flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium bg-success/10 border border-success/20 text-success">
- <Wifi size={16} />
- {t('wechatConfig.connectionEstablished')}
+ {/* QR */}
+ {(loginState === 'qr_ready' || loginState === 'scanning' || loginState === 'confirming') && (
+ <div className="rounded-xl border border-mint/35 bg-surface-2 px-6 py-6 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]">
+ <div className="flex flex-col items-center gap-4">
+ <div className="rounded-xl border border-border bg-white p-4 shadow-[0_0_24px_-4px_rgba(91,255,160,0.4)]">
+ <QRCodeSVG value={qrCodeUrl} size={224} level="M" includeMargin={false} />
+ </div>
+ <div
+ className={clsx(
+ 'inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-[12px] font-medium',
+ loginState === 'qr_ready' && 'border-cyan/30 bg-cyan/[0.06] text-cyan',
+ (loginState === 'scanning' || loginState === 'confirming') &&
+ 'border-gold/30 bg-gold/10 text-gold'
+ )}
+ >
+ {loginState === 'qr_ready' && (
+ <>
+ <Loader2 size={14} className="animate-spin" />
+ {t('wechatConfig.waitingForScan')}
+ </>
+ )}
+ {(loginState === 'scanning' || loginState === 'confirming') && (
+ <>
+ <Smartphone size={14} />
+ {t('wechatConfig.confirmOnPhone')}
+ </>
+ )}
+ </div>
+ <p className="text-center text-[11px] text-muted">{t('wechatConfig.scanHint')}</p>
</div>
+ </div>
+ )}
- <div className="w-full rounded-xl border border-accent/20 bg-accent/5 px-4 py-3 text-left">
- <div className="text-sm font-semibold text-text">{t('wechatConfig.nextStepTitle')}</div>
- <p className="mt-1 text-sm text-muted">{t('wechatConfig.nextStepDesc')}</p>
+ {/* Connected */}
+ {loginState === 'connected' && (
+ <div className="rounded-xl border border-mint/35 bg-surface-2 px-6 py-6 shadow-[0_8px_32px_-8px_rgba(91,255,160,0.078)]">
+ <div className="flex flex-col items-center gap-4 text-center">
+ <div className="flex size-16 items-center justify-center rounded-full border border-mint/30 bg-mint/[0.08] text-mint shadow-[0_0_32px_-6px_rgba(91,255,160,0.5)]">
+ <Check size={32} />
+ </div>
+ <div>
+ <h3 className="text-[16px] font-semibold text-foreground">{t('wechatConfig.connectedTitle')}</h3>
+ <p className="mt-1 text-[12px] text-muted">{message}</p>
+ </div>
+ <div className="inline-flex items-center gap-2 rounded-lg border border-mint/30 bg-mint/[0.08] px-3 py-1.5 text-[12px] font-medium text-mint">
+ <Wifi size={14} />
+ {t('wechatConfig.connectionEstablished')}
+ </div>
+ <div className="w-full max-w-md rounded-lg border border-cyan/30 bg-cyan/[0.06] px-3 py-2.5 text-left">
+ <div className="text-[12px] font-semibold text-foreground">{t('wechatConfig.nextStepTitle')}</div>
+ <p className="mt-0.5 text-[11px] text-muted">{t('wechatConfig.nextStepDesc')}</p>
+ </div>
</div>
</div>
- </div>
- )}
+ )}
- {/* Error / Retry */}
- {loginState === 'error' && (
- <div className="bg-panel border border-border rounded-xl p-6 space-y-4">
- <div className="flex flex-col items-center space-y-4">
- <div className="w-16 h-16 bg-danger/10 text-danger rounded-full flex items-center justify-center">
- <AlertTriangle size={32} />
+ {/* Error */}
+ {loginState === 'error' && (
+ <div className="rounded-xl border border-danger/30 bg-danger/10 px-6 py-6">
+ <div className="flex flex-col items-center gap-4 text-center">
+ <div className="flex size-14 items-center justify-center rounded-full border border-danger/30 bg-danger/15 text-danger">
+ <AlertTriangle size={28} />
+ </div>
+ <div>
+ <h3 className="text-[14px] font-semibold text-foreground">{t('wechatConfig.errorTitle')}</h3>
+ <p className="mt-1 text-[12px] text-danger">{message}</p>
+ </div>
+ <button
+ onClick={startLogin}
+ disabled={starting}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-4 py-2 text-[13px] font-bold text-[#080812] shadow-[0_0_24px_-4px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <RefreshCw size={14} strokeWidth={2.25} />
+ {t('wechatConfig.retry')}
+ </button>
</div>
- <div className="text-center">
- <h3 className="text-lg font-semibold text-text">{t('wechatConfig.errorTitle')}</h3>
- <p className="text-sm text-danger mt-1">{message}</p>
- </div>
- <button
- onClick={startLogin}
- disabled={starting}
- className="px-6 py-3 bg-accent text-white rounded-lg flex items-center gap-2 font-medium shadow-sm hover:bg-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- >
- <RefreshCw size={16} />
- {t('wechatConfig.retry')}
- </button>
</div>
- </div>
- )}
- </div>
-
- <div className="mt-auto flex justify-between pt-6 border-t border-border">
- <button onClick={onBack} className="px-6 py-2 text-muted hover:text-text font-medium transition-colors">
- {t('common.back')}
- </button>
- <button
- onClick={() => {
- onNext({
- platform: 'wechat',
- wechat: {
- ...(data.wechat || {}),
- bot_token: botToken,
- base_url: baseUrl,
- },
- });
- }}
- disabled={!canProceed}
- className={clsx(
- 'px-8 py-3 rounded-lg font-medium transition-colors shadow-sm',
- canProceed ? 'bg-accent hover:bg-accent/90 text-white' : 'bg-neutral-200 text-muted cursor-not-allowed'
)}
- >
- {t('common.continue')}
- </button>
- </div>
+ </div>
+
+ <div className="flex items-center justify-between border-t border-border pt-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="inline-flex items-center gap-1.5 rounded-lg border border-border bg-white/[0.04] px-4 py-2 text-[13px] font-semibold text-foreground transition hover:border-border-strong"
+ >
+ <ArrowLeft size={14} strokeWidth={2.25} />
+ {t('common.back')}
+ </button>
+ <button
+ type="button"
+ onClick={() =>
+ onNext({
+ platform: 'wechat',
+ wechat: {
+ ...(data.wechat || {}),
+ bot_token: botToken,
+ base_url: baseUrl,
+ },
+ })
+ }
+ disabled={!canProceed}
+ className="inline-flex items-center gap-2 rounded-lg bg-mint px-5 py-2.5 text-[13px] font-bold text-[#080812] shadow-[0_0_32px_-6px_rgba(91,255,160,0.6)] transition hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none"
+ >
+ {t('common.continue')}
+ <ArrowRight size={14} strokeWidth={2.25} />
+ </button>
+ </div>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/steps/Welcome.tsx b/ui/src/components/steps/Welcome.tsx
index 6c4d8f542..807967ae9 100644
--- a/ui/src/components/steps/Welcome.tsx
+++ b/ui/src/components/steps/Welcome.tsx
@@ -1,46 +1,88 @@
import React from 'react';
-import { ArrowRight } from 'lucide-react';
+import { ArrowRight, HardDrive, PlugZap, Radio, Sparkles } from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import logo from '../../assets/logo.png';
+import { WizardCard } from '../visual';
interface WelcomeProps {
onNext: (data: any) => void;
}
+// Mirrors design.pen welCard (EYBEx): 920px card, 80×80 mint logo with strong glow,
+// 42px title, 16px subtitle (max 680), three accented feature tiles, large mint
+// "Get started" button. Card colors: #11111c with 1px white/8 stroke and a soft
+// mint shadow (#5BFFA014, blur 64, y32, spread -12).
export const Welcome: React.FC<WelcomeProps> = ({ onNext }) => {
const { t } = useTranslation();
-
- return (
- <div className="flex flex-col h-full justify-center items-center text-center max-w-lg mx-auto">
- <div className="mb-8">
- <img src={logo} alt="Vibe Remote Logo" className="w-20 h-20 mx-auto mb-6 drop-shadow-lg" />
- <h1 className="text-4xl font-display font-bold mb-4 text-text">{t('welcome.title')}</h1>
- <p className="text-xl text-muted font-light">
- {t('welcome.subtitle')}
- </p>
- </div>
- <div className="space-y-4 text-left w-full mb-10 bg-panel border border-border p-6 rounded-xl shadow-sm">
- <div className="flex items-start gap-3">
- <div className="w-1.5 h-1.5 rounded-full bg-accent mt-2"></div>
- <p className="text-text">{t('welcome.feature1')}</p>
+ const features = [
+ {
+ Icon: HardDrive,
+ iconClass: 'text-mint',
+ title: t('welcome.card1Title'),
+ body: t('welcome.feature1'),
+ },
+ {
+ Icon: PlugZap,
+ iconClass: 'text-cyan',
+ title: t('welcome.card2Title'),
+ body: t('welcome.feature2'),
+ },
+ {
+ Icon: Sparkles,
+ iconClass: 'text-violet',
+ title: t('welcome.card3Title'),
+ body: t('welcome.feature3'),
+ },
+ ];
+
+ return (
+ <div className="flex w-full justify-center">
+ <WizardCard
+ size="hero"
+ className="items-center text-center gap-8"
+ >
+ {/* welBigLogo (A3aTA) */}
+ <div
+ className="mx-auto flex size-20 items-center justify-center rounded-[20px] border-2 border-mint/40 bg-mint/[0.16] shadow-[0_0_48px_-8px_rgba(91,255,160,0.44)]"
+ aria-hidden
+ >
+ <Radio className="size-10 text-mint" strokeWidth={1.75} />
</div>
- <div className="flex items-start gap-3">
- <div className="w-1.5 h-1.5 rounded-full bg-accent mt-2"></div>
- <p className="text-text">{t('welcome.feature2')}</p>
+
+ {/* welHead (OpTFX) gap 14 */}
+ <div className="flex flex-col items-center gap-3.5">
+ <h1 className="text-[42px] font-bold leading-[1.05] tracking-[-0.8px] text-foreground">
+ {t('welcome.title')}
+ </h1>
+ <p className="max-w-[680px] text-[16px] leading-[1.55] text-muted">
+ {t('welcome.subtitle')}
+ </p>
</div>
- <div className="flex items-start gap-3">
- <div className="w-1.5 h-1.5 rounded-full bg-accent mt-2"></div>
- <p className="text-text">{t('welcome.feature3')}</p>
+
+ {/* welHilights (QdiUZ) — three feature tiles, gap 16 */}
+ <div className="grid w-full gap-4 text-left md:grid-cols-3">
+ {features.map(({ Icon, iconClass, title, body }) => (
+ <div
+ key={title}
+ className="flex flex-col gap-2 rounded-xl border border-white/[0.08] bg-background px-4 py-[18px]"
+ >
+ <Icon className={`size-5 ${iconClass}`} strokeWidth={1.75} />
+ <div className="text-[14px] font-semibold leading-tight text-foreground">{title}</div>
+ <p className="text-[12px] leading-[1.5] text-muted">{body}</p>
+ </div>
+ ))}
</div>
- </div>
- <button
- onClick={() => onNext({})}
- className="group flex items-center gap-2 px-8 py-3 bg-accent hover:bg-accent/90 text-white rounded-full font-bold text-lg transition-all shadow-md hover:shadow-lg hover:-translate-y-0.5"
- >
- {t('welcome.getStarted')} <ArrowRight size={20} className="group-hover:translate-x-1 transition-transform" />
- </button>
+ {/* welStart (a95QY) — large mint pill */}
+ <button
+ type="button"
+ onClick={() => onNext({})}
+ className="group inline-flex items-center gap-2 rounded-xl bg-mint px-8 py-[14px] text-[15px] font-bold leading-tight text-[#080812] shadow-[0_0_48px_-8px_rgba(91,255,160,0.44)] transition hover:brightness-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mint/60"
+ >
+ {t('welcome.getStarted')}
+ <ArrowRight className="size-4 transition-transform group-hover:translate-x-0.5" strokeWidth={2.25} />
+ </button>
+ </WizardCard>
</div>
);
};
diff --git a/ui/src/components/ui/badge.tsx b/ui/src/components/ui/badge.tsx
new file mode 100644
index 000000000..75d9c91c1
--- /dev/null
+++ b/ui/src/components/ui/badge.tsx
@@ -0,0 +1,33 @@
+import * as React from 'react';
+import { cva, type VariantProps } from 'class-variance-authority';
+
+import { cn } from '@/lib/utils';
+
+const badgeVariants = cva(
+ 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] font-semibold tracking-wide transition-colors focus:outline-none',
+ {
+ variants: {
+ variant: {
+ default: 'border border-border-strong bg-surface text-foreground',
+ secondary: 'border border-border bg-surface text-muted',
+ outline: 'border border-border-strong bg-transparent text-foreground',
+ success: 'border border-mint/40 bg-mint-soft text-mint',
+ warning: 'border border-gold/40 bg-gold/10 text-gold',
+ info: 'border border-cyan/40 bg-cyan-soft text-cyan',
+ destructive: 'border border-destructive/40 bg-destructive/10 text-destructive',
+ // Eyebrow — JetBrains Mono cyan w/ glow (design.pen Badge/Eyebrow mtcmf).
+ eyebrow:
+ 'rounded-full border border-cyan/50 bg-cyan/[0.16] px-3 py-1.5 font-mono text-[11px] font-bold uppercase tracking-[0.14em] text-cyan shadow-[0_0_24px_-4px_rgba(63,224,229,0.33)]',
+ },
+ },
+ defaultVariants: {
+ variant: 'default',
+ },
+ }
+);
+
+export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badgeVariants>;
+
+export const Badge = ({ className, variant, ...props }: BadgeProps) => (
+ <span className={cn(badgeVariants({ variant }), className)} {...props} />
+);
diff --git a/ui/src/components/ui/button.tsx b/ui/src/components/ui/button.tsx
new file mode 100644
index 000000000..3f4ec41dc
--- /dev/null
+++ b/ui/src/components/ui/button.tsx
@@ -0,0 +1,52 @@
+import * as React from 'react';
+import { Slot } from '@radix-ui/react-slot';
+import { cva, type VariantProps } from 'class-variance-authority';
+
+import { cn } from '@/lib/utils';
+
+const buttonVariants = cva(
+ 'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background [&_svg]:size-4 [&_svg]:shrink-0',
+ {
+ variants: {
+ variant: {
+ // Mint primary — flat, no glow shadow (design.pen Button/Default).
+ default: 'bg-primary text-primary-foreground hover:brightness-110',
+ secondary: 'border border-border bg-secondary text-secondary-foreground hover:border-border-strong',
+ // Outline — bg matches page surface so it sits cleanly on glow gradients.
+ outline:
+ 'border border-border bg-background text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.05)] hover:bg-surface-2',
+ // Cyan outline — for "Read Vibe Remote" / docs style CTAs.
+ 'outline-cyan':
+ 'border border-cyan/40 bg-cyan/[0.06] text-cyan hover:bg-cyan/[0.10]',
+ ghost: 'text-foreground hover:bg-surface-2',
+ destructive: 'bg-destructive text-destructive-foreground hover:opacity-90',
+ link: 'text-primary underline-offset-4 hover:underline',
+ accent: 'border border-cyan/40 bg-cyan-soft text-cyan hover:bg-cyan/15',
+ },
+ size: {
+ // Default = design's Large/Default: padding [8, 24].
+ default: 'h-10 px-6 py-2',
+ sm: 'h-8 rounded-md px-4 text-xs',
+ lg: 'h-11 rounded-md px-6 text-sm',
+ icon: 'h-9 w-9',
+ },
+ },
+ defaultVariants: {
+ variant: 'default',
+ size: 'default',
+ },
+ }
+);
+
+export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
+ VariantProps<typeof buttonVariants> & { asChild?: boolean };
+
+export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : 'button';
+ return <Comp ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />;
+ }
+);
+Button.displayName = 'Button';
+
+export { buttonVariants };
diff --git a/ui/src/components/ui/card.tsx b/ui/src/components/ui/card.tsx
new file mode 100644
index 000000000..8a6540282
--- /dev/null
+++ b/ui/src/components/ui/card.tsx
@@ -0,0 +1,48 @@
+import * as React from 'react';
+
+import { cn } from '@/lib/utils';
+
+// Card defaults match design.pen's stat / panel cards: rounded-12 / border-1 / surface-2.
+export const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
+ ({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn('rounded-xl border border-border bg-card text-card-foreground', className)}
+ {...props}
+ />
+ )
+);
+Card.displayName = 'Card';
+
+export const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
+ ({ className, ...props }, ref) => (
+ <div ref={ref} className={cn('flex flex-col gap-1 border-b border-border px-5 py-4', className)} {...props} />
+ )
+);
+CardHeader.displayName = 'CardHeader';
+
+export const CardTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(
+ ({ className, ...props }, ref) => (
+ <h3 ref={ref} className={cn('text-[15px] font-semibold tracking-tight', className)} {...props} />
+ )
+);
+CardTitle.displayName = 'CardTitle';
+
+export const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
+ ({ className, ...props }, ref) => (
+ <p ref={ref} className={cn('text-[13px] leading-[1.55] text-muted', className)} {...props} />
+ )
+);
+CardDescription.displayName = 'CardDescription';
+
+export const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
+ ({ className, ...props }, ref) => <div ref={ref} className={cn('px-5 py-4', className)} {...props} />
+);
+CardContent.displayName = 'CardContent';
+
+export const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
+ ({ className, ...props }, ref) => (
+ <div ref={ref} className={cn('flex items-center border-t border-border px-6 py-4', className)} {...props} />
+ )
+);
+CardFooter.displayName = 'CardFooter';
diff --git a/ui/src/components/ui/dialog.tsx b/ui/src/components/ui/dialog.tsx
new file mode 100644
index 000000000..910f82913
--- /dev/null
+++ b/ui/src/components/ui/dialog.tsx
@@ -0,0 +1,75 @@
+import * as React from 'react';
+import * as DialogPrimitive from '@radix-ui/react-dialog';
+import { X } from 'lucide-react';
+
+import { cn } from '@/lib/utils';
+
+export const Dialog = DialogPrimitive.Root;
+export const DialogTrigger = DialogPrimitive.Trigger;
+export const DialogPortal = DialogPrimitive.Portal;
+export const DialogClose = DialogPrimitive.Close;
+
+export const DialogOverlay = React.forwardRef<
+ React.ComponentRef<typeof DialogPrimitive.Overlay>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Overlay
+ ref={ref}
+ className={cn(
+ 'fixed inset-0 z-50 bg-background/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
+ className
+ )}
+ {...props}
+ />
+));
+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+
+export const DialogContent = React.forwardRef<
+ React.ComponentRef<typeof DialogPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
+>(({ className, children, ...props }, ref) => (
+ <DialogPortal>
+ <DialogOverlay />
+ <DialogPrimitive.Content
+ ref={ref}
+ className={cn(
+ 'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-card p-6 shadow-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-md p-1 text-muted opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring">
+ <X className="size-4" />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ </DialogPrimitive.Content>
+ </DialogPortal>
+));
+DialogContent.displayName = DialogPrimitive.Content.displayName;
+
+export const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn('flex flex-col gap-1.5 text-left', className)} {...props} />
+);
+DialogHeader.displayName = 'DialogHeader';
+
+export const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)} {...props} />
+);
+DialogFooter.displayName = 'DialogFooter';
+
+export const DialogTitle = React.forwardRef<
+ React.ComponentRef<typeof DialogPrimitive.Title>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold leading-tight', className)} {...props} />
+));
+DialogTitle.displayName = DialogPrimitive.Title.displayName;
+
+export const DialogDescription = React.forwardRef<
+ React.ComponentRef<typeof DialogPrimitive.Description>,
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
+>(({ className, ...props }, ref) => (
+ <DialogPrimitive.Description ref={ref} className={cn('text-sm text-muted', className)} {...props} />
+));
+DialogDescription.displayName = DialogPrimitive.Description.displayName;
diff --git a/ui/src/components/ui/input.tsx b/ui/src/components/ui/input.tsx
new file mode 100644
index 000000000..c5e5c9871
--- /dev/null
+++ b/ui/src/components/ui/input.tsx
@@ -0,0 +1,18 @@
+import * as React from 'react';
+
+import { cn } from '@/lib/utils';
+
+export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
+
+export const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, ...props }, ref) => (
+ <input
+ ref={ref}
+ type={type}
+ className={cn(
+ 'flex h-9 w-full rounded-lg border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring disabled:cursor-not-allowed disabled:opacity-50',
+ className
+ )}
+ {...props}
+ />
+));
+Input.displayName = 'Input';
diff --git a/ui/src/components/ui/label.tsx b/ui/src/components/ui/label.tsx
new file mode 100644
index 000000000..b51a518b2
--- /dev/null
+++ b/ui/src/components/ui/label.tsx
@@ -0,0 +1,16 @@
+import * as React from 'react';
+import * as LabelPrimitive from '@radix-ui/react-label';
+
+import { cn } from '@/lib/utils';
+
+export const Label = React.forwardRef<
+ React.ComponentRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
+>(({ className, ...props }, ref) => (
+ <LabelPrimitive.Root
+ ref={ref}
+ className={cn('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70', className)}
+ {...props}
+ />
+));
+Label.displayName = LabelPrimitive.Root.displayName;
diff --git a/ui/src/components/ui/separator.tsx b/ui/src/components/ui/separator.tsx
new file mode 100644
index 000000000..1de8843ff
--- /dev/null
+++ b/ui/src/components/ui/separator.tsx
@@ -0,0 +1,18 @@
+import * as React from 'react';
+import * as SeparatorPrimitive from '@radix-ui/react-separator';
+
+import { cn } from '@/lib/utils';
+
+export const Separator = React.forwardRef<
+ React.ComponentRef<typeof SeparatorPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
+>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
+ <SeparatorPrimitive.Root
+ ref={ref}
+ decorative={decorative}
+ orientation={orientation}
+ className={cn('shrink-0 bg-border', orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px', className)}
+ {...props}
+ />
+));
+Separator.displayName = SeparatorPrimitive.Root.displayName;
diff --git a/ui/src/components/visual/BackendIcon.tsx b/ui/src/components/visual/BackendIcon.tsx
new file mode 100644
index 000000000..0ad4fc805
--- /dev/null
+++ b/ui/src/components/visual/BackendIcon.tsx
@@ -0,0 +1,89 @@
+import * as React from 'react';
+import { Bot, Code2, Sparkles } from 'lucide-react';
+import { cn } from '@/lib/utils';
+
+export type BackendId = 'opencode' | 'claude' | 'codex' | string;
+
+interface BackendIconProps extends React.HTMLAttributes<HTMLSpanElement> {
+ backend: BackendId;
+ size?: number;
+ /**
+ * `block` (default) renders a square tile with mono initials, tinted per-backend.
+ * `glyph` renders just the lucide icon in the brand color (no tile, no border).
+ */
+ variant?: 'block' | 'glyph';
+}
+
+interface BackendMeta {
+ label: string;
+ blockCls: string;
+ glyphCls: string;
+ Icon: React.ComponentType<{ size?: number; className?: string }>;
+}
+
+const BACKEND_META: Record<string, BackendMeta> = {
+ opencode: {
+ label: 'OP',
+ blockCls: 'border-mint/40 bg-mint/[0.10] text-mint',
+ glyphCls: 'text-mint',
+ Icon: Code2,
+ },
+ claude: {
+ label: 'CL',
+ blockCls: 'border-[rgba(217,119,87,0.4)] bg-[rgba(217,119,87,0.10)] text-[#e8a87c]',
+ glyphCls: 'text-cyan',
+ Icon: Sparkles,
+ },
+ codex: {
+ label: 'CO',
+ blockCls: 'border-violet/40 bg-violet/[0.10] text-violet',
+ glyphCls: 'text-violet',
+ Icon: Bot,
+ },
+};
+
+const FALLBACK_META: BackendMeta = {
+ label: '',
+ blockCls: 'border-border bg-surface-2 text-foreground',
+ glyphCls: 'text-muted',
+ Icon: Bot,
+};
+
+export const BackendIcon: React.FC<BackendIconProps> = ({
+ backend,
+ size = 40,
+ variant = 'block',
+ className,
+ ...props
+}) => {
+ const meta =
+ BACKEND_META[backend] ||
+ ({ ...FALLBACK_META, label: backend.slice(0, 2).toUpperCase() } as BackendMeta);
+
+ if (variant === 'glyph') {
+ const Icon = meta.Icon;
+ return (
+ <span
+ className={cn('inline-flex shrink-0 items-center justify-center', meta.glyphCls, className)}
+ style={{ width: size, height: size }}
+ {...props}
+ >
+ <Icon size={size} />
+ </span>
+ );
+ }
+
+ return (
+ <span
+ className={cn(
+ 'inline-flex shrink-0 items-center justify-center rounded-xl border font-mono text-[13px] font-bold tracking-wider',
+ meta.blockCls,
+ className
+ )}
+ style={{ width: size, height: size }}
+ {...props}
+ >
+ {meta.label}
+ </span>
+ );
+};
diff --git a/ui/src/components/visual/BrandLogo.tsx b/ui/src/components/visual/BrandLogo.tsx
new file mode 100644
index 000000000..dd5161db2
--- /dev/null
+++ b/ui/src/components/visual/BrandLogo.tsx
@@ -0,0 +1,27 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+import logoImg from '@/assets/logo.png';
+
+interface BrandLogoProps extends React.HTMLAttributes<HTMLSpanElement> {
+ size?: number;
+ withGlow?: boolean;
+}
+
+export const BrandLogo: React.FC<BrandLogoProps> = ({
+ size = 36,
+ withGlow = true,
+ className,
+ ...props
+}) => (
+ <span
+ className={cn(
+ 'inline-flex shrink-0 items-center justify-center overflow-hidden rounded-xl border border-mint/30 bg-mint/[0.08]',
+ withGlow && 'shadow-[0_0_24px_-4px_rgba(91,255,160,0.45)]',
+ className
+ )}
+ style={{ width: size, height: size }}
+ {...props}
+ >
+ <img src={logoImg} alt="Vibe Remote" className="h-full w-full object-cover" />
+ </span>
+);
diff --git a/ui/src/components/visual/EyebrowBadge.tsx b/ui/src/components/visual/EyebrowBadge.tsx
new file mode 100644
index 000000000..6bdd87bd7
--- /dev/null
+++ b/ui/src/components/visual/EyebrowBadge.tsx
@@ -0,0 +1,34 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+type Tone = 'cyan' | 'mint' | 'violet' | 'gold';
+
+interface EyebrowBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
+ tone?: Tone;
+}
+
+// Mirrors design.pen Badge/Eyebrow (mtcmf): JetBrains Mono, 11px, weight 700,
+// letterSpacing 1.4, cyan glow shadow. Used for `01 — STEP` style labels.
+const TONE_CLASSES: Record<Tone, string> = {
+ cyan: 'border-cyan/50 bg-cyan/[0.16] text-cyan shadow-[0_0_24px_-4px_rgba(63,224,229,0.33)]',
+ mint: 'border-mint/50 bg-mint/[0.16] text-mint shadow-[0_0_24px_-4px_rgba(91,255,160,0.33)]',
+ violet: 'border-violet/50 bg-violet/[0.16] text-violet shadow-[0_0_24px_-4px_rgba(124,91,255,0.33)]',
+ gold: 'border-gold/50 bg-gold/[0.16] text-gold shadow-[0_0_24px_-4px_rgba(255,200,87,0.33)]',
+};
+
+export const EyebrowBadge = React.forwardRef<HTMLSpanElement, EyebrowBadgeProps>(
+ ({ tone = 'cyan', className, children, ...props }, ref) => (
+ <span
+ ref={ref}
+ className={cn(
+ 'inline-flex items-center gap-1.5 rounded-full border px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.14em]',
+ TONE_CLASSES[tone],
+ className
+ )}
+ {...props}
+ >
+ {children}
+ </span>
+ )
+);
+EyebrowBadge.displayName = 'EyebrowBadge';
diff --git a/ui/src/components/visual/PlatformIcon.tsx b/ui/src/components/visual/PlatformIcon.tsx
new file mode 100644
index 000000000..2b50e3006
--- /dev/null
+++ b/ui/src/components/visual/PlatformIcon.tsx
@@ -0,0 +1,144 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+export type PlatformId = 'slack' | 'discord' | 'telegram' | 'lark' | 'wechat' | string;
+
+interface PlatformIconProps extends React.HTMLAttributes<HTMLSpanElement> {
+ platform: PlatformId;
+ size?: number;
+ /** When true, renders a tinted square tile around the icon. */
+ tile?: boolean;
+}
+
+const SlackSvg: React.FC<{ size: number }> = ({ size }) => (
+ <svg width={size} height={size} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <path d="M9.4 18.2a2.6 2.6 0 1 1-2.6-2.6h2.6v2.6Z" fill="#E01E5A" />
+ <path d="M10.7 18.2a2.6 2.6 0 0 1 5.2 0v6.5a2.6 2.6 0 1 1-5.2 0v-6.5Z" fill="#E01E5A" />
+ <path d="M13.3 9.4a2.6 2.6 0 1 1 2.6-2.6v2.6h-2.6Z" fill="#36C5F0" />
+ <path d="M13.3 10.7a2.6 2.6 0 0 1 0 5.2H6.8a2.6 2.6 0 1 1 0-5.2h6.5Z" fill="#36C5F0" />
+ <path d="M22.6 13.3a2.6 2.6 0 1 1 2.6 2.6h-2.6v-2.6Z" fill="#2EB67D" />
+ <path d="M21.3 13.3a2.6 2.6 0 0 1-5.2 0V6.8a2.6 2.6 0 1 1 5.2 0v6.5Z" fill="#2EB67D" />
+ <path d="M18.7 22.6a2.6 2.6 0 1 1-2.6 2.6v-2.6h2.6Z" fill="#ECB22E" />
+ <path d="M18.7 21.3a2.6 2.6 0 0 1 0-5.2h6.5a2.6 2.6 0 1 1 0 5.2h-6.5Z" fill="#ECB22E" />
+ </svg>
+);
+
+const DiscordSvg: React.FC<{ size: number }> = ({ size }) => (
+ <svg width={size} height={size} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <path
+ fill="#5865F2"
+ d="M25.6 7.2a23 23 0 0 0-5.7-1.8l-.3.6a18 18 0 0 0-5.2 0l-.3-.6a23 23 0 0 0-5.7 1.8C5 12.5 4.2 17.6 4.5 22.7c2.2 1.6 4.4 2.6 6.5 3.2.5-.7 1-1.4 1.4-2.2-.7-.3-1.5-.6-2.1-1l.5-.4c4 1.9 8.4 1.9 12.4 0l.5.4-2.1 1c.4.8.9 1.5 1.4 2.2 2.1-.6 4.3-1.6 6.5-3.2.4-5.9-.7-11-3.5-15.5ZM12.4 19.6c-1.1 0-2-1-2-2.3s.9-2.3 2-2.3 2 1 2 2.3-.9 2.3-2 2.3Zm7.2 0c-1.1 0-2-1-2-2.3s.9-2.3 2-2.3 2 1 2 2.3-.9 2.3-2 2.3Z"
+ />
+ </svg>
+);
+
+const TelegramSvg: React.FC<{ size: number }> = ({ size }) => (
+ <svg width={size} height={size} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+ <linearGradient id="tgGrad" x1=".5" x2=".5" y2="1">
+ <stop offset="0%" stopColor="#37AEE2" />
+ <stop offset="100%" stopColor="#1E96C8" />
+ </linearGradient>
+ </defs>
+ <circle cx="16" cy="16" r="16" fill="url(#tgGrad)" />
+ <path
+ fill="#FFF"
+ d="m23.4 9.8-2.7 13c-.2 1-.7 1.2-1.5.8l-4-3-1.9 1.9c-.3.2-.5.4-.9.4l.3-4.3 7.7-7c.4-.3-.1-.5-.5-.2l-9.5 6-4.1-1.3c-.9-.3-.9-.9.2-1.4L22 8.6c.7-.3 1.4.2 1.4 1.2Z"
+ />
+ </svg>
+);
+
+const LarkSvg: React.FC<{ size: number }> = ({ size }) => (
+ <svg width={size} height={size} viewBox="-5 -8 42 42" xmlns="http://www.w3.org/2000/svg">
+ <path
+ fill="#4BC0AE"
+ d="M16.59,13.32l.08-.08c.05-.05.11-.11.16-.16l.11-.11.32-.32.45-.43.38-.38.36-.35.37-.37.34-.34.48-.47c.09-.09.18-.18.28-.26.17-.16.35-.31.53-.46.4-.32.83-.61,1.27-.88.25-.15.52-.29.78-.42.39-.19.8-.36,1.21-.49.07-.02.15-.05.23-.07-.66-2.59-1.87-5.02-3.54-7.11C20.06.23,19.57,0,19.05,0H5.37c-.14,0-.26.12-.26.26,0,.08.04.16.1.21,4.67,3.42,8.54,7.82,11.34,12.89l.03-.04h0Z"
+ />
+ <path
+ fill="#4C6EB5"
+ d="M11.15,25.37c7.07,0,13.23-3.9,16.43-9.66.11-.2.22-.41.33-.61-.21.42-.47.81-.75,1.18-.16.21-.34.41-.52.61-.25.27-.53.51-.82.73-.12.09-.24.18-.37.27-.16.11-.33.21-.5.31-.5.28-1.03.5-1.58.65-.28.08-.56.14-.84.18-.2.03-.41.05-.62.07-.22.02-.44.02-.66.02-.25,0-.5-.02-.74-.05-.18-.02-.37-.05-.55-.08-.16-.03-.32-.06-.48-.1-.09-.02-.17-.04-.25-.07-.23-.06-.47-.13-.7-.2-.12-.04-.23-.07-.35-.1-.17-.05-.35-.1-.52-.16-.14-.04-.28-.09-.42-.14-.13-.04-.27-.09-.4-.13l-.27-.09-.33-.12-.23-.09c-.16-.05-.31-.11-.47-.17-.09-.04-.18-.07-.27-.1l-.36-.14-.38-.15-.25-.1-.3-.13-.23-.1-.24-.11-.21-.09-.19-.09-.2-.09-.2-.09-.25-.12-.27-.13c-.09-.05-.19-.09-.28-.14l-.24-.12C7.45,13.84,3.65,11.01.45,7.58c-.1-.1-.26-.11-.37,0-.05.05-.08.11-.08.18v12.08s0,.98,0,.98c0,.57.28,1.1.75,1.42,3.07,2.05,6.69,3.14,10.39,3.14h0Z"
+ />
+ <path
+ fill="#214295"
+ d="M31.92,8.34c-2.49-1.22-5.35-1.44-7.99-.6-.07.02-.15.05-.23.07-.69.24-1.36.54-1.99.91-.26.15-.51.32-.76.49-.37.26-.72.54-1.05.84-.09.09-.18.17-.28.26l-.48.47-.34.34-.37.37-.36.35-.38.38-.44.44-.32.32-.11.11c-.05.05-.11.11-.16.16l-.08.08-.12.11-.14.13c-1.18,1.08-2.49,2.01-3.9,2.76l.25.12.2.09.2.09.19.09.21.09.24.11.23.1.3.13.25.1.38.15c.12.05.24.09.36.14.09.04.18.07.27.1.16.06.31.11.46.17l.23.09c.11.04.22.08.33.12l.27.09c.13.04.27.09.4.13.14.05.28.09.42.14.17.05.35.11.52.16.35.1.7.2,1.05.3.09.02.17.04.25.07.16.04.32.07.48.1.18.03.37.06.55.08.67.08,1.36.06,2.03-.04.28-.04.56-.1.84-.18.35-.1.7-.22,1.03-.37.28-.12.54-.27.8-.43.09-.05.16-.11.24-.16.13-.09.25-.17.37-.27.11-.08.21-.16.31-.25.38-.33.73-.7,1.03-1.1.28-.37.53-.76.75-1.17l.18-.36,1.63-3.25.02-.04c.53-1.16,1.27-2.21,2.18-3.1Z"
+ />
+ </svg>
+);
+
+const WeChatSvg: React.FC<{ size: number }> = ({ size }) => (
+ <svg width={size} height={size} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <path
+ fill="#07C160"
+ d="M12.2 6.5c-5 0-9 3.4-9 7.5 0 2.4 1.4 4.5 3.5 5.9.2.1.3.4.2.6l-.4 1.5c-.1.3.2.5.4.4l1.9-1.1c.2-.1.4-.1.6 0 .9.3 2 .5 2.9.5h.5c-.1-.5-.2-1.1-.2-1.7 0-3.8 3.7-6.9 8.1-6.9h.7c-.5-3.5-4.2-6.7-9.2-6.7Zm-3 4.4a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm5.9 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"
+ />
+ <path
+ fill="#07C160"
+ d="M28 19.7c0-3.4-3.4-6.1-7.5-6.1S13 16.3 13 19.7c0 3.5 3.4 6.1 7.5 6.1.8 0 1.7-.1 2.4-.4.2 0 .3 0 .5.1l1.7 1c.2.1.4-.1.4-.3l-.4-1.4c0-.2 0-.4.2-.5 1.7-1.2 2.7-3 2.7-4.6Zm-9.7-1.6a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8Zm5 0a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8Z"
+ />
+ </svg>
+);
+
+const FALLBACK_LABELS: Record<string, string> = {
+ slack: 'SL',
+ discord: 'DC',
+ telegram: 'TG',
+ lark: 'LK',
+ feishu: 'LK',
+ wechat: 'WX',
+};
+
+const renderInner = (platform: string, size: number) => {
+ switch (platform) {
+ case 'slack':
+ return <SlackSvg size={size} />;
+ case 'discord':
+ return <DiscordSvg size={size} />;
+ case 'telegram':
+ return <TelegramSvg size={size} />;
+ case 'lark':
+ case 'feishu':
+ return <LarkSvg size={size} />;
+ case 'wechat':
+ return <WeChatSvg size={size} />;
+ default:
+ return (
+ <span className="font-mono text-[10px] font-bold uppercase tracking-wider">
+ {FALLBACK_LABELS[platform] || platform.slice(0, 2).toUpperCase()}
+ </span>
+ );
+ }
+};
+
+export const PlatformIcon: React.FC<PlatformIconProps> = ({
+ platform,
+ size = 24,
+ tile = false,
+ className,
+ ...props
+}) => {
+ const inner = renderInner(platform, size);
+ if (!tile) {
+ return (
+ <span
+ className={cn('inline-flex shrink-0 items-center justify-center', className)}
+ style={{ width: size, height: size }}
+ {...props}
+ >
+ {inner}
+ </span>
+ );
+ }
+ const tileSize = size + 16;
+ return (
+ <span
+ className={cn(
+ 'inline-flex shrink-0 items-center justify-center rounded-xl border border-border bg-surface-2',
+ className
+ )}
+ style={{ width: tileSize, height: tileSize }}
+ {...props}
+ >
+ {inner}
+ </span>
+ );
+};
diff --git a/ui/src/components/visual/ProgressBar.tsx b/ui/src/components/visual/ProgressBar.tsx
new file mode 100644
index 000000000..09bcbfc78
--- /dev/null
+++ b/ui/src/components/visual/ProgressBar.tsx
@@ -0,0 +1,42 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {
+ segments: number;
+ current: number;
+ width?: number | string;
+}
+
+// Segmented mint-glow progress bar (design.pen wProgress / wbProg).
+// Active + completed segments fill mint; future segments are border-tinted.
+export const ProgressBar: React.FC<ProgressBarProps> = ({
+ segments,
+ current,
+ width = 600,
+ className,
+ ...props
+}) => {
+ const items = Array.from({ length: Math.max(segments, 1) });
+ return (
+ <div
+ className={cn('mx-auto flex items-center gap-1.5', className)}
+ style={{ maxWidth: typeof width === 'number' ? `${width}px` : width, width: '100%' }}
+ {...props}
+ >
+ {items.map((_, i) => {
+ const filled = i <= current;
+ return (
+ <div
+ key={i}
+ className={cn(
+ 'h-1 flex-1 rounded-full transition-all duration-300',
+ filled
+ ? 'bg-mint shadow-[0_0_12px_rgba(91,255,160,0.45)]'
+ : 'bg-white/[0.06]'
+ )}
+ />
+ );
+ })}
+ </div>
+ );
+};
diff --git a/ui/src/components/visual/StatCard.tsx b/ui/src/components/visual/StatCard.tsx
new file mode 100644
index 000000000..26a5bfc26
--- /dev/null
+++ b/ui/src/components/visual/StatCard.tsx
@@ -0,0 +1,35 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+interface StatCardProps extends React.HTMLAttributes<HTMLDivElement> {
+ label: string;
+ value: React.ReactNode;
+ trend?: React.ReactNode;
+ icon?: React.ReactNode;
+}
+
+// Mirrors design.pen Card/Stat (NbtYJ): rounded-12, fill --background,
+// border --border, padding 20, gap 6.
+export const StatCard: React.FC<StatCardProps> = ({
+ label,
+ value,
+ trend,
+ icon,
+ className,
+ ...props
+}) => (
+ <div
+ className={cn(
+ 'flex flex-col gap-1.5 rounded-xl border border-border bg-background px-5 py-5',
+ className
+ )}
+ {...props}
+ >
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[13px] font-medium text-muted">{label}</span>
+ {icon ? <span className="text-muted [&>svg]:size-4">{icon}</span> : null}
+ </div>
+ <div className="text-[28px] font-bold leading-tight tracking-tight text-foreground">{value}</div>
+ {trend ? <div className="text-[12px] font-medium text-muted">{trend}</div> : null}
+ </div>
+);
diff --git a/ui/src/components/visual/StatusPill.tsx b/ui/src/components/visual/StatusPill.tsx
new file mode 100644
index 000000000..2f85a6cb6
--- /dev/null
+++ b/ui/src/components/visual/StatusPill.tsx
@@ -0,0 +1,33 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+type Tone = 'running' | 'stopped' | 'warning' | 'idle';
+
+interface StatusPillProps extends React.HTMLAttributes<HTMLSpanElement> {
+ tone?: Tone;
+ label: string;
+}
+
+const TONE_CLASSES: Record<Tone, { wrapper: string; dot: string }> = {
+ running: { wrapper: 'border-mint/40 bg-mint/[0.12] text-foreground', dot: 'bg-mint shadow-[0_0_8px_rgba(91,255,160,0.6)]' },
+ stopped: { wrapper: 'border-border-strong bg-surface-2 text-muted', dot: 'bg-muted' },
+ warning: { wrapper: 'border-gold/40 bg-gold/[0.12] text-gold', dot: 'bg-gold' },
+ idle: { wrapper: 'border-border bg-surface text-muted', dot: 'bg-muted' },
+};
+
+export const StatusPill: React.FC<StatusPillProps> = ({ tone = 'idle', label, className, ...props }) => {
+ const tones = TONE_CLASSES[tone];
+ return (
+ <span
+ className={cn(
+ 'inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm font-medium',
+ tones.wrapper,
+ className
+ )}
+ {...props}
+ >
+ <span className={cn('h-2 w-2 rounded-full', tones.dot)} />
+ {label}
+ </span>
+ );
+};
diff --git a/ui/src/components/visual/StepCard.tsx b/ui/src/components/visual/StepCard.tsx
new file mode 100644
index 000000000..b3e61e400
--- /dev/null
+++ b/ui/src/components/visual/StepCard.tsx
@@ -0,0 +1,47 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+interface StepCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
+ eyebrow: React.ReactNode;
+ title: React.ReactNode;
+ description?: React.ReactNode;
+ icon?: React.ReactNode;
+}
+
+// Mirrors design.pen Card/Step (CdFKF):
+// rounded-12, fill --surface-2, padding 32, gap 16
+// shadow blur 48 / color #5BFFA014 / offset y24 / spread -12
+// stroke #5BFFA033 (mint @ 0.20) 1px
+// Step icon block: 48x48 mint-tinted square with mint icon (sparkles, etc).
+export const StepCard: React.FC<StepCardProps> = ({
+ eyebrow,
+ title,
+ description,
+ icon,
+ className,
+ children,
+ ...props
+}) => (
+ <div
+ className={cn(
+ 'flex flex-col gap-4 rounded-xl border border-mint/[0.20] bg-surface-2 p-8',
+ 'shadow-[0_24px_48px_-12px_rgba(91,255,160,0.078)]',
+ className
+ )}
+ {...props}
+ >
+ {icon ? (
+ <span className="inline-flex size-12 items-center justify-center rounded-[10px] border border-mint/[0.33] bg-mint/[0.12] text-mint [&>svg]:size-[22px]">
+ {icon}
+ </span>
+ ) : null}
+ <span className="font-mono text-[12px] font-semibold uppercase tracking-[0.16em] text-mint">
+ {eyebrow}
+ </span>
+ <h3 className="text-[22px] font-bold leading-tight tracking-[-0.4px] text-foreground">{title}</h3>
+ {description ? (
+ <p className="text-[14px] leading-[1.55] text-muted">{description}</p>
+ ) : null}
+ {children}
+ </div>
+);
diff --git a/ui/src/components/visual/WizardCard.tsx b/ui/src/components/visual/WizardCard.tsx
new file mode 100644
index 000000000..c66be4a6c
--- /dev/null
+++ b/ui/src/components/visual/WizardCard.tsx
@@ -0,0 +1,37 @@
+import * as React from 'react';
+import { cn } from '@/lib/utils';
+
+interface WizardCardProps extends React.HTMLAttributes<HTMLDivElement> {
+ /** Outer max-width. Design.pen uses 840 (Platforms) or 920 (rest). */
+ width?: number;
+ /** Use the larger Welcome / Summary padding (64) instead of default (40, 48). */
+ size?: 'default' | 'hero';
+ /** Extra mint accent border for the Summary "all done" card. */
+ accent?: boolean;
+}
+
+// Mirrors design.pen wCard / welCard / sumCard:
+// cornerRadius 20, fill --surface-2, stroke --border 1px, padding [40, 48]
+// shadow blur 64 / color #5BFFA014 / offset y32 / spread -12
+export const WizardCard: React.FC<WizardCardProps> = ({
+ width = 920,
+ size = 'default',
+ accent = false,
+ className,
+ children,
+ ...props
+}) => (
+ <div
+ className={cn(
+ 'mx-auto flex w-full flex-col rounded-2xl border bg-surface-2',
+ 'shadow-[0_32px_64px_-12px_rgba(91,255,160,0.078)]',
+ accent ? 'border-mint/35' : 'border-border',
+ size === 'hero' ? 'p-12 md:p-16' : 'px-6 py-8 md:px-12 md:py-10',
+ className
+ )}
+ style={{ maxWidth: width }}
+ {...props}
+ >
+ {children}
+ </div>
+);
diff --git a/ui/src/components/visual/WizardChrome.tsx b/ui/src/components/visual/WizardChrome.tsx
new file mode 100644
index 000000000..2acb0bd25
--- /dev/null
+++ b/ui/src/components/visual/WizardChrome.tsx
@@ -0,0 +1,70 @@
+import * as React from 'react';
+import { useTranslation } from 'react-i18next';
+import { cn } from '@/lib/utils';
+import { BrandLogo } from './BrandLogo';
+import { ProgressBar } from './ProgressBar';
+import { LanguageSwitcher } from '@/components/LanguageSwitcher';
+
+interface WizardChromeProps {
+ current: number;
+ total: number;
+ /** Show the segmented progress rail. Hidden on the welcome step. */
+ showProgress?: boolean;
+ /** Allow skipping to summary; hidden on the first / last steps. */
+ onSkip?: () => void;
+ /** Step counter label. Defaults to "Step X of Y". */
+ counterLabel?: React.ReactNode;
+ className?: string;
+}
+
+// Top bar + progress rail used by the Wizard. Mirrors the wTop / wbProg cluster
+// across welcome, backends, platforms, slack creds and summary frames in design.pen.
+export const WizardChrome: React.FC<WizardChromeProps> = ({
+ current,
+ total,
+ showProgress = true,
+ onSkip,
+ counterLabel,
+ className,
+}) => {
+ const { t } = useTranslation();
+ const safeTotal = Math.max(1, total);
+ return (
+ <div className={cn('mx-auto w-full max-w-[1280px]', className)}>
+ <div className="flex items-start justify-between gap-4">
+ <div className="flex items-center gap-3">
+ <BrandLogo size={40} />
+ <div className="flex flex-col">
+ <span className="text-[14px] font-semibold leading-tight text-foreground">
+ {t('wizard.title')}
+ </span>
+ {showProgress && (
+ <span className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted">
+ {counterLabel ?? `${t('common.step')} ${Math.min(current + 1, safeTotal)} / ${safeTotal}`}
+ </span>
+ )}
+ </div>
+ </div>
+ <div className="flex items-center gap-2">
+ <LanguageSwitcher />
+ {onSkip && (
+ <button
+ type="button"
+ onClick={onSkip}
+ className="rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-muted transition-colors hover:border-border-strong hover:text-foreground"
+ >
+ {t('common.skip')}
+ </button>
+ )}
+ </div>
+ </div>
+ {showProgress && (
+ <ProgressBar
+ segments={safeTotal}
+ current={current}
+ className="mt-6"
+ />
+ )}
+ </div>
+ );
+};
diff --git a/ui/src/components/visual/index.ts b/ui/src/components/visual/index.ts
new file mode 100644
index 000000000..01cb9f246
--- /dev/null
+++ b/ui/src/components/visual/index.ts
@@ -0,0 +1,12 @@
+export { BrandLogo } from './BrandLogo';
+export { EyebrowBadge } from './EyebrowBadge';
+export { StatusPill } from './StatusPill';
+export { PlatformIcon } from './PlatformIcon';
+export type { PlatformId } from './PlatformIcon';
+export { BackendIcon } from './BackendIcon';
+export type { BackendId } from './BackendIcon';
+export { ProgressBar } from './ProgressBar';
+export { WizardCard } from './WizardCard';
+export { WizardChrome } from './WizardChrome';
+export { StatCard } from './StatCard';
+export { StepCard } from './StepCard';
diff --git a/ui/src/context/ThemeContext.tsx b/ui/src/context/ThemeContext.tsx
new file mode 100644
index 000000000..7c1f05eb8
--- /dev/null
+++ b/ui/src/context/ThemeContext.tsx
@@ -0,0 +1,110 @@
+import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
+
+export type ThemeMode = 'system' | 'light' | 'dark';
+type ResolvedTheme = 'light' | 'dark';
+
+type ThemeContextValue = {
+ mode: ThemeMode;
+ resolvedTheme: ResolvedTheme;
+ setMode: (mode: ThemeMode) => void;
+ cycleMode: () => void;
+};
+
+const STORAGE_KEY = 'vibe-remote-theme';
+const VALID_MODES: ThemeMode[] = ['system', 'light', 'dark'];
+
+const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
+
+function resolveTheme(mode: ThemeMode): ResolvedTheme {
+ if (mode !== 'system') {
+ return mode;
+ }
+
+ if (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: light)').matches) {
+ return 'light';
+ }
+
+ return 'dark';
+}
+
+function applyTheme(mode: ThemeMode) {
+ if (typeof document === 'undefined') {
+ return;
+ }
+
+ document.documentElement.setAttribute('data-theme', resolveTheme(mode));
+}
+
+function readStoredTheme(): ThemeMode {
+ try {
+ const queryMode = new URLSearchParams(window.location.search).get('theme');
+ if (queryMode && VALID_MODES.includes(queryMode as ThemeMode)) {
+ return queryMode as ThemeMode;
+ }
+
+ const value = window.localStorage.getItem(STORAGE_KEY);
+ if (value && VALID_MODES.includes(value as ThemeMode)) {
+ return value as ThemeMode;
+ }
+ } catch {
+ // Ignore storage issues and fall back to the design's default dark canvas.
+ }
+
+ return 'dark';
+}
+
+export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
+ const [mode, setModeState] = useState<ThemeMode>('dark');
+ const resolvedTheme = useMemo(() => resolveTheme(mode), [mode]);
+
+ useEffect(() => {
+ const nextMode = readStoredTheme();
+ setModeState(nextMode);
+ applyTheme(nextMode);
+
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: light)');
+ const handleChange = () => {
+ if (readStoredTheme() === 'system') {
+ applyTheme('system');
+ }
+ };
+
+ mediaQuery.addEventListener('change', handleChange);
+ return () => mediaQuery.removeEventListener('change', handleChange);
+ }, []);
+
+ const setMode = (nextMode: ThemeMode) => {
+ setModeState(nextMode);
+
+ try {
+ if (nextMode === 'system') {
+ window.localStorage.removeItem(STORAGE_KEY);
+ } else {
+ window.localStorage.setItem(STORAGE_KEY, nextMode);
+ }
+ } catch {
+ // Ignore storage issues.
+ }
+
+ applyTheme(nextMode);
+ };
+
+ const cycleMode = () => {
+ const nextMode: ThemeMode = mode === 'system' ? 'light' : mode === 'light' ? 'dark' : 'system';
+ setMode(nextMode);
+ };
+
+ return (
+ <ThemeContext.Provider value={{ mode, resolvedTheme, setMode, cycleMode }}>
+ {children}
+ </ThemeContext.Provider>
+ );
+};
+
+export function useTheme() {
+ const context = useContext(ThemeContext);
+ if (!context) {
+ throw new Error('useTheme must be used within ThemeProvider');
+ }
+ return context;
+}
diff --git a/ui/src/context/ToastContext.tsx b/ui/src/context/ToastContext.tsx
index 85f85d84c..5e3a9da6a 100644
--- a/ui/src/context/ToastContext.tsx
+++ b/ui/src/context/ToastContext.tsx
@@ -37,8 +37,8 @@ export const ToastProvider: React.FC<{ children: React.ReactNode }> = ({ childre
return (
<ToastContext.Provider value={{ showToast }}>
{children}
- {/* Toast container - fixed at bottom right */}
- <div className="fixed bottom-4 right-4 z-50 flex flex-col gap-2">
+ {/* Toast container - fixed at bottom right; lifted above mobile bottom nav */}
+ <div className="fixed bottom-[calc(5.5rem+env(safe-area-inset-bottom))] right-4 z-50 flex flex-col gap-2 md:bottom-4">
{toasts.map((toast) => (
<div
key={toast.id}
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 49c6429a4..ac3c5bee2 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -3,6 +3,8 @@
"back": "Back",
"continue": "Continue",
"save": "Save",
+ "skip": "Skip",
+ "edit": "Edit",
"cancel": "Cancel",
"loading": "Loading...",
"saving": "Saving...",
@@ -10,8 +12,10 @@
"saveFailed": "Save failed",
"enabled": "Enabled",
"enable": "Enable",
+ "disable": "Disable",
"disabled": "Disabled",
"default": "Default",
+ "inherit": "Inherit",
"running": "Running",
"stopped": "Stopped",
"unknown": "Unknown",
@@ -36,15 +40,70 @@
"manageChannels": "Manage groups",
"viewLogs": "View logs",
"saveAndRestart": "Save & Restart",
- "copyFailed": "Copy failed, please copy it manually"
+ "copyFailed": "Copy failed, please copy it manually",
+ "themeSystem": "System theme",
+ "themeLight": "Light theme",
+ "themeDark": "Dark theme",
+ "themeToggleHint": "Click to change theme",
+ "step": "Step"
},
"nav": {
"dashboard": "Dashboard",
"channels": "Groups",
"users": "Users",
+ "settings": "Settings",
"remoteAccess": "Remote Access",
"doctor": "Doctor"
},
+ "settings": {
+ "tabs": {
+ "service": "Service",
+ "platforms": "Platforms",
+ "backends": "Backends",
+ "messaging": "Messaging",
+ "diagnostics": "Diagnostics",
+ "serviceRoot": "Settings"
+ },
+ "serviceTitle": "Service",
+ "serviceSubtitle": "Manage runtime status, console server details, and remote access from one place.",
+ "logFileLabel": "Log file",
+ "serviceRuntimeTitle": "Runtime control",
+ "serviceRuntimeSubtitle": "Start, stop, and restart the local Vibe Remote service while checking the live process state.",
+ "statusNow": "Current state",
+ "consoleServerTitle": "Console server",
+ "consoleServerHint": "Saving these values restarts only the Web UI server.",
+ "serviceNotesTitle": "Operational notes",
+ "serviceNotesSubtitle": "Keep the local service healthy before moving on to platform and routing work.",
+ "serviceNote1": "Remote access is now part of Service because it changes how this machine exposes the local admin UI.",
+ "serviceNote2": "Host and port changes restart only the UI server, while service control buttons affect the main Python runtime.",
+ "serviceNote3": "Use Diagnostics for doctor checks and Live logs when you need detailed troubleshooting evidence.",
+ "platformsTitle": "Platforms",
+ "platformsSubtitle": "Configure which messaging platforms are connected and how each one is enabled.",
+ "backendsTitle": "Backends",
+ "backendsSubtitle": "Manage agent backends, default routing, and local CLI availability.",
+ "messagingTitle": "Messaging",
+ "messagingSubtitle": "Tune global reply behavior, acknowledgements, and message visibility defaults.",
+ "messagingCardDescription": "Fine-tune how Vibe Remote acknowledges work, retries failures, and formats user-facing replies.",
+ "messagingAutosaved": "Autosaved",
+ "messagingStatusIdle": "No recent changes",
+ "messagingStatusJustNow": "Saved just now",
+ "messagingStatusAgo": "Saved {{seconds}}s ago",
+ "messagingGroupsHint": "Manage which groups are allowed and how each one routes to an agent backend.",
+ "messagingSupportTitle": "Platform support",
+ "messagingSupportLine1": "Typing indicators and reaction-based acknowledgements depend on the capabilities of the platforms you enabled.",
+ "messagingSupportLine2": "Slack-specific link preview suppression is shown only when Slack is part of the active platform set.",
+ "messagingSupportLine3": "For per-group overrides, open the Groups page and change routing there instead of relying on the global defaults alone.",
+ "messagingBehaviorTitle": "Current behavior snapshot",
+ "diagnosticsTitle": "Diagnostics",
+ "diagnosticsSubtitle": "Run health checks, inspect warnings, and jump into live logs when something is off.",
+ "diagnosticsDoctorTitle": "Health checks",
+ "logsTitle": "Live logs",
+ "logsSubtitle": "Inspect the runtime log stream with filters, search, and source selection.",
+ "inProgressTitle": "This settings page is next in the redesign queue",
+ "inProgressBody": "The new route and shell are live, but the feature-specific UI for this section is still being migrated from the old dashboard and wizard flows.",
+ "inProgressHint": "Until this section is rebuilt, the setup wizard still exposes the underlying configuration paths.",
+ "openSetup": "Open setup wizard"
+ },
"remoteAccess": {
"badge": "Vibe Cloud provider",
"title": "Remote Access",
@@ -95,18 +154,26 @@
"cloudflared_process_unknown": "Vibe Remote found a connector-like process but could not verify ownership. To avoid killing the wrong process, it did not change it. Check the cloudflared process manually and retry."
},
"appShell": {
- "title": "Vibe Remote"
+ "title": "Vibe Remote",
+ "subtitle": "Local agent gateway",
+ "workspaceLabel": "Workspace",
+ "navigationLabel": "Console",
+ "statusLabel": "Service status",
+ "versionLabel": "Version"
},
"wizard": {
"title": "Vibe Remote Setup"
},
"welcome": {
- "title": "Set up Vibe Remote",
- "subtitle": "Your local AI coding assistant for Slack, Discord, Telegram, WeChat, and Lark.",
+ "title": "Welcome to Vibe Remote",
+ "subtitle": "Connect your favorite IM platforms and set up local AI agents that stay on your machine.",
"getStarted": "Get started",
- "feature1": "Runs locally. Your code stays on your computer.",
- "feature2": "SaaS mode uses a cloud relay for Slack delivery, but does not store message content.",
- "feature3": "Self-host mode runs entirely locally via Slack Socket Mode."
+ "card1Title": "Local-first",
+ "card2Title": "Multi-platform",
+ "card3Title": "Multi-agent",
+ "feature1": "Your code + agents stay on your machine.",
+ "feature2": "Slack, Discord, Telegram, Lark, WeChat — one bot.",
+ "feature3": "Claude, OpenCode, Codex — route per channel."
},
"modeSelection": {
"title": "Choose Mode",
@@ -121,9 +188,30 @@
"primary": "Primary",
"primaryTitle": "Primary Platform",
"primaryDesc": "Used for compatibility ordering and default UI focus.",
+ "credentialsTitle": "Platform credentials",
+ "credentialsSubtitle": "Connect each IM platform with the credentials your bot uses to authenticate.",
+ "enabledPlatforms": "Enabled platforms",
+ "selectedSummary": "{{count}} selected",
+ "apply": "Apply",
+ "applyHint": "Apply updates to the credential tabs below, disabled platforms keep saved tokens.",
+ "credentialSetupTitle": "{{platform}} workspace setup",
+ "credentialSetupSubtitle": "Configure the selected platform directly here, then validate credentials before enabling groups.",
+ "stepCreateApp": "Create platform app",
+ "stepAddBotToken": "Add bot token",
+ "stepConfigureOptions": "Configure platform options",
+ "stepValidate": "Validate & finish",
+ "expanded": "Expanded",
+ "collapsed": "Collapsed",
+ "expandedStepHint": "Use this shared setup module for {{platform}} credentials.",
+ "credentialGuide": "Open the platform console, copy the required credentials, paste them below, then validate the connection.",
+ "openConsole": "Open {{platform}} console",
+ "validateToken": "Validate token",
+ "validationSuccess": "Credential validation succeeded",
+ "validationFailed": "Credential validation failed",
+ "wechatCredentialHint": "WeChat uses QR binding. Rebinding and login status remain in the WeChat setup flow.",
"slack": {
"title": "Slack",
- "desc": "Connect a Slack workspace and enable channels."
+ "desc": "Connect a Slack workspace and enable groups."
},
"discord": {
"title": "Discord",
@@ -153,7 +241,7 @@
"authFailed": "Validation failed",
"guild": "Guilds where the bot can work",
"guildPlaceholder": "No guilds loaded",
- "guildHint": "This controls which Discord guilds the bot can work in. Configure channel enablement and routing in the next step.",
+ "guildHint": "This controls which Discord guilds the bot can work in. Configure group enablement and routing in the next step.",
"selectedGuilds": "{{count}} selected",
"selectAllGuilds": "Select all",
"clearGuilds": "Clear",
@@ -421,7 +509,7 @@
"wechatInviteBotHint": "Send a message to your WeChat bot account to start a conversation.",
"guild": "Guild",
"guildPlaceholder": "Select a guild",
- "guildBrowse": "Viewing channels from",
+ "guildBrowse": "Viewing groups from",
"guildAccess": "Guilds where the bot can work",
"guildAccessCount": "{{count}} selected",
"discordText": "Text",
@@ -439,8 +527,8 @@
"enabledCount": "{{count}} enabled",
"accessPolicy": "Access Policy",
"accessPolicyHint": "Groups are enabled only when checked below.",
- "accessPolicyDiscord": "Guilds and channels are two separate switches",
- "accessPolicyHintDiscord": "First choose the Discord guilds where the bot can work, then enable specific channels and routing below.",
+ "accessPolicyDiscord": "Guilds and groups are two separate switches",
+ "accessPolicyHintDiscord": "First choose the Discord guilds where the bot can work, then enable specific groups and routing below.",
"noChannelsFound": "No groups found. Check token or invite bot.",
"noChannelsLoaded": "No groups loaded.",
"addTokenFirst": "Add a bot token first to load groups.",
@@ -469,7 +557,16 @@
"requireMentionOn": "Require @mention",
"requireMentionOff": "Don't require @mention",
"mentionStatusOn": "Require @",
- "mentionStatusOff": "Don't require @"
+ "mentionStatusOff": "Don't require @",
+ "allChannelsTab": "All channels",
+ "filterPlaceholder": "Filter groups…",
+ "rescan": "Rescan",
+ "showInactive": "Show inactive",
+ "headerSummary": "All groups · {{active}} active · {{discovered}} discovered",
+ "headerSummaryPlatform": "{{platform}} · {{active}} active · {{discovered}} discovered",
+ "noChannelsForSearch": "No groups match your search.",
+ "discordNeedsGuild": "Pick a Discord guild from the Discord tab to see channels here.",
+ "platformDisabled": "Platform disabled — enable it in Settings to see groups."
},
"summary": {
"title": "Review & Finish",
@@ -507,7 +604,40 @@
},
"dashboard": {
"title": "Dashboard",
- "subtitle": "Manage your local Vibe Remote instance.",
+ "subtitle": "Live status of your local Vibe Remote node.",
+ "searchPlaceholder": "Quick search…",
+ "heroTitle": "Vibe Remote runtime overview",
+ "runningTitle": "Vibe Remote is running",
+ "stoppedTitle": "Vibe Remote is stopped",
+ "startedAt": "Started {{time}} ({{relative}})",
+ "levelHealthy": "Healthy",
+ "levelAttention": "Attention",
+ "metricPlatforms": "Active platforms",
+ "metricPlatformsHint": "connected across the catalog",
+ "metricGroups": "Active groups",
+ "metricGroupsHint": "{{count}} discovered total",
+ "metricUsers": "Bound users",
+ "metricUsersHint": "authorized to access this node",
+ "metricHealth": "Health warnings",
+ "metricHealthHealthy": "all checks green",
+ "metricHealthIssues": "warnings or failures need review",
+ "platformOverviewTitle": "Connected platforms",
+ "platformOverviewSubtitle": "See which messaging platforms are live and jump to group routing where needed.",
+ "platformGroupsHint": "{{active}} active / {{discovered}} discovered groups",
+ "platformNoGroupsHint": "Direct messages only on this platform",
+ "manageAll": "Manage all",
+ "manageRoute": "Manage",
+ "configure": "Configure",
+ "connected": "Connected",
+ "notConfigured": "Not configured",
+ "recentActivityTitle": "Recent activity",
+ "recentActivitySubtitle": "Latest runtime events from the main service log.",
+ "recentActivityEmpty": "No recent service log events yet.",
+ "openMessaging": "Open messaging settings",
+ "groupsAndUsersTitle": "Groups and users",
+ "groupsAndUsersHint": "Review group routing and user access separately now that they have dedicated pages.",
+ "settingsShortcutTitle": "Settings shortcuts",
+ "settingsShortcutHint": "Jump straight into backend defaults or service-level configuration.",
"serviceStatus": "Service Status",
"mode": "Mode",
"platform": "Platform",
@@ -619,24 +749,41 @@
},
"userList": {
"title": "Users",
- "subtitle": "Manage bound users and their settings",
+ "subtitle": "Bound users from each IM platform · per-user routing & admin rights.",
"noUsers": "No bound users yet. Create a bind code and share it with users.",
+ "filterPlaceholder": "Filter users…",
+ "allUsers": "All users",
+ "showDisabled": "Show disabled",
"settingsSaved": "User settings saved",
"settingsSaveFailed": "Failed to save user settings",
"admin": "Admin",
"user": "User",
+ "bot": "Bot",
"boundAt": "Bound",
+ "boundAgo": "bound {{ago}}",
"removeUser": "Remove",
"removeConfirm": "Remove this user? This cannot be undone.",
"lastAdminDemoteWarning": "You are removing the last admin role. Continuing will put the bot into an 'unrestricted admin' state, where any bound user can access admin menus. Continue?",
"lastAdminRemoveWarning": "You are removing the last admin user. Continuing will put the bot into an 'unrestricted admin' state, where any bound user can access admin menus. Continue?",
"cannotRemoveLastAdmin": "Cannot remove the last admin",
"adminToggled": "Admin status updated",
- "userRemoved": "User removed"
+ "userRemoved": "User removed",
+ "noUsersForSearch": "No users match your search.",
+ "inheritsGlobal": "— inherits global —"
},
"bindCode": {
"title": "Bind Codes",
- "newCode": "New Code",
+ "badge": "BIND CODE",
+ "inviteTitle": "Invite a new user from any platform",
+ "inviteDescription": "Generate a one-time code. They DM your bot the code from Slack/Discord/Telegram/etc., and they're bound to this Vibe Remote instance with the routing rules below.",
+ "noActiveCode": "No active code",
+ "noActiveHint": "Generate one to invite a user.",
+ "activeCodeLabel": "ACTIVE CODE",
+ "expiresIn": "expires in {{time}}",
+ "noExpiry": "no expiry",
+ "newCode": "New code",
+ "createCode": "Create code",
+ "revoke": "Revoke",
"oneTime": "One-time",
"expiring": "Expiring",
"active": "Active",
@@ -657,7 +804,9 @@
"usageTitle": "How to use a bind code",
"usageHint": "Share an active code with the user, then ask them to DM the bot with `bind <code>`. `/bind <code>` still works too.",
"viewUnavailable": "Unavailable ({{count}})",
+ "viewMore": "+ {{count}} more",
"unavailableTitle": "Unavailable Bind Codes",
+ "allCodesTitle": "All Bind Codes",
"noAvailableCodes": "No active bind codes. Create a new code to start binding users.",
"noUnavailableCodes": "No unavailable bind codes.",
"close": "Close"
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 5685962c1..66513a201 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -3,6 +3,8 @@
"back": "返回",
"continue": "继续",
"save": "保存",
+ "skip": "跳过",
+ "edit": "编辑",
"cancel": "取消",
"loading": "加载中...",
"saving": "保存中...",
@@ -10,8 +12,10 @@
"saveFailed": "保存失败",
"enabled": "已启用",
"enable": "启用",
+ "disable": "禁用",
"disabled": "已禁用",
"default": "默认",
+ "inherit": "继承",
"running": "运行中",
"stopped": "已停止",
"unknown": "未知",
@@ -36,15 +40,70 @@
"manageChannels": "管理群组",
"viewLogs": "查看日志",
"saveAndRestart": "保存并重启",
- "copyFailed": "复制失败,请手动复制"
+ "copyFailed": "复制失败,请手动复制",
+ "themeSystem": "跟随系统主题",
+ "themeLight": "浅色主题",
+ "themeDark": "深色主题",
+ "themeToggleHint": "点击切换主题",
+ "step": "步骤"
},
"nav": {
"dashboard": "仪表盘",
"channels": "群组",
"users": "用户",
+ "settings": "设置",
"remoteAccess": "远程访问",
"doctor": "诊断"
},
+ "settings": {
+ "tabs": {
+ "service": "服务",
+ "platforms": "平台",
+ "backends": "后端",
+ "messaging": "消息",
+ "diagnostics": "诊断",
+ "serviceRoot": "设置"
+ },
+ "serviceTitle": "服务",
+ "serviceSubtitle": "把运行状态、控制台服务配置和远程访问统一收拢到一个页面。",
+ "logFileLabel": "日志文件",
+ "serviceRuntimeTitle": "运行控制",
+ "serviceRuntimeSubtitle": "查看本地 Vibe Remote 进程状态,并执行启动、停止和重启。",
+ "statusNow": "当前状态",
+ "consoleServerTitle": "控制台服务",
+ "consoleServerHint": "保存这些值只会重启 Web UI 服务,不会重启主服务。",
+ "serviceNotesTitle": "运维说明",
+ "serviceNotesSubtitle": "先把本地服务运行状态稳定下来,再继续配置平台和路由。",
+ "serviceNote1": "远程访问已经并入 Service,因为它本质上决定的是这台机器如何暴露本地管理 UI。",
+ "serviceNote2": "Host 和 Port 只影响 UI 服务;运行控制按钮则直接影响本地 Python 主进程。",
+ "serviceNote3": "如果需要排障,请到 Diagnostics 运行 doctor,再到 Live logs 查看更细的实时日志。",
+ "platformsTitle": "平台",
+ "platformsSubtitle": "配置启用哪些消息平台,以及每个平台的接入状态。",
+ "backendsTitle": "后端",
+ "backendsSubtitle": "管理 agent 后端、默认路由和本地 CLI 可用性。",
+ "messagingTitle": "消息",
+ "messagingSubtitle": "统一配置全局回复行为、ACK 策略以及消息显示默认值。",
+ "messagingCardDescription": "细调 Vibe Remote 如何确认收到消息、如何在失败时重试,以及最终向用户展示哪些回复内容。",
+ "messagingAutosaved": "已自动保存",
+ "messagingStatusIdle": "最近没有变更",
+ "messagingStatusJustNow": "刚刚保存",
+ "messagingStatusAgo": "{{seconds}} 秒前已保存",
+ "messagingGroupsHint": "前往群组页,管理允许工作的群组以及每个群组分别路由到哪个 agent backend。",
+ "messagingSupportTitle": "平台能力说明",
+ "messagingSupportLine1": "Typing 指示器和 Reaction ACK 取决于你当前启用的平台是否支持这些能力。",
+ "messagingSupportLine2": "只有在 Slack 处于启用平台集合中时,才会显示 Slack 链接预览抑制开关。",
+ "messagingSupportLine3": "如果要覆盖全局默认值,请到群组页做按群组的单独配置,而不是只依赖这里的全局设置。",
+ "messagingBehaviorTitle": "当前行为快照",
+ "diagnosticsTitle": "诊断",
+ "diagnosticsSubtitle": "运行健康检查、查看告警,并在需要时跳转到实时日志。",
+ "diagnosticsDoctorTitle": "健康检查",
+ "logsTitle": "实时日志",
+ "logsSubtitle": "按来源、级别和搜索条件查看运行日志流。",
+ "inProgressTitle": "这个设置页已经有新路由,但功能 UI 还在迁移中",
+ "inProgressBody": "新版路由和页面壳子已经就位,但这个分区的具体界面还在从旧 Dashboard 和向导流程迁移。",
+ "inProgressHint": "在该分区完成重构前,底层配置仍可先通过设置向导进行调整。",
+ "openSetup": "打开设置向导"
+ },
"remoteAccess": {
"badge": "Vibe Cloud Provider",
"title": "远程访问",
@@ -95,18 +154,26 @@
"cloudflared_process_unknown": "检测到一个无法确认归属的连接器进程。为避免误杀其它进程,Vibe Remote 没有自动处理。请手动检查 cloudflared 进程后再启动。"
},
"appShell": {
- "title": "Vibe Remote"
+ "title": "Vibe Remote",
+ "subtitle": "本地 agent 网关",
+ "workspaceLabel": "工作区",
+ "navigationLabel": "控制台",
+ "statusLabel": "服务状态",
+ "versionLabel": "版本"
},
"wizard": {
"title": "Vibe Remote 设置向导"
},
"welcome": {
- "title": "设置 Vibe Remote",
- "subtitle": "面向 Slack、Discord、Telegram、微信与飞书的本地 AI 编程助手",
+ "title": "欢迎使用 Vibe Remote",
+ "subtitle": "连接你常用的 IM 平台,并配置始终运行在本机上的本地 AI agent。",
"getStarted": "开始设置",
- "feature1": "本地运行,代码留在您的电脑上",
- "feature2": "SaaS 模式使用云端中继进行 Slack 消息传输,但不会存储消息内容",
- "feature3": "自托管模式通过 Slack Socket Mode 完全在本地运行"
+ "card1Title": "本地优先",
+ "card2Title": "多平台",
+ "card3Title": "多 Agent",
+ "feature1": "代码与 Agent 都留在你自己的机器上。",
+ "feature2": "Slack、Discord、Telegram、飞书、微信,一个 bot 全搞定。",
+ "feature3": "Claude、OpenCode、Codex —— 按群/频道路由。"
},
"modeSelection": {
"title": "选择模式",
@@ -121,9 +188,30 @@
"primary": "主平台",
"primaryTitle": "主平台",
"primaryDesc": "仅用于兼容排序和默认界面展示焦点。",
+ "credentialsTitle": "平台凭证",
+ "credentialsSubtitle": "为每个 IM 平台配置机器人认证所需的凭证。",
+ "enabledPlatforms": "已启用平台",
+ "selectedSummary": "已选择 {{count}} 个",
+ "apply": "应用",
+ "applyHint": "应用下方凭证标签的更新;未启用平台仍会保留已保存凭证。",
+ "credentialSetupTitle": "{{platform}} 工作区设置",
+ "credentialSetupSubtitle": "在这里直接配置选中平台,并在启用群组前验证凭证。",
+ "stepCreateApp": "创建平台应用",
+ "stepAddBotToken": "添加 Bot 令牌",
+ "stepConfigureOptions": "配置平台选项",
+ "stepValidate": "验证并完成",
+ "expanded": "已展开",
+ "collapsed": "已收起",
+ "expandedStepHint": "这里复用 {{platform}} 的凭证设置模块。",
+ "credentialGuide": "打开平台控制台,复制所需凭证,粘贴到下方后验证连接。",
+ "openConsole": "打开 {{platform}} 控制台",
+ "validateToken": "验证令牌",
+ "validationSuccess": "凭证验证成功",
+ "validationFailed": "凭证验证失败",
+ "wechatCredentialHint": "微信使用扫码绑定,重新绑定和登录状态仍在微信设置流程中处理。",
"slack": {
"title": "Slack",
- "desc": "连接 Slack 工作区并启用频道。"
+ "desc": "连接 Slack 工作区并启用群组。"
},
"discord": {
"title": "Discord",
@@ -153,7 +241,7 @@
"authFailed": "验证失败",
"guild": "允许工作的服务器",
"guildPlaceholder": "未加载到服务器",
- "guildHint": "这里决定机器人能在哪些 Discord 服务器工作;下一步再启用这些服务器里的具体频道并设置路由。",
+ "guildHint": "这里决定机器人能在哪些 Discord 服务器工作;下一步再启用这些服务器里的具体群组并设置路由。",
"selectedGuilds": "已选择 {{count}} 个",
"selectAllGuilds": "全选",
"clearGuilds": "清空",
@@ -439,8 +527,8 @@
"enabledCount": "已启用 {{count}} 个",
"accessPolicy": "访问策略",
"accessPolicyHint": "只有勾选的群组才会启用",
- "accessPolicyDiscord": "服务器和频道是两层开关",
- "accessPolicyHintDiscord": "先勾选允许工作的 Discord 服务器,再在下方启用具体频道并设置路由。",
+ "accessPolicyDiscord": "服务器和群组是两层开关",
+ "accessPolicyHintDiscord": "先勾选允许工作的 Discord 服务器,再在下方启用具体群组并设置路由。",
"noChannelsFound": "未找到群组,请检查令牌或邀请机器人",
"noChannelsLoaded": "未加载群组",
"addTokenFirst": "请先添加机器人令牌以加载群组",
@@ -469,7 +557,16 @@
"requireMentionOn": "需要 @提及",
"requireMentionOff": "不需要 @提及",
"mentionStatusOn": "需要 @",
- "mentionStatusOff": "不需要 @"
+ "mentionStatusOff": "不需要 @",
+ "allChannelsTab": "全部群组",
+ "filterPlaceholder": "搜索群组…",
+ "rescan": "重新扫描",
+ "showInactive": "显示未启用",
+ "headerSummary": "全部群组 · {{active}} 已启用 · {{discovered}} 已发现",
+ "headerSummaryPlatform": "{{platform}} · {{active}} 已启用 · {{discovered}} 已发现",
+ "noChannelsForSearch": "没有群组匹配你的搜索。",
+ "discordNeedsGuild": "请在 Discord 标签页选择一个服务器来查看其群组。",
+ "platformDisabled": "平台未启用 — 请在设置中启用后再查看群组。"
},
"summary": {
"title": "检查并完成",
@@ -507,7 +604,40 @@
},
"dashboard": {
"title": "仪表盘",
- "subtitle": "管理您的本地 Vibe Remote 实例",
+ "subtitle": "查看本地 Vibe Remote 节点的实时状态。",
+ "searchPlaceholder": "快速搜索…",
+ "heroTitle": "Vibe Remote 运行概览",
+ "runningTitle": "Vibe Remote 正在运行",
+ "stoppedTitle": "Vibe Remote 已停止",
+ "startedAt": "{{time}} 启动({{relative}})",
+ "levelHealthy": "健康",
+ "levelAttention": "需要关注",
+ "metricPlatforms": "活跃平台",
+ "metricPlatformsHint": "已连接的平台数 / 平台目录总数",
+ "metricGroups": "活跃群组",
+ "metricGroupsHint": "总共发现了 {{count}} 个群组",
+ "metricUsers": "已绑定用户",
+ "metricUsersHint": "允许访问当前节点的用户数",
+ "metricHealth": "健康告警",
+ "metricHealthHealthy": "所有检查均正常",
+ "metricHealthIssues": "存在告警或失败项需要处理",
+ "platformOverviewTitle": "已连接平台",
+ "platformOverviewSubtitle": "查看哪些消息平台已经在线,并快速跳转到对应的群组路由配置。",
+ "platformGroupsHint": "{{active}} 个已启用 / {{discovered}} 个已发现群组",
+ "platformNoGroupsHint": "该平台仅支持私聊",
+ "manageAll": "统一管理",
+ "manageRoute": "管理",
+ "configure": "配置",
+ "connected": "已连接",
+ "notConfigured": "未配置",
+ "recentActivityTitle": "最近活动",
+ "recentActivitySubtitle": "来自主服务日志的最新运行事件。",
+ "recentActivityEmpty": "还没有最近的服务日志事件。",
+ "openMessaging": "打开消息设置",
+ "groupsAndUsersTitle": "群组与用户",
+ "groupsAndUsersHint": "群组路由和用户访问现在已经拆成独立页面,可以分别管理。",
+ "settingsShortcutTitle": "设置快捷入口",
+ "settingsShortcutHint": "快速进入 backend 默认值和 service 级配置。",
"serviceStatus": "服务状态",
"mode": "模式",
"platform": "平台",
@@ -619,24 +749,41 @@
},
"userList": {
"title": "用户",
- "subtitle": "管理已绑定的用户及其设置",
+ "subtitle": "来自各 IM 平台的已绑定用户 · 单独路由 & 管理员权限。",
"noUsers": "暂无绑定用户。创建绑定码并分享给用户。",
+ "filterPlaceholder": "搜索用户…",
+ "allUsers": "全部用户",
+ "showDisabled": "显示已停用",
"settingsSaved": "用户设置已保存",
"settingsSaveFailed": "保存用户设置失败",
"admin": "管理员",
"user": "用户",
+ "bot": "机器人",
"boundAt": "绑定于",
+ "boundAgo": "绑定于 {{ago}}",
"removeUser": "移除",
"removeConfirm": "确定要移除此用户吗?此操作不可撤销。",
"lastAdminDemoteWarning": "你正在取消最后一个管理员身份。继续后将进入“无管理员约束”状态,任何已绑定用户都可操作管理员菜单。是否继续?",
"lastAdminRemoveWarning": "你正在移除最后一个管理员。继续后将进入“无管理员约束”状态,任何已绑定用户都可操作管理员菜单。是否继续?",
"cannotRemoveLastAdmin": "无法移除最后一个管理员",
"adminToggled": "管理员状态已更新",
- "userRemoved": "用户已移除"
+ "userRemoved": "用户已移除",
+ "noUsersForSearch": "没有匹配的用户。",
+ "inheritsGlobal": "— 继承全局 —"
},
"bindCode": {
"title": "绑定码",
+ "badge": "绑定码",
+ "inviteTitle": "从任意平台邀请新用户",
+ "inviteDescription": "生成一个一次性绑定码,让用户从 Slack/Discord/Telegram 等平台私信机器人发送该码,即可按照下方路由规则绑定到此 Vibe Remote 实例。",
+ "noActiveCode": "暂无可用绑定码",
+ "noActiveHint": "生成一个邀请用户。",
+ "activeCodeLabel": "可用绑定码",
+ "expiresIn": "{{time}} 后过期",
+ "noExpiry": "无过期",
"newCode": "新建绑定码",
+ "createCode": "创建绑定码",
+ "revoke": "撤销",
"oneTime": "一次性",
"expiring": "有效期",
"active": "可用",
@@ -657,7 +804,9 @@
"usageTitle": "绑定码如何使用",
"usageHint": "把可用绑定码发给用户,并让用户私信机器人发送 `bind <code>`。`/bind <code>` 也仍然可用。用户必须先完成绑定才可和bot私聊。仅管理员用户才可操作bot菜单进行设置。",
"viewUnavailable": "不可用({{count}})",
+ "viewMore": "+ 还有 {{count}} 个",
"unavailableTitle": "不可用的绑定码",
+ "allCodesTitle": "所有绑定码",
"noAvailableCodes": "暂无可用绑定码,请先创建新的绑定码。",
"noUnavailableCodes": "暂无不可用绑定码。",
"close": "关闭"
diff --git a/ui/src/index.css b/ui/src/index.css
index 4258b1017..8f1e28188 100644
--- a/ui/src/index.css
+++ b/ui/src/index.css
@@ -1,58 +1,289 @@
@import "tailwindcss";
+@import "tw-animate-css";
-@theme {
- --font-sans: "IBM Plex Sans", sans-serif;
- --font-mono: "IBM Plex Mono", monospace;
- --font-display: "Space Grotesk", sans-serif;
-
- --color-bg: var(--bg);
- --color-panel: var(--panel);
- --color-text: var(--text);
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-surface: var(--surface);
+ --color-surface-2: var(--surface-2);
+ --color-surface-3: var(--surface-3);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
- --color-border: var(--border);
+ --color-muted-soft: var(--muted-soft);
--color-accent: var(--accent);
- --color-accent-2: var(--accent-2);
- --color-success: var(--success);
- --color-warning: var(--warning);
- --color-danger: var(--danger);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-border: var(--border);
+ --color-border-strong: var(--border-strong);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-mint: var(--mint);
+ --color-mint-soft: var(--mint-soft);
+ --color-cyan: var(--cyan);
+ --color-cyan-soft: var(--cyan-soft);
+ --color-violet: var(--violet);
+ --color-violet-soft: var(--violet-soft);
+ --color-gold: var(--gold);
+
+ /* Compatibility aliases for current UI during migration. */
+ --color-bg: var(--background);
+ --color-panel: var(--surface);
+ --color-text: var(--foreground);
+ --color-success: var(--mint);
+ --color-warning: var(--gold);
+ --color-danger: var(--destructive);
+
+ --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
+ Helvetica, Arial, sans-serif;
+ --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
+ Consolas, monospace;
+ --font-display: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
+ Helvetica, Arial, sans-serif;
+
+ --radius-xs: 4px;
+ --radius-sm: 6px;
+ --radius-md: 8px;
+ --radius-lg: 12px;
+ --radius-xl: 16px;
+ --radius-2xl: 20px;
+ --radius-3xl: 24px;
+
+ /* Card glow shadows (matches design.pen). */
+ --shadow-mint-card: 0 24px 48px -12px rgba(91, 255, 160, 0.078);
+ --shadow-mint-card-lg: 0 32px 64px -12px rgba(91, 255, 160, 0.078);
}
-:root {
- --bg: #F6F2EA;
- --panel: #FFFFFF;
- --text: #1F2430;
- --muted: #5B6475;
- --border: #E6DFD3;
+:root,
+[data-theme="dark"] {
+ --background: #080812;
+ --foreground: #f5f1e8;
+ --surface: #0e0e18;
+ --surface-2: #11111c;
+ --surface-3: #06060e;
+ --card: #11111c;
+ --card-foreground: #f5f1e8;
+ --popover: #11111c;
+ --popover-foreground: #f5f1e8;
+
+ --primary: #5bffa0;
+ --primary-foreground: #080812;
+ --secondary: #11111c;
+ --secondary-foreground: #f5f1e8;
+ --muted: #9ba3b8;
+ --muted-soft: #0e0e18;
+ --accent: #3fe0e5;
+ --accent-foreground: #080812;
+ --destructive: #ff6b6b;
+ --destructive-foreground: #080812;
+
+ --border: rgba(255, 255, 255, 0.08);
+ --border-strong: rgba(255, 255, 255, 0.14);
+ --input: rgba(255, 255, 255, 0.10);
+ --ring: rgba(91, 255, 160, 0.6);
+
+ --mint: #5bffa0;
+ --mint-soft: rgba(91, 255, 160, 0.16);
+ --cyan: #3fe0e5;
+ --cyan-soft: rgba(63, 224, 229, 0.16);
+ --violet: #7c5bff;
+ --violet-soft: rgba(124, 91, 255, 0.16);
+ --gold: #ffc857;
+
+ /* Page-family gradients (mirror design.pen 1:1). Layers ordered top-most first. */
+ --gradient-console:
+ radial-gradient(50% 40% at 5% 5%, rgba(91, 255, 160, 0.20), rgba(91, 255, 160, 0) 100%),
+ radial-gradient(40% 50% at 95% 40%, rgba(63, 224, 229, 0.122), rgba(63, 224, 229, 0) 100%),
+ radial-gradient(60% 50% at 50% 100%, rgba(124, 91, 255, 0.078), rgba(124, 91, 255, 0) 100%),
+ #080812;
+ --gradient-settings:
+ radial-gradient(50% 40% at 5% 5%, rgba(91, 255, 160, 0.20), rgba(91, 255, 160, 0) 100%),
+ radial-gradient(50% 50% at 95% 50%, rgba(124, 91, 255, 0.10), rgba(124, 91, 255, 0) 100%),
+ #080812;
+ --gradient-wizard-welcome:
+ radial-gradient(70% 60% at 50% 30%, rgba(91, 255, 160, 0.20), rgba(91, 255, 160, 0) 100%),
+ radial-gradient(50% 50% at 85% 70%, rgba(63, 224, 229, 0.122), rgba(63, 224, 229, 0) 100%),
+ #080812;
+ --gradient-wizard-backends:
+ radial-gradient(60% 50% at 50% 20%, rgba(124, 91, 255, 0.122), rgba(124, 91, 255, 0) 100%),
+ #080812;
+ --gradient-wizard-platforms:
+ radial-gradient(60% 50% at 50% 20%, rgba(91, 255, 160, 0.20), rgba(91, 255, 160, 0) 100%),
+ radial-gradient(40% 40% at 85% 70%, rgba(63, 224, 229, 0.122), rgba(63, 224, 229, 0) 100%),
+ radial-gradient(40% 40% at 15% 70%, rgba(124, 91, 255, 0.122), rgba(124, 91, 255, 0) 100%),
+ #080812;
+ --gradient-wizard-slack:
+ radial-gradient(50% 50% at 30% 20%, rgba(224, 30, 90, 0.122), rgba(224, 30, 90, 0) 100%),
+ #080812;
+ --gradient-wizard-summary:
+ radial-gradient(60% 50% at 50% 30%, rgba(91, 255, 160, 0.20), rgba(91, 255, 160, 0) 100%),
+ #080812;
+
+ /* Legacy alias for any page still using --bg-page directly. */
+ --bg-page: var(--gradient-console);
+}
+
+[data-theme="light"] {
+ --background: #f4f6fb;
+ --foreground: #0a0a14;
+ --surface: #ffffff;
+ --surface-2: #ffffff;
+ --surface-3: #eef1f7;
+ --card: #ffffff;
+ --card-foreground: #0a0a14;
+ --popover: #ffffff;
+ --popover-foreground: #0a0a14;
+
+ --primary: #10b981;
+ --primary-foreground: #ffffff;
+ --secondary: #eef1f7;
+ --secondary-foreground: #0a0a14;
+ --muted: #5c6079;
+ --muted-soft: #eef1f7;
+ --accent: #0891b2;
+ --accent-foreground: #ffffff;
+ --destructive: #e11d48;
+ --destructive-foreground: #ffffff;
+
+ --border: rgba(8, 8, 18, 0.08);
+ --border-strong: rgba(8, 8, 18, 0.14);
+ --input: rgba(8, 8, 18, 0.12);
+ --ring: rgba(16, 185, 129, 0.5);
+
+ --mint: #10b981;
+ --mint-soft: rgba(16, 185, 129, 0.14);
+ --cyan: #0891b2;
+ --cyan-soft: rgba(8, 145, 178, 0.14);
+ --violet: #7c3aed;
+ --violet-soft: rgba(124, 58, 237, 0.14);
+ --gold: #d97706;
+
+ /* Light-theme page gradients (softer alphas over light base). */
+ --gradient-console:
+ radial-gradient(50% 40% at 5% 5%, rgba(16, 185, 129, 0.10), rgba(16, 185, 129, 0) 100%),
+ radial-gradient(40% 50% at 95% 40%, rgba(8, 145, 178, 0.08), rgba(8, 145, 178, 0) 100%),
+ radial-gradient(60% 50% at 50% 100%, rgba(124, 58, 237, 0.06), rgba(124, 58, 237, 0) 100%),
+ #f4f6fb;
+ --gradient-settings:
+ radial-gradient(50% 40% at 5% 5%, rgba(16, 185, 129, 0.10), rgba(16, 185, 129, 0) 100%),
+ radial-gradient(50% 50% at 95% 50%, rgba(124, 58, 237, 0.08), rgba(124, 58, 237, 0) 100%),
+ #f4f6fb;
+ --gradient-wizard-welcome:
+ radial-gradient(70% 60% at 50% 30%, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0) 100%),
+ radial-gradient(50% 50% at 85% 70%, rgba(8, 145, 178, 0.08), rgba(8, 145, 178, 0) 100%),
+ #f4f6fb;
+ --gradient-wizard-backends:
+ radial-gradient(60% 50% at 50% 20%, rgba(124, 58, 237, 0.10), rgba(124, 58, 237, 0) 100%),
+ #f4f6fb;
+ --gradient-wizard-platforms:
+ radial-gradient(60% 50% at 50% 20%, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0) 100%),
+ radial-gradient(40% 40% at 85% 70%, rgba(8, 145, 178, 0.08), rgba(8, 145, 178, 0) 100%),
+ radial-gradient(40% 40% at 15% 70%, rgba(124, 58, 237, 0.08), rgba(124, 58, 237, 0) 100%),
+ #f4f6fb;
+ --gradient-wizard-slack:
+ radial-gradient(50% 50% at 30% 20%, rgba(224, 30, 90, 0.08), rgba(224, 30, 90, 0) 100%),
+ #f4f6fb;
+ --gradient-wizard-summary:
+ radial-gradient(60% 50% at 30% 30%, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0) 100%),
+ #f4f6fb;
+
+ --bg-page: var(--gradient-console);
- --accent: #0B7285;
- --accent-2: #E29578;
+ /* Light card glow — much softer than dark. */
+ --shadow-mint-card: 0 12px 24px -16px rgba(16, 185, 129, 0.20);
+ --shadow-mint-card-lg: 0 16px 32px -16px rgba(16, 185, 129, 0.22);
+}
- --success: #2F9E44;
- --warning: #F08C00;
- --danger: #D9480F;
+html,
+body,
+#root {
+ min-height: 100%;
}
+html,
body {
+ background: var(--color-background);
+ color: var(--color-foreground);
font-family: var(--font-sans);
- color: var(--text);
- background: linear-gradient(to top, var(--bg), #FFFFFF);
- min-height: 100vh;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ letter-spacing: 0;
margin: 0;
}
-h1, h2, h3, h4, h5, h6 {
+/* Page-family glow utilities. Apply on the scrolling main container. */
+.page-glow-console {
+ background: var(--gradient-console);
+ background-attachment: fixed;
+}
+.page-glow-settings {
+ background: var(--gradient-settings);
+ background-attachment: fixed;
+}
+.page-glow-wizard-welcome {
+ background: var(--gradient-wizard-welcome);
+ background-attachment: fixed;
+}
+.page-glow-wizard-backends {
+ background: var(--gradient-wizard-backends);
+ background-attachment: fixed;
+}
+.page-glow-wizard-platforms {
+ background: var(--gradient-wizard-platforms);
+ background-attachment: fixed;
+}
+.page-glow-wizard-slack {
+ background: var(--gradient-wizard-slack);
+ background-attachment: fixed;
+}
+.page-glow-wizard-summary {
+ background: var(--gradient-wizard-summary);
+ background-attachment: fixed;
+}
+
+body {
+ min-height: 100vh;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
font-family: var(--font-display);
}
-button, [role="button"] {
- cursor: pointer;
+@layer base {
+ *,
+ *::before,
+ *::after {
+ box-sizing: border-box;
+ }
+
+ button:not(:disabled),
+ [role="button"]:not(:disabled) {
+ cursor: pointer;
+ }
+
+ button:disabled {
+ cursor: not-allowed;
+ }
}
-button:disabled {
- cursor: not-allowed;
+code,
+pre,
+.font-mono {
+ font-family: var(--font-mono);
}
-/* Toast animation */
@keyframes slide-in {
from {
transform: translateX(100%);
diff --git a/ui/tsconfig.app.json b/ui/tsconfig.app.json
index a9b5a59ca..a54a98377 100644
--- a/ui/tsconfig.app.json
+++ b/ui/tsconfig.app.json
@@ -15,6 +15,10 @@
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
/* Linting */
"strict": true,
diff --git a/ui/vite.config.ts b/ui/vite.config.ts
index 8b0f57b91..9af6431ba 100644
--- a/ui/vite.config.ts
+++ b/ui/vite.config.ts
@@ -1,7 +1,13 @@
+import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
+ resolve: {
+ alias: {
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
+ },
+ },
})
diff --git a/vibe/runtime.py b/vibe/runtime.py
index c03898ee7..56441f715 100644
--- a/vibe/runtime.py
+++ b/vibe/runtime.py
@@ -326,13 +326,26 @@ def stop_process(pid_path, timeout=5):
def write_status(state, detail=None, service_pid=None, ui_pid=None):
+ now_iso = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
+ # Preserve started_at across consecutive "running" writes so the UI can
+ # show a stable service start time. Reset it on transitions in/out of
+ # running state.
+ started_at = None
+ if state == "running":
+ previous = read_json(paths.get_runtime_status_path()) or {}
+ if previous.get("state") == "running" and previous.get("started_at"):
+ started_at = previous["started_at"]
+ else:
+ started_at = now_iso
payload = {
"state": state,
"detail": detail,
"service_pid": service_pid,
"ui_pid": ui_pid,
- "updated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
+ "updated_at": now_iso,
}
+ if started_at:
+ payload["started_at"] = started_at
write_json(paths.get_runtime_status_path(), payload)
@@ -377,19 +390,12 @@ def start_service():
def start_ui(host, port):
command = "from vibe.ui_server import run_ui_server; run_ui_server('{}', {})".format(host, port)
- pid = spawn_background(
+ return spawn_background(
[sys.executable, "-c", command],
paths.get_runtime_ui_pid_path(),
"ui_stdout.log",
"ui_stderr.log",
)
- try:
- from vibe import remote_access
-
- remote_access.reconcile()
- except Exception:
- logger.warning("Failed to reconcile remote access after UI start", exc_info=True)
- return pid
def stop_service():
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 3c09009ad..821b2dd83 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -228,8 +228,43 @@ def _is_loopback_host(value: str | None) -> bool:
return False
-def _is_local_request() -> bool:
- return _is_loopback_peer() and _is_loopback_host(request.host) and not _has_cloudflare_forwarded_metadata()
+def _is_private_peer() -> bool:
+ remote_addr = (request.remote_addr or "").strip()
+ if not remote_addr or remote_addr == "localhost":
+ return False
+ try:
+ address = ipaddress.ip_address(remote_addr)
+ except ValueError:
+ return False
+ if address.is_loopback or address.is_private or address.is_link_local:
+ return True
+ mapped = getattr(address, "ipv4_mapped", None)
+ if mapped is not None:
+ return mapped.is_loopback or mapped.is_private or mapped.is_link_local
+ return False
+
+
+def _is_setup_host_request(config: V2Config | None) -> bool:
+ if config is None:
+ return False
+ setup_host = _normalized_host(getattr(config.ui, "setup_host", ""))
+ if not setup_host or setup_host in {"0.0.0.0", "::", "*"}:
+ return False
+ if _is_loopback_host(setup_host):
+ return False
+ if _normalized_host(request.host) != setup_host:
+ return False
+ if _has_cloudflare_forwarded_metadata():
+ return False
+ return _is_private_peer()
+
+
+def _is_local_request(config: V2Config | None = None) -> bool:
+ if _has_cloudflare_forwarded_metadata():
+ return False
+ if _is_loopback_peer() and _is_loopback_host(request.host):
+ return True
+ return _is_setup_host_request(config)
def _normalized_host(value: str | None) -> str:
@@ -370,7 +405,7 @@ def _redirect_to_vibe_cloud_login(config: V2Config):
@app.before_request
def enforce_remote_access_cookie():
config = _load_remote_access_config()
- local_request = _is_local_request()
+ local_request = _is_local_request(config)
if config is None:
if local_request:
return None
@@ -1428,6 +1463,19 @@ def serve_static(path):
# =============================================================================
+def _reconcile_remote_access_for_ui_start(config: V2Config | None) -> None:
+ if config is None:
+ return
+ try:
+ from vibe import remote_access
+
+ result = remote_access.reconcile(config)
+ if isinstance(result, dict) and result.get("ok") is False:
+ logger.warning("Remote access reconcile after UI start failed: %s", result.get("error"))
+ except Exception:
+ logger.warning("Failed to reconcile remote access after UI start", exc_info=True)
+
+
def run_ui_server(host: str, port: int) -> None:
"""Start the Flask UI server."""
global _server
@@ -1452,6 +1500,7 @@ def run_ui_server(host: str, port: int) -> None:
for attempt in range(10):
try:
_server = make_server(host, port, app, threaded=True)
+ _reconcile_remote_access_for_ui_start(config)
_server.serve_forever()
break
except OSError as e: