refactor: 统一页面样式
This commit is contained in:
1 parent
42908b42f1
commit
0c6f1c0ffc
25 files changed
+3509
-2044
No files matched your search
@@ -0,0 +1,393 @@
|
||||
# HXOps 前端三层设计系统方案
|
||||
|
||||
> 目标:在**明亮 / 暗黑**主题下,页面背景、文字、边框、按钮、卡片、布局间距保持一致;新页面默认符合规范,旧页面按阶段迁移。
|
||||
|
||||
---
|
||||
|
||||
## 1. 总体架构
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ L3 布局壳 Layout(PageShell / AppShell / ChatShell) │
|
||||
│ 决定:全页结构、顶栏高度、侧栏宽度、主区内边距 │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ L2 组件类 Components(.btn / .card / .input-field / …) │
|
||||
│ 决定:按钮、表单、卡片、徽章、弹层等可复用 UI 块 │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ L1 设计令牌 Tokens(CSS 变量,:root + html.dark) │
|
||||
│ 决定:颜色、阴影、圆角基数;亮暗只改变量,不写 dark: │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**核心原则**
|
||||
|
||||
| 原则 | 说明 |
|
||||
|------|------|
|
||||
| 单一色源 | 页面背景/文字/边框只来自 L1 变量(通过语义 class 引用) |
|
||||
| 亮暗自动 | 组件与布局**不写** `dark:bg-*`,切换 `html.dark` 即可 |
|
||||
| 向下约束 | L3 只能用 L2;L2 只能用 L1;禁止页面内 `text-[#hex]` |
|
||||
| 例外登记 | 登录 Hero 渐变、Agent 图标等允许 `data-surface="marketing"` |
|
||||
|
||||
**与现有代码的关系**
|
||||
|
||||
- 保留:`useTheme`、`ThemeToggleButton`、`tailwind darkMode: 'class'`、`brand` 色阶
|
||||
- 演进:逐步减少 `style.css` 中 `html.dark .bg-white !important` 补丁(迁移完成后删除)
|
||||
- 统一字体:`tailwind.config.js` 的 `sans` 与 `style.css` 的 `html` 字体一致(见 §1.1)
|
||||
|
||||
### 1.1 字体(一次性对齐)
|
||||
|
||||
```js
|
||||
// tailwind.config.js — 与 style.css 一致
|
||||
fontFamily: {
|
||||
sans: ['"PingFang SC"', '"Microsoft YaHei"', '"Segoe UI"', 'system-ui', 'sans-serif'],
|
||||
},
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. L1 设计令牌(Tokens)
|
||||
|
||||
### 2.1 文件职责
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `frontend/src/styles/tokens.css` | 仅定义 `:root` / `html.dark` 变量(从 `style.css` 拆出) |
|
||||
| `frontend/src/styles/utilities.css` | 语义 utility(`bg-page`、`text-primary` …) |
|
||||
| `frontend/src/style.css` | `@import` 上述文件 + Tailwind + L2 组件类 |
|
||||
|
||||
### 2.2 语义令牌表(亮 / 暗)
|
||||
|
||||
| 令牌 | 明亮 | 暗黑 | 用途 |
|
||||
|------|------|------|------|
|
||||
| `--bg-page` | `#f8fafc` | `#020617` | 全页背景 |
|
||||
| `--bg-surface` | `#ffffff` | `#0b1220` | 卡片、顶栏、主面板 |
|
||||
| `--bg-surface-soft` | `#f8fafc` | `#0f172a` | 次级区域、表头、侧栏项 hover 底 |
|
||||
| `--bg-surface-strong` | `#f1f5f9` | `#1e293b` | 输入框、禁用底、ghost hover |
|
||||
| `--text-primary` | `#0f172a` | `#f8fafc` | 标题、强调正文 |
|
||||
| `--text-secondary` | `#334155` | `#cbd5e1` | 正文 |
|
||||
| `--text-muted` | `#64748b` | `#94a3b8` | 说明、占位、次要标签 |
|
||||
| `--border-default` | `#e2e8f0` | `#334155` | 卡片、分割线、输入框边框 |
|
||||
| `--border-subtle` | `#f1f5f9` | `#1e293b` | 弱分割 |
|
||||
| `--overlay-soft` | `rgba(15,23,42,.4)` | `rgba(2,6,23,.72)` | 遮罩 |
|
||||
| `--shadow-elevated` | 见现 `style.css` | 见现 `style.css` | 浮层、下拉 |
|
||||
| `--glow-accent` | 见现 `style.css` | 见现 `style.css` | 玻璃面板、强调卡片 |
|
||||
| `--focus-ring` | `rgba(14,165,233,.35)` | `rgba(56,189,248,.4)` | focus 环 |
|
||||
|
||||
**状态色(新增,供 Message / Badge / 表单校验)**
|
||||
|
||||
| 令牌 | 明亮背景 | 暗黑背景 | 前景 |
|
||||
|------|----------|----------|------|
|
||||
| `--status-success-bg` | `#eef8e8` | `rgba(34,197,94,.12)` | `--status-success-fg` |
|
||||
| `--status-info-bg` | `#eaf4ff` | `rgba(56,189,248,.12)` | `--status-info-fg` |
|
||||
| `--status-warning-bg` | `#fff8e8` | `rgba(250,204,21,.12)` | `--status-warning-fg` |
|
||||
| `--status-error-bg` | `#fff1f0` | `rgba(239,68,68,.12)` | `--status-error-fg` |
|
||||
|
||||
品牌色继续使用 Tailwind `brand-50` … `brand-950`(不纳入 CSS 变量,避免重复维护)。
|
||||
|
||||
### 2.3 语义 Utility(L1 对外 API)
|
||||
|
||||
模板中**只允许**以下类表示「结构色」,禁止 `bg-white dark:bg-slate-900` 等成对写法:
|
||||
|
||||
```css
|
||||
/* utilities.css — 示例 */
|
||||
.bg-page { background-color: var(--bg-page); }
|
||||
.bg-surface { background-color: var(--bg-surface); }
|
||||
.bg-surface-soft { background-color: var(--bg-surface-soft); }
|
||||
.bg-surface-strong{ background-color: var(--bg-surface-strong); }
|
||||
|
||||
.text-primary { color: var(--text-primary); }
|
||||
.text-secondary { color: var(--text-secondary); }
|
||||
.text-muted { color: var(--text-muted); }
|
||||
|
||||
.border-default { border-color: var(--border-default); }
|
||||
.border-subtle { border-color: var(--border-subtle); }
|
||||
|
||||
.shadow-elevated { box-shadow: var(--shadow-elevated); }
|
||||
```
|
||||
|
||||
**允许保留的 Tailwind 用法**
|
||||
|
||||
- 布局:`flex`、`grid`、`gap-*`、`p-*`、`max-w-*`
|
||||
- 品牌:`bg-brand-600`、`text-brand-600`、`ring-brand-500`
|
||||
- 状态:`.alert-success` 等 L2 类(内部用 `--status-*`)
|
||||
|
||||
### 2.4 Tailwind 扩展(可选,与变量对齐)
|
||||
|
||||
```js
|
||||
// tailwind.config.js
|
||||
colors: {
|
||||
surface: {
|
||||
page: 'var(--bg-page)',
|
||||
DEFAULT: 'var(--bg-surface)',
|
||||
soft: 'var(--bg-surface-soft)',
|
||||
strong: 'var(--bg-surface-strong)',
|
||||
},
|
||||
content: {
|
||||
primary: 'var(--text-primary)',
|
||||
secondary: 'var(--text-secondary)',
|
||||
muted: 'var(--text-muted)',
|
||||
},
|
||||
line: {
|
||||
DEFAULT: 'var(--border-default)',
|
||||
subtle: 'var(--border-subtle)',
|
||||
},
|
||||
},
|
||||
```
|
||||
|
||||
团队二选一:**语义 class**(`bg-page`)或 **Tailwind 别名**(`bg-surface-page`),项目内只选一种,本文档默认 **语义 class**。
|
||||
|
||||
---
|
||||
|
||||
## 3. L2 组件类(Components)
|
||||
|
||||
在 `style.css` 的 `@layer components` 中维护;所有组件类**只引用 L1 变量 + brand 色**,不写 `dark:`。
|
||||
|
||||
### 3.1 按钮
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.btn` | 基类:圆角 `rounded-xl`、过渡、对齐 |
|
||||
| `.btn-primary` | 主操作:`brand-600` 背景(亮暗共用色阶) |
|
||||
| `.btn-secondary` | 次要:`bg-surface` + `border-default` |
|
||||
| `.btn-ghost` | 图标/工具栏 |
|
||||
| `.btn-danger` | 删除、退出等 |
|
||||
| `.btn-icon` | 正方形图标按钮(顶栏、侧栏折叠) |
|
||||
|
||||
### 3.2 表单
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.input-field` | 文本输入、textarea(已有,改为变量驱动背景/边框) |
|
||||
| `.select-field` | `<select>` 与 input 视觉一致 |
|
||||
| `.label-field` | 表单标签:`text-xs font-semibold text-secondary uppercase` |
|
||||
|
||||
### 3.3 表面 / 卡片
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.card` | 标准卡片:`bg-surface` + `border-default` + `rounded-2xl` + `shadow-soft` |
|
||||
| `.card-interactive` | 可点击卡片:在 `.card` 上增加 hover 阴影 |
|
||||
| `.surface-panel` | 区块容器(无 hover),用于 Admin 主内容区 |
|
||||
| `.glass-panel` | 侧栏/浮层毛玻璃(已有,保持变量阴影) |
|
||||
|
||||
### 3.4 反馈
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.alert-success` / `.alert-info` / `.alert-warning` / `.alert-error` | 替代 `LevelMessageDialog` 内 hex |
|
||||
| `.badge` | 已有,补充 `badge-success` 等(可选) |
|
||||
|
||||
### 3.5 排版
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.page-title` | `text-2xl font-bold text-primary` |
|
||||
| `.section-title` | `text-lg font-semibold text-primary` |
|
||||
| `.section-desc` | `text-sm text-muted` |
|
||||
|
||||
### 3.6 间距(移动端已有,扩展为全端)
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.page-shell` | `min-h-screen bg-page text-secondary` |
|
||||
| `.page-shell-mobile` | 水平内边距 `px-3 md:px-8`(已有) |
|
||||
| `.section-gap` | 区块间距 `mb-6 md:mb-8` |
|
||||
| `.card-padding` | 卡片内边距 `p-4 sm:p-6` |
|
||||
|
||||
### 3.7 Chat 专用(保留命名空间)
|
||||
|
||||
| 类名 | 用途 |
|
||||
|------|------|
|
||||
| `.chat-composer-shell` | 已有 |
|
||||
| `.chat-composer-textarea` | 已有 |
|
||||
| `.chat-history-item` | 历史列表项 active/hover(从 ChatView 抽离) |
|
||||
|
||||
---
|
||||
|
||||
## 4. L3 布局壳(Layout)
|
||||
|
||||
新建目录:`frontend/src/layouts/`
|
||||
|
||||
### 4.1 布局类型与路由映射
|
||||
|
||||
| 布局组件 | 使用页面 | 结构 |
|
||||
|----------|----------|------|
|
||||
| `MarketingShell` | 未登录 `/workspace` 登录区 | 全屏背景 + 居中卡片,顶栏固定语言/主题 |
|
||||
| `AppShell` | 已登录 Workspace、KbWorkspace、Admin | 可选顶栏 + 主内容 `page-shell-mobile` |
|
||||
| `ChatShell` | `/chat/:agentId` | 左栏历史 + 右主区(Chat 特化,但颜色仍走 L1) |
|
||||
| `MinimalShell` | ResetPassword | 居中单卡,`max-w-md` |
|
||||
|
||||
### 4.2 `AppShell.vue` 规范(Admin / KB / Workspace _logged-in_)
|
||||
|
||||
```vue
|
||||
<!-- 结构约定 -->
|
||||
<div class="page-shell flex min-h-screen flex-col">
|
||||
<header class="app-header"> <!-- h-14, bg-surface/80, border-b border-default, sticky -->
|
||||
<slot name="header-left" />
|
||||
<slot name="header-right" /> <!-- ThemeToggle + 语言 -->
|
||||
</header>
|
||||
<div class="flex flex-1 overflow-hidden">
|
||||
<aside v-if="$slots.sidebar" class="app-sidebar"> <!-- w-64 / 折叠 w-16 -->
|
||||
<slot name="sidebar" />
|
||||
</aside>
|
||||
<main class="flex-1 overflow-auto page-shell-mobile py-6">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
**尺寸令牌(L3 常量,写死在 layout 或 CSS 变量)**
|
||||
|
||||
| 名称 | 值 |
|
||||
|------|-----|
|
||||
| `--header-height` | `3.5rem` (56px) |
|
||||
| `--sidebar-width` | `16rem` |
|
||||
| `--sidebar-collapsed-width` | `4rem` |
|
||||
| `--content-max-width` | `80rem`(营销/表单页) |
|
||||
|
||||
### 4.3 `ChatShell.vue`
|
||||
|
||||
- 外壳:`page-shell` + `flex h-screen overflow-hidden`
|
||||
- 侧栏:`glass-panel` + `bg-surface` + `border-default`
|
||||
- 主区:`bg-surface`(替代 `bg-white dark:bg-slate-950`)
|
||||
- 顶栏(移动端):高度与 `AppShell` 的 `--header-height` 一致
|
||||
|
||||
### 4.4 路由层挂载(推荐)
|
||||
|
||||
```ts
|
||||
// router/index.ts — 概念
|
||||
{
|
||||
path: '/admin',
|
||||
component: () => import('../layouts/AppShell.vue'),
|
||||
children: [{ path: '', component: AdminView }],
|
||||
}
|
||||
```
|
||||
|
||||
短期可不改路由:在各 View 根节点外包一层对应 Shell;中期再改为嵌套路由。
|
||||
|
||||
### 4.5 顶栏右侧统一工具区
|
||||
|
||||
抽组件 `layouts/AppHeaderTools.vue`:
|
||||
|
||||
- `ThemeToggleButton`
|
||||
- 语言 `<select class="select-field select-field--compact">`
|
||||
|
||||
Workspace 未登录、Admin、KB 共用,避免三处各写一套样式。
|
||||
|
||||
---
|
||||
|
||||
## 5. 页面迁移对照
|
||||
|
||||
| 页面 | L3 布局 | L1/L2 改造要点 |
|
||||
|------|---------|----------------|
|
||||
| `WorkspaceView` 未登录 | `MarketingShell` | 登录卡用 `.card`;Hero 渐变保留为 `data-surface="marketing"` |
|
||||
| `WorkspaceView` 已登录 | `AppShell` | `text-[#1b2b49]` → `text-primary`;Agent 卡用 `.card-interactive` |
|
||||
| `ChatView` | `ChatShell` | 侧栏/主区改语义色;按钮对齐 `.btn-*` |
|
||||
| `AdminView` | `AppShell` + sidebar slot | `gray-*` → 语义色;表头 `bg-surface-soft` |
|
||||
| `KbWorkspaceView` | `AppShell` | 与 Admin 卡片圆角/边框一致 |
|
||||
| `ResetPasswordView` | `MinimalShell` | 已用 `btn-primary`,补 `bg-page` |
|
||||
| `LevelMessageDialog` | — | `STYLE_MAP` → `.alert-*` |
|
||||
|
||||
---
|
||||
|
||||
## 6. 实施阶段(建议 4 周,可并行 Review)
|
||||
|
||||
### Phase 0 — 基础设施(1–2 天)
|
||||
|
||||
- [ ] 新增 `tokens.css`、`utilities.css`,从 `style.css` 迁出变量
|
||||
- [ ] 补全 `--status-*` 与语义 utility
|
||||
- [ ] 统一 `tailwind.config.js` 字体
|
||||
- [ ] 新增 `.alert-*`、`.app-header` 等 L2 类
|
||||
- [ ] 本文档作为 PR Review 检查清单
|
||||
|
||||
### Phase 1 — 布局壳(2–3 天)
|
||||
|
||||
- [ ] 实现 `AppShell`、`MarketingShell`、`MinimalShell`、`AppHeaderTools`
|
||||
- [ ] `ResetPasswordView`、`KbWorkspaceView` 接入(改动面小)
|
||||
- [ ] `LevelMessageDialog` 改用 `.alert-*`
|
||||
|
||||
### Phase 2 — 工作台与管理端(3–5 天)
|
||||
|
||||
- [ ] `WorkspaceView` 已登录区接入 `AppShell` + 语义色
|
||||
- [ ] `AdminView` 根布局 + 消灭 `gray-*` / 无暗色 hex
|
||||
- [ ] 删除已覆盖的 `html.dark` 补丁(分批,每 PR 跑亮/暗目视)
|
||||
|
||||
### Phase 3 — Chat(3–5 天)
|
||||
|
||||
- [ ] `ChatShell` 抽离
|
||||
- [ ] composer / 历史列表 L2 类
|
||||
- [ ] 减少 ChatView 内 `dark:` 数量目标:**0**(仅保留 markdown/prose 等特殊区)
|
||||
|
||||
### Phase 4 — 收尾与门禁
|
||||
|
||||
- [ ] ESLint / Stylelint 可选:`no-restricted-syntax` 禁止 `dark:bg-`、`text-[#`(warning 先行)
|
||||
- [ ] 删除冗余 `html.dark !important` 块
|
||||
- [ ] 截图回归:亮/暗 × 桌面/移动 × 5 条主路径
|
||||
|
||||
---
|
||||
|
||||
## 7. 开发规范(Review Checklist)
|
||||
|
||||
**必须**
|
||||
|
||||
- [ ] 页面根节点有 `page-shell` 或处于 L3 布局内
|
||||
- [ ] 背景/文字/边框使用 L1 语义类,无 `dark:` 颜色对
|
||||
- [ ] 按钮/输入/卡片使用 L2 类名
|
||||
- [ ] 新弹窗、Message 使用 `.alert-*` 或 `LevelMessageDialog`
|
||||
|
||||
**禁止**
|
||||
|
||||
- [ ] `bg-white`、`bg-gray-50`、`text-slate-800` 等作为**页面结构色**(品牌色除外)
|
||||
- [ ] `text-[#xxxx]`、`bg-[#xxxx]`(`data-surface="marketing"` 除外)
|
||||
- [ ] 同一元素 `bg-x dark:bg-y`
|
||||
|
||||
**例外(需注释 `// design-system:exception`)**
|
||||
|
||||
- 登录页品牌渐变、背景图
|
||||
- 第三方 iframe、Markdown prose(可用 `@tailwindcss/typography` + 变量覆盖)
|
||||
|
||||
---
|
||||
|
||||
## 8. 目录结构(目标态)
|
||||
|
||||
```
|
||||
frontend/src/
|
||||
├── styles/
|
||||
│ ├── tokens.css # L1 变量
|
||||
│ └── utilities.css # L1 语义 class
|
||||
├── style.css # Tailwind + L2 components + dark 补丁(逐步缩减)
|
||||
├── layouts/
|
||||
│ ├── AppShell.vue
|
||||
│ ├── ChatShell.vue
|
||||
│ ├── MarketingShell.vue
|
||||
│ ├── MinimalShell.vue
|
||||
│ └── AppHeaderTools.vue
|
||||
├── components/ # 业务组件,遵守 L2
|
||||
└── views/ # 只写内容与 slot,不写全页骨架色
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 验收标准(Done Definition)
|
||||
|
||||
1. **亮暗切换**:在 Workspace / Chat / Admin / KB 四条路径切换主题,无「白块」「黑字 on 黑底」、无未适配 hex。
|
||||
2. **色源唯一**:`rg "dark:(bg|text|border)-" frontend/src/views` 行数较基线下降 ≥ 80%。
|
||||
3. **结构一致**:Admin 与 KB 顶栏高度、主区内边距、卡片圆角一致。
|
||||
4. **组件复用**:新建表单页只引用 `.input-field` + `.btn-primary`,不复制 Tailwind 串。
|
||||
|
||||
---
|
||||
|
||||
## 10. 与当前仓库的对照(基线)
|
||||
|
||||
| 项目 | 现状 | 目标 |
|
||||
|------|------|------|
|
||||
| 主题切换 | `useTheme` + `html.dark` | 保持 |
|
||||
| 色板定义 | `style.css` 变量已有 | 拆文件 + 状态色 + 语义 utility |
|
||||
| 页面用法 | 大量 `dark:` + slate/gray 混用 | 仅 L1 语义类 |
|
||||
| 布局 | 每 View 自建 | L3 四种 Shell |
|
||||
| 补丁 | ~79 条 `html.dark !important` | 迁移后删除 |
|
||||
|
||||
---
|
||||
|
||||
*文档版本:2026-05-27 · 维护:前端 PR 附带亮/暗截图即视为遵循本规范。*
|
||||
@@ -3,9 +3,7 @@ import { computed, onBeforeUnmount, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
interface Props {
|
||||
// 由父组件控制显隐,使用 v-model 统一管理弹框状态。
|
||||
modelValue: boolean;
|
||||
// title/message 支持外部按场景透传,不传时走 i18n 默认值。
|
||||
title?: string;
|
||||
message?: string;
|
||||
confirmText?: string;
|
||||
@@ -39,7 +37,6 @@ const closeDialog = () => {
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
// 先抛出 cancel 事件,方便父组件做状态回滚,再关闭弹框。
|
||||
emit('cancel');
|
||||
closeDialog();
|
||||
};
|
||||
@@ -57,7 +54,6 @@ const handleEscKey = (event: KeyboardEvent) => {
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
// 关键点:弹框打开时监听 ESC,关闭后及时解绑,避免全局事件泄漏。
|
||||
if (visible) {
|
||||
document.addEventListener('keydown', handleEscKey);
|
||||
return;
|
||||
@@ -77,29 +73,29 @@ onBeforeUnmount(() => {
|
||||
<Transition name="delete-dialog-fade">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-0 z-[100] bg-black/45 flex items-center justify-center p-4"
|
||||
class="dialog-overlay items-center"
|
||||
@click.self="handleCancel"
|
||||
>
|
||||
<div class="delete-dialog-container w-full max-w-[416px] rounded-lg bg-white shadow-[0_6px_16px_0_rgba(0,0,0,0.08),0_3px_6px_-4px_rgba(0,0,0,0.12),0_9px_28px_8px_rgba(0,0,0,0.05)] px-6 pt-7 pb-5">
|
||||
<div class="dialog-panel max-w-[416px] rounded-lg px-6 pt-7 pb-5">
|
||||
<div class="flex items-start gap-3">
|
||||
<span class="delete-dialog-icon" aria-hidden="true">!</span>
|
||||
<span class="dialog-icon-warning" aria-hidden="true">!</span>
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-[16px] leading-6 font-semibold text-[rgba(0,0,0,0.88)]">
|
||||
<h3 class="text-base font-semibold leading-6 text-primary">
|
||||
{{ resolvedTitle }}
|
||||
</h3>
|
||||
<p class="mt-3 text-[14px] leading-[22px] text-[rgba(0,0,0,0.65)] whitespace-pre-line">
|
||||
<p class="section-desc mt-3 whitespace-pre-line">
|
||||
{{ resolvedMessage }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex justify-end gap-2">
|
||||
<button type="button" class="delete-dialog-btn cancel" @click="handleCancel">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="handleCancel">
|
||||
{{ resolvedCancelText }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="delete-dialog-btn confirm"
|
||||
class="btn-danger btn-sm"
|
||||
:disabled="confirmLoading"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
@@ -113,60 +109,6 @@ onBeforeUnmount(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.delete-dialog-icon {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 9999px;
|
||||
background: #faad14;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.delete-dialog-btn {
|
||||
min-width: 66px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
font-weight: 400;
|
||||
padding: 4px 15px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.delete-dialog-btn.cancel {
|
||||
color: rgba(0, 0, 0, 0.88);
|
||||
background: #fff;
|
||||
border: 1px solid #d9d9d9;
|
||||
}
|
||||
|
||||
.delete-dialog-btn.cancel:hover {
|
||||
border-color: #4096ff;
|
||||
color: #4096ff;
|
||||
}
|
||||
|
||||
.delete-dialog-btn.confirm {
|
||||
color: #fff;
|
||||
background: #1677ff;
|
||||
border: 1px solid #1677ff;
|
||||
}
|
||||
|
||||
.delete-dialog-btn.confirm:hover {
|
||||
background: #4096ff;
|
||||
border-color: #4096ff;
|
||||
}
|
||||
|
||||
.delete-dialog-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.delete-dialog-fade-enter-active,
|
||||
.delete-dialog-fade-leave-active {
|
||||
transition: opacity 0.18s ease;
|
||||
@@ -178,17 +120,9 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.delete-dialog-container {
|
||||
.dialog-panel {
|
||||
max-width: 94vw;
|
||||
padding: 20px 16px 16px;
|
||||
}
|
||||
|
||||
.delete-dialog-icon {
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.delete-dialog-btn {
|
||||
min-width: 62px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -417,29 +417,29 @@ watch(
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="modelValue && file" class="fixed inset-0 z-[80] flex items-center justify-center bg-black/50 dark:bg-slate-950/70 backdrop-blur-sm p-4">
|
||||
<div class="bg-white dark:bg-slate-900 rounded-2xl shadow-xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||
<div class="px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex items-start justify-between gap-4">
|
||||
<div v-if="modelValue && file" class="dialog-overlay dialog-overlay--z80 items-center">
|
||||
<div class="dialog-panel max-w-5xl h-[85vh] overflow-hidden">
|
||||
<div class="dialog-header dialog-header--compact items-start">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-medium text-slate-500 dark:text-slate-400 tracking-wide">{{ t('filePreview.title') }}</div>
|
||||
<div class="mt-1 font-semibold text-slate-900 dark:text-slate-100 break-words">{{ file.name }}</div>
|
||||
<button type="button" @click="downloadFile" :disabled="isDownloading" class="mt-2 inline-flex items-center justify-center px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-50 text-brand-700 hover:bg-brand-100 border border-brand-200 dark:bg-brand-900/30 dark:text-brand-300 dark:border-brand-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
<div class="label-field tracking-wide">{{ t('filePreview.title') }}</div>
|
||||
<div class="mt-1 font-semibold text-primary break-words">{{ file.name }}</div>
|
||||
<button type="button" @click="downloadFile" :disabled="isDownloading" class="btn-secondary btn-sm mt-2 inline-flex border-brand-200 text-brand-700 hover:bg-brand-50 disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
<svg v-if="!isDownloading" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
|
||||
</svg>
|
||||
<svg v-else class="animate-spin -ml-1 mr-2 h-4 w-4 text-brand-700 dark:text-brand-300" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<svg v-else class="animate-spin -ml-1 mr-2 h-4 w-4 text-brand-700" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
{{ isDownloading ? t('filePreview.downloading') : t('filePreview.download') }}
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" @click="close" class="shrink-0 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 rounded-xl border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 bg-white/80 dark:bg-slate-900/80 hover:bg-slate-100 dark:hover:bg-slate-800">{{ t('common.close') }}</button>
|
||||
<button type="button" class="btn-secondary shrink-0" @click="close">{{ t('common.close') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-auto p-4 bg-slate-50 dark:bg-slate-950">
|
||||
<div v-if="isLoading" class="text-sm text-slate-500 dark:text-slate-400">{{ t('common.loading') }}</div>
|
||||
<div v-else-if="error" class="text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg p-3">
|
||||
<div class="dialog-preview-body">
|
||||
<div v-if="isLoading" class="text-sm text-muted">{{ t('common.loading') }}</div>
|
||||
<div v-else-if="error" class="alert-ds alert-error text-sm">
|
||||
<template v-if="previewTooLarge">
|
||||
{{ t('filePreview.tooLarge') }}
|
||||
</template>
|
||||
@@ -449,14 +449,14 @@ watch(
|
||||
</div>
|
||||
<div
|
||||
v-else-if="resolvedMode === 'markdown'"
|
||||
class="prose prose-sm max-w-none bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-5"
|
||||
class="prose prose-sm max-w-none dialog-preview-frame p-5"
|
||||
v-html="markdownHtml"
|
||||
></div>
|
||||
<div
|
||||
v-else-if="resolvedMode === 'sheet' && excelPreview"
|
||||
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-4 overflow-auto"
|
||||
class="dialog-preview-frame h-full p-4 overflow-auto"
|
||||
>
|
||||
<div class="mb-3 text-xs text-slate-500 dark:text-slate-400">
|
||||
<div class="mb-3 text-xs text-muted">
|
||||
Sheet: {{ excelPreview.sheet_name }} | Rows: {{ excelPreview.rows.length }}
|
||||
<span v-if="excelPreview.truncated"> (truncated)</span>
|
||||
</div>
|
||||
@@ -466,7 +466,7 @@ watch(
|
||||
<th
|
||||
v-for="(col, i) in excelPreview.columns"
|
||||
:key="`h-${i}`"
|
||||
class="sticky top-0 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 px-2 py-1 text-left font-semibold"
|
||||
class="sticky top-0 bg-surface-soft border border-default px-2 py-1 text-left font-semibold text-secondary"
|
||||
>
|
||||
{{ col }}
|
||||
</th>
|
||||
@@ -477,7 +477,7 @@ watch(
|
||||
<td
|
||||
v-for="(cell, ci) in row"
|
||||
:key="`c-${ri}-${ci}`"
|
||||
class="border border-slate-200 dark:border-slate-700 px-2 py-1 align-top whitespace-pre-wrap break-words"
|
||||
class="border border-default px-2 py-1 align-top whitespace-pre-wrap break-words text-secondary"
|
||||
>
|
||||
{{ cell }}
|
||||
</td>
|
||||
@@ -487,7 +487,7 @@ watch(
|
||||
</div>
|
||||
<div
|
||||
v-else-if="resolvedMode === 'office' && officeKind"
|
||||
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-2 overflow-auto"
|
||||
class="dialog-preview-frame h-full p-2 overflow-auto"
|
||||
>
|
||||
<VueOfficeDocx
|
||||
v-if="officeKind === 'docx'"
|
||||
@@ -500,12 +500,12 @@ watch(
|
||||
style="height: 100%; width: 100%;"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="resolvedMode === 'image'" class="h-full flex items-center justify-center bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-2">
|
||||
<div v-else-if="resolvedMode === 'image'" class="dialog-preview-frame h-full flex items-center justify-center p-2">
|
||||
<img :src="imageSrc" :alt="file.name" class="max-w-full max-h-full object-contain" />
|
||||
</div>
|
||||
<div
|
||||
v-else-if="['pdf', 'doc', 'ppt', 'pptx'].includes(ext) && officeObjectUrl"
|
||||
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 overflow-hidden"
|
||||
class="dialog-preview-frame h-full overflow-hidden"
|
||||
>
|
||||
<iframe
|
||||
:src="officeObjectUrl"
|
||||
@@ -515,12 +515,12 @@ watch(
|
||||
</div>
|
||||
<div
|
||||
v-else-if="needsOfficeFallback"
|
||||
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-6"
|
||||
class="dialog-preview-frame h-full p-6"
|
||||
>
|
||||
<!-- Graceful fallback for private/non-HTTPS Office links:
|
||||
show actions instead of an empty iframe. -->
|
||||
<div class="text-sm text-slate-700 dark:text-slate-200 font-semibold">Preview not available for this file URL</div>
|
||||
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
|
||||
<div class="text-sm font-semibold text-secondary">Preview not available for this file URL</div>
|
||||
<div class="mt-2 text-sm text-muted">
|
||||
This Office file uses a private or non-HTTPS link, so online preview cannot render it.
|
||||
</div>
|
||||
<div class="mt-4 flex gap-3">
|
||||
@@ -528,7 +528,7 @@ watch(
|
||||
type="button"
|
||||
@click="downloadFile"
|
||||
:disabled="isDownloading"
|
||||
class="px-4 py-2 rounded-lg bg-brand-600 text-white text-sm hover:bg-brand-700 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center"
|
||||
class="btn-primary btn-sm inline-flex"
|
||||
>
|
||||
<svg v-if="isDownloading" class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
@@ -541,7 +541,7 @@ watch(
|
||||
<iframe
|
||||
v-else
|
||||
:src="iframeSrc"
|
||||
class="w-full h-full min-h-[480px] bg-white dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-700"
|
||||
class="dialog-preview-frame w-full h-full min-h-[480px]"
|
||||
allow="clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
@@ -118,34 +118,34 @@ const submitFeedback = async () => {
|
||||
<template>
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-0 z-[80] flex items-start justify-center overflow-y-auto bg-black/40 p-3 backdrop-blur-sm sm:items-center sm:p-4"
|
||||
class="dialog-overlay dialog-overlay--z80"
|
||||
>
|
||||
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl border border-transparent bg-white shadow-2xl dark:border-slate-700 dark:bg-slate-900">
|
||||
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 dark:border-slate-800 sm:px-8 sm:pb-4 sm:pt-7">
|
||||
<h3 class="text-2xl font-bold text-gray-900 dark:text-slate-100">{{ t('feedback.title') }}</h3>
|
||||
<div class="dialog-panel max-w-2xl max-h-[92vh]">
|
||||
<div class="dialog-header">
|
||||
<h3 class="section-title text-2xl">{{ t('feedback.title') }}</h3>
|
||||
<button
|
||||
@click="closeDialog"
|
||||
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:text-slate-500 dark:hover:bg-slate-800 dark:hover:text-slate-300"
|
||||
type="button"
|
||||
class="btn-icon-ds"
|
||||
aria-label="Close"
|
||||
@click="closeDialog"
|
||||
>
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8">
|
||||
<div class="dialog-body space-y-5">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.type') }}</label>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<label class="label-field block">{{ t('feedback.labels.type') }}</label>
|
||||
<div class="segment-control segment-control--chips segment-control--md" role="radiogroup" :aria-label="t('feedback.labels.type')">
|
||||
<button
|
||||
v-for="item in typeOptions"
|
||||
:key="item"
|
||||
type="button"
|
||||
role="radio"
|
||||
:aria-checked="selectedType === item"
|
||||
class="segment-item"
|
||||
:class="selectedType === item ? 'segment-item--active' : ''"
|
||||
@click="selectedType = item"
|
||||
class="rounded-xl border px-4 py-2.5 text-base font-medium transition-colors"
|
||||
:class="
|
||||
selectedType === item
|
||||
? 'border-blue-500 bg-blue-50 text-blue-700 dark:border-brand-500 dark:bg-brand-500/15 dark:text-brand-300'
|
||||
: 'border-gray-200 bg-gray-50 text-gray-700 hover:bg-gray-100 dark:border-slate-600 dark:bg-slate-800/80 dark:text-slate-300 dark:hover:border-slate-500 dark:hover:bg-slate-700/80'
|
||||
"
|
||||
>
|
||||
{{ item }}
|
||||
</button>
|
||||
@@ -153,44 +153,45 @@ const submitFeedback = async () => {
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.module') }}</label>
|
||||
<select
|
||||
v-model="selectedModule"
|
||||
class="w-full rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-base text-gray-900 shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:focus:border-brand-500 dark:focus:bg-slate-800 dark:focus:ring-brand-500/20"
|
||||
>
|
||||
<label class="label-field block">{{ t('feedback.labels.module') }}</label>
|
||||
<select v-model="selectedModule" class="input-field text-base">
|
||||
<option v-for="item in moduleOptions" :key="item" :value="item">{{ item }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500 dark:text-red-400">*</span></label>
|
||||
<label class="label-field block">
|
||||
{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500">*</span>
|
||||
</label>
|
||||
<textarea
|
||||
v-model="content"
|
||||
rows="5"
|
||||
maxlength="2000"
|
||||
class="w-full resize-none rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-base text-gray-900 shadow-sm outline-none transition-all placeholder:text-gray-400 focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:placeholder:text-slate-500 dark:focus:border-brand-500 dark:focus:bg-slate-800 dark:focus:ring-brand-500/20"
|
||||
class="input-field resize-none text-base"
|
||||
:placeholder="t('feedback.placeholder.content')"
|
||||
/>
|
||||
<div class="mt-2 flex items-center justify-between">
|
||||
<div v-if="error" class="text-base text-red-600 dark:text-red-400">{{ error }}</div>
|
||||
<div v-else class="text-base text-gray-400"> </div>
|
||||
<div class="text-base text-gray-400 dark:text-slate-500">{{ content.length }}/2000</div>
|
||||
<div v-if="error" class="text-base text-red-600">{{ error }}</div>
|
||||
<div v-else class="text-base text-muted"> </div>
|
||||
<div class="text-base text-muted">{{ content.length }}/2000</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-3 rounded-b-2xl border-t border-gray-100 bg-white px-5 py-4 dark:border-slate-800 dark:bg-slate-900 sm:px-8">
|
||||
<div class="dialog-footer">
|
||||
<button
|
||||
@click="closeDialog"
|
||||
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
type="button"
|
||||
class="btn-ghost"
|
||||
:disabled="submitting"
|
||||
@click="closeDialog"
|
||||
>
|
||||
{{ t('feedback.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
@click="submitFeedback"
|
||||
class="inline-flex items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-base font-medium text-white shadow-md shadow-blue-200 transition-all hover:bg-blue-700 active:scale-95 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-brand-600 dark:shadow-none dark:hover:bg-brand-500"
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
:disabled="!canSubmit"
|
||||
@click="submitFeedback"
|
||||
>
|
||||
<MessageSquareText class="h-5 w-5" />
|
||||
{{ submitting ? t('feedback.submitting') : t('feedback.submit') }}
|
||||
|
||||
@@ -5,15 +5,12 @@ import { Check, Info, AlertTriangle, XCircle, X } from 'lucide-vue-next';
|
||||
type MessageLevel = 'success' | 'info' | 'warning' | 'error';
|
||||
|
||||
interface Props {
|
||||
// 父组件通过 v-model 控制弹框显隐。
|
||||
modelValue: boolean;
|
||||
// 消息级别决定配色和图标。
|
||||
level?: MessageLevel;
|
||||
title?: string;
|
||||
message?: string;
|
||||
closeOnMask?: boolean;
|
||||
closeOnEsc?: boolean;
|
||||
// 自动关闭时长(毫秒):<= 0 表示不自动关闭。
|
||||
autoCloseMs?: number;
|
||||
}
|
||||
|
||||
@@ -31,30 +28,14 @@ const emit = defineEmits<{
|
||||
(e: 'close'): void;
|
||||
}>();
|
||||
|
||||
const STYLE_MAP: Record<MessageLevel, { panel: string; iconWrap: string; icon: string }> = {
|
||||
success: {
|
||||
panel: 'bg-[#eef8e8] border-[#b7e2a7]',
|
||||
iconWrap: 'border-[#52c41a]',
|
||||
icon: 'text-[#52c41a]',
|
||||
},
|
||||
info: {
|
||||
panel: 'bg-[#eaf4ff] border-[#9fcbff]',
|
||||
iconWrap: 'border-[#1677ff]',
|
||||
icon: 'text-[#1677ff]',
|
||||
},
|
||||
warning: {
|
||||
panel: 'bg-[#fff8e8] border-[#ffd88a]',
|
||||
iconWrap: 'border-[#faad14]',
|
||||
icon: 'text-[#faad14]',
|
||||
},
|
||||
error: {
|
||||
panel: 'bg-[#fff1f0] border-[#ffb3b0]',
|
||||
iconWrap: 'border-[#ff4d4f]',
|
||||
icon: 'text-[#ff4d4f]',
|
||||
},
|
||||
const ALERT_CLASS: Record<MessageLevel, string> = {
|
||||
success: 'alert-ds alert-success',
|
||||
info: 'alert-ds alert-info',
|
||||
warning: 'alert-ds alert-warning',
|
||||
error: 'alert-ds alert-error',
|
||||
};
|
||||
|
||||
const ICON_MAP: Record<MessageLevel, any> = {
|
||||
const ICON_MAP: Record<MessageLevel, typeof Check> = {
|
||||
success: Check,
|
||||
info: Info,
|
||||
warning: AlertTriangle,
|
||||
@@ -68,7 +49,7 @@ const DEFAULT_TITLE_MAP: Record<MessageLevel, string> = {
|
||||
error: 'Error',
|
||||
};
|
||||
|
||||
const resolvedStyle = computed(() => STYLE_MAP[props.level]);
|
||||
const panelClass = computed(() => ALERT_CLASS[props.level]);
|
||||
const resolvedIcon = computed(() => ICON_MAP[props.level]);
|
||||
const resolvedTitle = computed(() => props.title || DEFAULT_TITLE_MAP[props.level]);
|
||||
const resolvedMessage = computed(() => props.message || '');
|
||||
@@ -109,7 +90,6 @@ watch(
|
||||
}
|
||||
document.addEventListener('keydown', handleEscKey);
|
||||
|
||||
// 关键点:弹框可见时只要内容变化,也会重新计时自动关闭。
|
||||
if (props.autoCloseMs > 0) {
|
||||
autoCloseTimer = setTimeout(() => {
|
||||
closeDialog();
|
||||
@@ -129,16 +109,16 @@ onBeforeUnmount(() => {
|
||||
<Transition name="level-dialog-fade">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-0 z-[110] bg-black/40 flex items-center justify-center p-4"
|
||||
class="dialog-overlay dialog-overlay--z110 items-center"
|
||||
@click.self="handleMaskClose"
|
||||
>
|
||||
<div
|
||||
class="level-dialog-panel w-full max-w-[430px] rounded-2xl border shadow-[0_14px_28px_rgba(0,0,0,0.14)] px-9 py-8 relative"
|
||||
:class="resolvedStyle.panel"
|
||||
class="level-dialog-panel w-full max-w-[430px] rounded-2xl border shadow-elevated px-9 py-8 relative"
|
||||
:class="panelClass"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute top-4 right-4 w-8 h-8 inline-flex items-center justify-center rounded-full text-slate-500 hover:text-slate-700 hover:bg-black/5 transition-colors"
|
||||
class="btn-icon-ds absolute top-4 right-4"
|
||||
@click="closeDialog"
|
||||
aria-label="close dialog"
|
||||
>
|
||||
@@ -146,18 +126,15 @@ onBeforeUnmount(() => {
|
||||
</button>
|
||||
|
||||
<div class="flex items-start gap-4 pr-8 min-h-0">
|
||||
<span
|
||||
class="w-8 h-8 rounded-full border-2 inline-flex items-center justify-center shrink-0 mt-0.5"
|
||||
:class="resolvedStyle.iconWrap"
|
||||
>
|
||||
<component :is="resolvedIcon" class="w-4 h-4" :class="resolvedStyle.icon" />
|
||||
<span class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 border-current mt-0.5">
|
||||
<component :is="resolvedIcon" class="h-4 w-4" />
|
||||
</span>
|
||||
|
||||
<div class="min-w-0 w-full">
|
||||
<h3 class="text-[16px] leading-6 font-semibold text-slate-800">
|
||||
<h3 class="text-base font-semibold leading-6">
|
||||
{{ resolvedTitle }}
|
||||
</h3>
|
||||
<p class="level-dialog-message mt-3 text-[14px] leading-8 text-slate-700 whitespace-pre-line break-words">
|
||||
<p class="level-dialog-message mt-3 text-sm leading-7 whitespace-pre-line break-words opacity-90">
|
||||
{{ resolvedMessage }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -197,10 +174,6 @@ onBeforeUnmount(() => {
|
||||
padding: 20px 18px;
|
||||
}
|
||||
|
||||
.level-dialog-panel p {
|
||||
line-height: 1.75;
|
||||
}
|
||||
|
||||
.level-dialog-message {
|
||||
max-height: 52vh;
|
||||
}
|
||||
|
||||
@@ -26,21 +26,21 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800">
|
||||
<div class="admin-table-section mt-6 p-5">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('scheduleRuns.title') }}</h3>
|
||||
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700" @click="loadRuns">
|
||||
<h3 class="section-title">{{ t('scheduleRuns.title') }}</h3>
|
||||
<button type="button" class="btn-secondary btn-sm" @click="loadRuns">
|
||||
{{ t('scheduleRuns.refresh') }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mb-3 text-xs text-slate-500 dark:text-slate-400">{{ t('scheduleRuns.tip') }}</p>
|
||||
<div v-if="isLoading" class="py-6 text-sm text-slate-500 dark:text-slate-400">{{ t('scheduleRuns.loading') }}</div>
|
||||
<div v-else-if="error" class="py-6 text-sm text-rose-500 dark:text-rose-400">{{ error }}</div>
|
||||
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400 dark:text-slate-500">{{ t('scheduleRuns.empty') }}</div>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<table class="w-full min-w-[920px] text-sm">
|
||||
<p class="section-desc mb-3">{{ t('scheduleRuns.tip') }}</p>
|
||||
<div v-if="isLoading" class="py-6 text-sm text-muted">{{ t('scheduleRuns.loading') }}</div>
|
||||
<div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div>
|
||||
<div v-else-if="runs.length === 0" class="py-6 text-sm text-muted">{{ t('scheduleRuns.empty') }}</div>
|
||||
<div v-else class="admin-table-wrap">
|
||||
<table class="admin-table min-w-[920px] text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-slate-200 text-left text-slate-500 dark:border-slate-700 dark:text-slate-400">
|
||||
<tr>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.runNo') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.schedule') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.start') }}</th>
|
||||
@@ -53,17 +53,17 @@ onMounted(() => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="run in runs" :key="run.id" class="border-b border-slate-100 text-slate-700 dark:border-slate-700 dark:text-slate-300">
|
||||
<td class="px-2 py-2">{{ run.run_no }}</td>
|
||||
<td class="px-2 py-2">{{ run.schedule_name || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.started_at || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.finished_at || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.status }}</td>
|
||||
<td class="px-2 py-2">{{ run.total_count }}</td>
|
||||
<td class="px-2 py-2">{{ run.success_count }}</td>
|
||||
<td class="px-2 py-2">{{ run.failed_count }}</td>
|
||||
<tr v-for="run in runs" :key="run.id">
|
||||
<td class="px-2 py-2 text-secondary">{{ run.run_no }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.schedule_name || '-' }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.started_at || '-' }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.finished_at || '-' }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.status }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.total_count }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.success_count }}</td>
|
||||
<td class="px-2 py-2 text-secondary">{{ run.failed_count }}</td>
|
||||
<td class="px-2 py-2">
|
||||
<a class="text-brand-600 hover:underline dark:text-brand-400" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
|
||||
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -14,17 +14,18 @@ const { appliedTheme, toggleLightDark } = useTheme();
|
||||
const isDarkTheme = computed(() => appliedTheme.value === 'dark');
|
||||
const buttonClass = computed(() =>
|
||||
props.floating
|
||||
? 'fixed bottom-5 right-5 z-[70] h-11 w-11 rounded-full bg-white/90 dark:bg-slate-900/90 backdrop-blur-md shadow-lg border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-slate-100 hover:shadow-xl flex items-center justify-center transition-all'
|
||||
: 'h-8 w-8 md:h-9 md:w-9 rounded-full bg-white/80 dark:bg-slate-900/80 backdrop-blur-md shadow-sm border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-slate-100 hover:shadow-md flex items-center justify-center transition-all'
|
||||
? 'theme-toggle-btn theme-toggle-btn--floating'
|
||||
: 'theme-toggle-btn theme-toggle-btn--inline'
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
@click="toggleLightDark"
|
||||
type="button"
|
||||
:class="buttonClass"
|
||||
:title="isDarkTheme ? (t('theme.switchToLight') || 'Switch to light mode') : (t('theme.switchToDark') || 'Switch to dark mode')"
|
||||
:aria-label="isDarkTheme ? (t('theme.switchToLight') || 'Switch to light mode') : (t('theme.switchToDark') || 'Switch to dark mode')"
|
||||
@click="toggleLightDark"
|
||||
>
|
||||
<Sun v-if="isDarkTheme" class="w-4 h-4 md:w-5 md:h-5" />
|
||||
<Moon v-else class="w-4 h-4 md:w-5 md:h-5" />
|
||||
|
||||
@@ -25,52 +25,52 @@ watch(() => props.open, (open) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
|
||||
<div class="w-full max-w-4xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
|
||||
<div v-if="open" class="dialog-overlay" @click="close">
|
||||
<div class="dialog-panel max-w-4xl p-6" @click.stop>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifyHealth.title') }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.subtitle') }}</p>
|
||||
<h3 class="section-title text-xl">{{ t('kbDifyHealth.title') }}</h3>
|
||||
<p class="section-desc mt-1">{{ t('kbDifyHealth.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="loadHealth">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="loadHealth">
|
||||
{{ t('common.refresh') }}
|
||||
</button>
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="close">
|
||||
{{ t('common.close') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifyHealth.loading') }}</div>
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-muted">{{ t('kbDifyHealth.loading') }}</div>
|
||||
<div v-else-if="payload" class="mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dify API</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.reachable ? t('kbDifyHealth.reachable') : t('kbDifyHealth.unreachable') }}</div>
|
||||
<div class="mt-2 break-all text-xs text-slate-500 dark:text-slate-400">{{ payload.dify_base_url || t('kbDifyHealth.notConfigured') }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">Dify API</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.api.reachable ? t('kbDifyHealth.reachable') : t('kbDifyHealth.unreachable') }}</div>
|
||||
<div class="mt-2 break-all text-xs text-muted">{{ payload.dify_base_url || t('kbDifyHealth.notConfigured') }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.datasetCount') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.dataset_count ?? '--' }}</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.configured') }}{{ payload.dify_api_configured ? t('common.yes') : t('common.no') }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">{{ t('kbDifyHealth.datasetCount') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.api.dataset_count ?? '--' }}</div>
|
||||
<div class="mt-2 text-xs text-muted">{{ t('kbDifyHealth.configured') }}{{ payload.dify_api_configured ? t('common.yes') : t('common.no') }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.boundGroups') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.dataset_bound_groups }}</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.localSyncRecords') }}{{ payload.local_sync_health.sync_records }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">{{ t('kbDifyHealth.boundGroups') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.local_sync_health.dataset_bound_groups }}</div>
|
||||
<div class="mt-2 text-xs text-muted">{{ t('kbDifyHealth.localSyncRecords') }}{{ payload.local_sync_health.sync_records }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncingVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.syncing_versions }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">{{ t('kbDifyHealth.syncingVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.local_sync_health.syncing_versions }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncedVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.synced_versions }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">{{ t('kbDifyHealth.syncedVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.local_sync_health.synced_versions }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.pendingSyncJobs') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.pending_sync_jobs }}</div>
|
||||
<div class="mt-2 text-xs text-rose-500" v-if="payload.api.error">{{ payload.api.error }}</div>
|
||||
<div class="dialog-stat-card">
|
||||
<div class="label-field">{{ t('kbDifyHealth.pendingSyncJobs') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-primary">{{ payload.local_sync_health.pending_sync_jobs }}</div>
|
||||
<div v-if="payload.api.error" class="mt-2 text-xs text-rose-500">{{ payload.api.error }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,44 +49,44 @@ watch(() => props.open, (open) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
|
||||
<div class="w-full max-w-3xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
|
||||
<div v-if="open" class="dialog-overlay" @click="close">
|
||||
<div class="dialog-panel max-w-3xl p-6" @click.stop>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifySettings.title') }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifySettings.subtitle') }}</p>
|
||||
<h3 class="section-title text-xl">{{ t('kbDifySettings.title') }}</h3>
|
||||
<p class="section-desc mt-1">{{ t('kbDifySettings.subtitle') }}</p>
|
||||
</div>
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="close">
|
||||
{{ t('common.close') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifySettings.loading') }}</div>
|
||||
<div v-else class="mt-6 grid gap-4 md:grid-cols-2">
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-muted">{{ t('kbDifySettings.loading') }}</div>
|
||||
<div v-else class="mt-6 grid gap-4 md:grid-cols-2 form-stack">
|
||||
<label class="space-y-2 md:col-span-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Dify Base URL</span>
|
||||
<span class="label-field block">Dify Base URL</span>
|
||||
<input v-model="form.DIFY_API_BASE" class="input-field" placeholder="https://api.dify.ai/v1" />
|
||||
</label>
|
||||
<label class="space-y-2 md:col-span-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Dify API Key</span>
|
||||
<span class="label-field block">Dify API Key</span>
|
||||
<input v-model="form.DIFY_API_KEY" class="input-field" placeholder="app-..." />
|
||||
</label>
|
||||
<label class="space-y-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Permission</span>
|
||||
<span class="label-field block">Permission</span>
|
||||
<select v-model="form.KB_DIFY_PERMISSION" class="input-field">
|
||||
<option value="only_me">only_me</option>
|
||||
<option value="all_team_members">all_team_members</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Indexing Technique</span>
|
||||
<span class="label-field block">Indexing Technique</span>
|
||||
<select v-model="form.KB_DIFY_INDEXING_TECHNIQUE" class="input-field">
|
||||
<option value="high_quality">high_quality</option>
|
||||
<option value="economy">economy</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Search Method</span>
|
||||
<span class="label-field block">Search Method</span>
|
||||
<select v-model="form.KB_DIFY_SEARCH_METHOD" class="input-field">
|
||||
<option value="semantic_search">semantic_search</option>
|
||||
<option value="hybrid_search">hybrid_search</option>
|
||||
@@ -94,7 +94,7 @@ watch(() => props.open, (open) => {
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Doc Form</span>
|
||||
<span class="label-field block">Doc Form</span>
|
||||
<select v-model="form.KB_DIFY_DOC_FORM" class="input-field">
|
||||
<option value="text_model">text_model</option>
|
||||
</select>
|
||||
@@ -102,10 +102,10 @@ watch(() => props.open, (open) => {
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex justify-end gap-3">
|
||||
<button class="rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800" @click="close">
|
||||
<button type="button" class="btn-secondary" @click="close">
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
<button class="rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60" :disabled="saving" @click="save">
|
||||
<button type="button" class="btn-primary" :disabled="saving" @click="save">
|
||||
{{ saving ? t('kbDifySettings.saving') : t('kbDifySettings.save') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -156,23 +156,23 @@ defineExpose({ loadData });
|
||||
|
||||
<template>
|
||||
<div class="animate-fade-in-up">
|
||||
<div class="flex flex-col gap-4 border-b border-gray-100 bg-white px-8 py-6 dark:border-slate-700 dark:bg-slate-900 lg:flex-row lg:items-start lg:justify-between">
|
||||
<div class="kb-admin-header">
|
||||
<div class="min-w-0 flex-1">
|
||||
<h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">{{ t('kbAdmin.title') }}</h2>
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-slate-400">
|
||||
<h2 class="text-xl font-bold text-primary">{{ t('kbAdmin.title') }}</h2>
|
||||
<p class="section-desc mt-1">
|
||||
{{ t('kbAdmin.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end">
|
||||
<div
|
||||
class="inline-flex w-full items-stretch divide-x divide-slate-200 overflow-hidden rounded-xl border border-slate-200 bg-slate-50 dark:divide-slate-600 dark:border-slate-600 dark:bg-slate-800/80 sm:w-auto"
|
||||
class="kb-admin-toolbar"
|
||||
role="toolbar"
|
||||
:aria-label="t('kbAdmin.toolbar')"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="kb-admin-toolbar-btn"
|
||||
@click="settingsDialogOpen = true"
|
||||
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
|
||||
:title="t('kbAdmin.difySettings')"
|
||||
>
|
||||
<Settings class="h-4 w-4 shrink-0" />
|
||||
@@ -180,8 +180,8 @@ defineExpose({ loadData });
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="kb-admin-toolbar-btn"
|
||||
@click="healthDialogOpen = true"
|
||||
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
|
||||
:title="t('kbAdmin.healthCheck')"
|
||||
>
|
||||
<Activity class="h-4 w-4 shrink-0" />
|
||||
@@ -190,8 +190,8 @@ defineExpose({ loadData });
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-primary inline-flex w-full items-center justify-center gap-2 px-5 py-2.5 text-sm sm:w-auto"
|
||||
@click="router.push('/kb/workspace')"
|
||||
class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700 sm:w-auto"
|
||||
>
|
||||
<Wrench class="h-4 w-4 shrink-0" />
|
||||
<span class="whitespace-nowrap">{{ t('kbAdmin.goWorkspace') }}</span>
|
||||
@@ -199,25 +199,25 @@ defineExpose({ loadData });
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-6 bg-white p-8 dark:bg-slate-900 xl:grid-cols-[420px_minmax(0,1fr)]">
|
||||
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
|
||||
<div class="kb-admin-body">
|
||||
<section class="kb-admin-section">
|
||||
<div class="mb-5 flex items-center gap-3">
|
||||
<div class="flex h-10 w-10 items-center justify-center rounded-2xl bg-brand-50 text-brand-600 dark:bg-brand-500/10">
|
||||
<div class="flex h-10 w-10 items-center justify-center rounded-2xl bg-brand-50 text-brand-600">
|
||||
<FolderPlus class="h-5 w-5" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ formTitle }}</h3>
|
||||
<p class="text-sm text-slate-500 dark:text-slate-400">{{ formDescription }}</p>
|
||||
<h3 class="section-title">{{ formTitle }}</h3>
|
||||
<p class="section-desc">{{ formDescription }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupName') }}</label>
|
||||
<label class="label-field mb-2 block">{{ t('kbAdmin.form.groupName') }}</label>
|
||||
<input v-model="form.name" class="input-field" :placeholder="t('kbAdmin.form.groupNamePlaceholder')" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupDesc') }}</label>
|
||||
<label class="label-field mb-2 block">{{ t('kbAdmin.form.groupDesc') }}</label>
|
||||
<textarea
|
||||
v-model="form.description"
|
||||
rows="4"
|
||||
@@ -225,21 +225,21 @@ defineExpose({ loadData });
|
||||
:placeholder="t('kbAdmin.form.groupDescPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center justify-end gap-2 border-t border-slate-100 pt-4 dark:border-slate-700">
|
||||
<div class="flex flex-wrap items-center justify-end gap-2 border-t border-subtle pt-4">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-primary inline-flex items-center gap-1.5 px-5 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60"
|
||||
@click="handleCreateGroup"
|
||||
:disabled="isSubmitting"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-blue-600 px-5 py-2 text-sm font-medium text-white shadow-md shadow-blue-200 transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<FolderPlus v-if="!isSubmitting" class="h-4 w-4 shrink-0" />
|
||||
{{ submitText }}
|
||||
</button>
|
||||
<button
|
||||
v-if="editingGroupId"
|
||||
@click="resetForm"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
class="btn-secondary inline-flex items-center gap-1.5 px-4 py-2 text-sm"
|
||||
@click="resetForm"
|
||||
>
|
||||
<X class="h-4 w-4 shrink-0" />
|
||||
{{ t('kbAdmin.form.cancelEdit') }}
|
||||
@@ -248,7 +248,7 @@ defineExpose({ loadData });
|
||||
<p
|
||||
v-if="feedback"
|
||||
class="text-sm"
|
||||
:class="feedbackType === 'error' ? 'text-rose-500' : 'text-emerald-600 dark:text-emerald-400'"
|
||||
:class="feedbackType === 'error' ? 'text-rose-500' : 'text-emerald-600'"
|
||||
>
|
||||
{{ feedback }}
|
||||
</p>
|
||||
@@ -256,44 +256,46 @@ defineExpose({ loadData });
|
||||
</section>
|
||||
|
||||
<div class="space-y-6">
|
||||
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
|
||||
<section class="kb-admin-section">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.groupsTitle') }}</h3>
|
||||
<span class="text-xs text-slate-400">{{ isRefreshing ? t('common.loading') : '/api/kb/groups' }}</span>
|
||||
<h3 class="section-title">{{ t('kbAdmin.groupsTitle') }}</h3>
|
||||
<span class="text-xs text-muted">{{ isRefreshing ? t('common.loading') : '/api/kb/groups' }}</span>
|
||||
</div>
|
||||
<div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
|
||||
<div v-if="groups.length === 0" class="kb-admin-empty">
|
||||
{{ t('kbAdmin.groupsEmpty') }}
|
||||
</div>
|
||||
<div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
<div
|
||||
v-for="group in groups"
|
||||
:key="group.id"
|
||||
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
|
||||
class="kb-admin-card"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || t('kbAdmin.noDescription') }}</div>
|
||||
<div class="font-semibold text-primary">{{ group.name }}</div>
|
||||
<div class="mt-1 text-sm text-muted">{{ group.description || t('kbAdmin.noDescription') }}</div>
|
||||
</div>
|
||||
<div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
|
||||
<div class="kb-admin-badge">
|
||||
{{ t('kbAdmin.documentCount', { count: group.document_count ?? 0 }) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="text-xs text-slate-400">
|
||||
<div class="text-xs text-muted">
|
||||
{{ t('kbAdmin.updatedAt') }}{{ group.updated_at || '--' }}
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary inline-flex items-center gap-1 px-3 py-2 text-xs"
|
||||
@click="handleEditGroup(group)"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
>
|
||||
<Pencil class="h-3.5 w-3.5" />
|
||||
{{ t('common.edit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50"
|
||||
@click="handleDeleteGroup(group)"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10"
|
||||
>
|
||||
<Trash2 class="h-3.5 w-3.5" />
|
||||
{{ t('common.delete') }}
|
||||
@@ -304,40 +306,41 @@ defineExpose({ loadData });
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
|
||||
<section class="kb-admin-section">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.jobsTitle') }}</h3>
|
||||
<span class="text-xs text-slate-400">/api/kb/jobs</span>
|
||||
<h3 class="section-title">{{ t('kbAdmin.jobsTitle') }}</h3>
|
||||
<span class="text-xs text-muted">/api/kb/jobs</span>
|
||||
</div>
|
||||
<div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
|
||||
<div v-if="jobs.length === 0" class="kb-admin-empty">
|
||||
{{ t('kbAdmin.jobsEmpty') }}
|
||||
</div>
|
||||
<div v-else class="space-y-3">
|
||||
<div
|
||||
v-for="job in jobs"
|
||||
:key="job.id"
|
||||
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
|
||||
class="kb-admin-card"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div>
|
||||
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
|
||||
<div class="font-semibold text-primary">{{ job.job_type }}</div>
|
||||
<div class="mt-1 text-sm text-muted">{{ job.created_at || '--' }}</div>
|
||||
<div class="mt-2 text-sm text-muted">
|
||||
{{ job.message || t('kbAdmin.noJobMessage') }}
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-slate-400">
|
||||
<div class="mt-2 text-xs text-muted">
|
||||
{{ t('kbAdmin.jobMeta', { docId: job.document_id ?? '--', versionId: job.document_version_id ?? '--', progress: job.progress ?? 0 }) }}
|
||||
</div>
|
||||
</div>
|
||||
<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
|
||||
<span class="kb-admin-badge">
|
||||
{{ job.status }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 flex justify-end" v-if="['clean', 'sync_dify'].includes(job.job_type) && job.status !== 'success'">
|
||||
<div v-if="['clean', 'sync_dify'].includes(job.job_type) && job.status !== 'success'" class="mt-3 flex justify-end">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
@click="handleRunJob(job)"
|
||||
:disabled="runningJobId === job.id"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10"
|
||||
>
|
||||
<Play class="h-3.5 w-3.5" />
|
||||
{{ runningJobId === job.id ? t('kbAdmin.running') : t('kbAdmin.runJob') }}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
||||
|
||||
const { locale } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center gap-2">
|
||||
<ThemeToggleButton />
|
||||
<select v-model="locale" class="select-field-ds">
|
||||
<option value="zh-CN">简体中文</option>
|
||||
<option value="zh-TW">繁體</option>
|
||||
<option value="en">English</option>
|
||||
<option value="th">ไทย</option>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { PanelLeftClose, PanelLeftOpen } from 'lucide-vue-next';
|
||||
import AppHeaderTools from './AppHeaderTools.vue';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
collapsibleSidebar?: boolean;
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
subtitle: '',
|
||||
collapsibleSidebar: true,
|
||||
}
|
||||
);
|
||||
|
||||
const sidebarCollapsed = ref(false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell flex min-h-screen flex-col">
|
||||
<header class="app-header">
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<button
|
||||
v-if="collapsibleSidebar"
|
||||
type="button"
|
||||
class="btn-icon-ds hidden md:inline-flex"
|
||||
:aria-label="sidebarCollapsed ? 'Expand sidebar' : 'Collapse sidebar'"
|
||||
@click="sidebarCollapsed = !sidebarCollapsed"
|
||||
>
|
||||
<PanelLeftOpen v-if="sidebarCollapsed" class="h-5 w-5" />
|
||||
<PanelLeftClose v-else class="h-5 w-5" />
|
||||
</button>
|
||||
<div class="min-w-0">
|
||||
<slot name="header-brand">
|
||||
<div v-if="title" class="truncate text-sm font-bold text-primary">{{ title }}</div>
|
||||
<div v-if="subtitle" class="truncate text-xs text-muted">{{ subtitle }}</div>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<slot name="header-actions" />
|
||||
<AppHeaderTools />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="flex min-h-0 flex-1">
|
||||
<aside
|
||||
v-if="$slots.sidebar"
|
||||
class="app-sidebar hidden md:block transition-[width] duration-200"
|
||||
:class="sidebarCollapsed ? 'app-sidebar--collapsed' : ''"
|
||||
>
|
||||
<slot name="sidebar" :collapsed="sidebarCollapsed" />
|
||||
</aside>
|
||||
|
||||
<main class="min-w-0 flex-1 overflow-y-auto page-shell-mobile py-6">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
/** L3 — 对话页:侧栏 + 主区,颜色走 L1 令牌 */
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative flex h-screen overflow-hidden bg-page text-secondary">
|
||||
<slot name="overlay" />
|
||||
<slot name="sidebar" />
|
||||
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-surface">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
/** L3 — 登录 / 营销页布局 */
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell min-h-screen">
|
||||
<div v-if="$slots.tools" class="fixed top-4 right-4 z-50 flex items-center gap-2">
|
||||
<slot name="tools" />
|
||||
</div>
|
||||
<main class="mx-auto max-w-7xl page-shell-mobile pb-12">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
/** L3 — 单卡居中页(重置密码等) */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
maxWidth?: string;
|
||||
}>(),
|
||||
{ maxWidth: '28rem' }
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell flex min-h-screen items-center justify-center p-4">
|
||||
<div class="card w-full shadow-elevated p-8 md:p-10" :style="{ maxWidth }">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+103
-106
@@ -1,24 +1,12 @@
|
||||
@import './styles/tokens.css';
|
||||
@import './styles/utilities.css';
|
||||
@import './styles/components-ds.css';
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@layer base {
|
||||
:root {
|
||||
--bg-page: #f8fafc;
|
||||
--bg-surface: #ffffff;
|
||||
--bg-surface-soft: #f8fafc;
|
||||
--bg-surface-strong: #f1f5f9;
|
||||
--text-primary: #0f172a;
|
||||
--text-secondary: #334155;
|
||||
--text-muted: #64748b;
|
||||
--border-default: #e2e8f0;
|
||||
--border-subtle: #f1f5f9;
|
||||
--overlay-soft: rgba(15, 23, 42, 0.4);
|
||||
--shadow-elevated: 0 8px 30px -12px rgba(15, 23, 42, 0.2);
|
||||
--glow-accent: 0 0 0 1px rgba(14, 165, 233, 0.18), 0 16px 40px -22px rgba(14, 165, 233, 0.45);
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', 'Helvetica Neue', Arial, system-ui, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -28,35 +16,14 @@
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
--bg-page: #020617;
|
||||
--bg-surface: #0b1220;
|
||||
--bg-surface-soft: #0f172a;
|
||||
--bg-surface-strong: #1e293b;
|
||||
--text-primary: #f8fafc;
|
||||
--text-secondary: #cbd5e1;
|
||||
--text-muted: #94a3b8;
|
||||
--border-default: #334155;
|
||||
--border-subtle: #1e293b;
|
||||
--overlay-soft: rgba(2, 6, 23, 0.72);
|
||||
--shadow-elevated: 0 12px 30px -16px rgba(2, 6, 23, 0.85);
|
||||
--glow-accent: 0 0 0 1px rgba(56, 189, 248, 0.28), 0 20px 44px -24px rgba(56, 189, 248, 0.5);
|
||||
background-color: var(--bg-page);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI Semibold', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
||||
@apply tracking-tight font-semibold text-slate-900;
|
||||
}
|
||||
|
||||
html.dark h1,
|
||||
html.dark h2,
|
||||
html.dark h3,
|
||||
html.dark h4,
|
||||
html.dark h5,
|
||||
html.dark h6 {
|
||||
@apply text-slate-100;
|
||||
@apply tracking-tight font-semibold;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -82,23 +49,105 @@
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
@apply btn bg-white text-slate-700 border border-slate-200 hover:bg-slate-50 hover:border-slate-300 shadow-sm;
|
||||
@apply btn shadow-sm;
|
||||
background-color: var(--bg-surface);
|
||||
border: 1px solid var(--border-default);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
@apply btn bg-transparent text-slate-600 hover:bg-slate-100 hover:text-slate-900 shadow-none;
|
||||
@apply btn shadow-none;
|
||||
background-color: transparent;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.btn-ghost:hover {
|
||||
background-color: var(--bg-surface-strong);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
@apply btn bg-red-50 text-red-600 hover:bg-red-100 border border-transparent;
|
||||
@apply btn border border-transparent;
|
||||
background-color: var(--status-error-bg);
|
||||
color: var(--status-error-fg);
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
filter: brightness(0.95);
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
@apply px-3 py-1.5 text-sm rounded-lg gap-1.5;
|
||||
}
|
||||
|
||||
.btn-lg {
|
||||
@apply px-6 py-3 text-base rounded-xl gap-2;
|
||||
}
|
||||
|
||||
.btn-primary.btn-sm,
|
||||
.btn-secondary.btn-sm,
|
||||
.btn-ghost.btn-sm,
|
||||
.btn-danger.btn-sm {
|
||||
@apply px-3 py-1.5 text-sm rounded-lg;
|
||||
}
|
||||
|
||||
.btn-primary.btn-lg,
|
||||
.btn-secondary.btn-lg {
|
||||
@apply px-6 py-3 text-base rounded-xl;
|
||||
}
|
||||
|
||||
.select-field {
|
||||
@apply input-field cursor-pointer;
|
||||
appearance: auto;
|
||||
}
|
||||
|
||||
.label-field {
|
||||
@apply text-xs font-semibold uppercase tracking-wider;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.section-gap {
|
||||
@apply space-y-6;
|
||||
}
|
||||
|
||||
.form-stack {
|
||||
@apply space-y-4;
|
||||
}
|
||||
|
||||
/* @deprecated — use .segment-control + .segment-item (components-ds.css) */
|
||||
.btn-segment {
|
||||
@apply segment-item;
|
||||
}
|
||||
|
||||
.btn-segment--active {
|
||||
@apply segment-item--active;
|
||||
}
|
||||
|
||||
.input-field {
|
||||
@apply w-full px-4 py-3 rounded-xl border border-slate-200 bg-white text-slate-900 placeholder-slate-400 focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 outline-none transition-all duration-200;
|
||||
@apply w-full px-4 py-3 rounded-xl outline-none transition-all duration-200;
|
||||
border: 1px solid var(--border-default);
|
||||
background-color: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.input-field::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.input-field:focus {
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 3px var(--focus-ring);
|
||||
}
|
||||
|
||||
.card {
|
||||
@apply bg-white rounded-2xl border border-slate-100 shadow-soft hover:shadow-lg transition-all duration-300 dark:bg-slate-800 dark:border-slate-700;
|
||||
@apply rounded-2xl shadow-soft hover:shadow-lg transition-all duration-300;
|
||||
background-color: var(--bg-surface);
|
||||
border: 1px solid var(--border-default);
|
||||
}
|
||||
|
||||
/* Mobile-first layout tokens for consistent spacing and density. */
|
||||
@@ -128,21 +177,20 @@
|
||||
|
||||
.glass-panel {
|
||||
@apply backdrop-blur-xl border;
|
||||
background: rgba(255, 255, 255, 0.68);
|
||||
border-color: rgba(148, 163, 184, 0.26);
|
||||
background: var(--glass-panel-bg);
|
||||
border-color: var(--glass-panel-border);
|
||||
box-shadow: var(--glow-accent);
|
||||
}
|
||||
|
||||
/* Keep chat composer border and fill visually consistent in light/dark themes. */
|
||||
.chat-composer-shell {
|
||||
background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.97) 100%);
|
||||
box-shadow: 0 14px 28px -20px rgba(15, 23, 42, 0.38);
|
||||
background-image: var(--chat-composer-gradient);
|
||||
box-shadow: var(--chat-composer-shadow);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
.chat-composer-shell:focus-within {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 16px 34px -22px rgba(14, 165, 233, 0.45);
|
||||
box-shadow: var(--chat-composer-shadow-focus);
|
||||
}
|
||||
|
||||
.chat-composer-textarea {
|
||||
@@ -164,57 +212,14 @@
|
||||
.chat-composer-textarea::selection {
|
||||
background-color: rgba(14, 165, 233, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
html.dark .btn-secondary {
|
||||
background-color: var(--bg-surface-strong);
|
||||
border-color: var(--border-default);
|
||||
color: var(--text-secondary);
|
||||
html.dark .chat-composer-textarea {
|
||||
caret-color: #67e8f9;
|
||||
}
|
||||
|
||||
html.dark .btn-secondary:hover {
|
||||
background-color: var(--bg-surface-soft);
|
||||
border-color: #475569;
|
||||
color: var(--text-primary);
|
||||
html.dark .chat-composer-textarea::selection {
|
||||
background-color: rgba(56, 189, 248, 0.25);
|
||||
}
|
||||
|
||||
html.dark .btn-ghost {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
html.dark .btn-ghost:hover {
|
||||
background-color: var(--bg-surface-strong);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
html.dark .btn-danger {
|
||||
background-color: rgba(239, 68, 68, 0.12);
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
html.dark .btn-danger:hover {
|
||||
background-color: rgba(239, 68, 68, 0.2);
|
||||
}
|
||||
|
||||
html.dark .glass-panel {
|
||||
background: rgba(2, 6, 23, 0.66);
|
||||
border-color: rgba(71, 85, 105, 0.5);
|
||||
}
|
||||
|
||||
html.dark .chat-composer-shell {
|
||||
background-image: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(10, 16, 30, 0.92) 100%);
|
||||
box-shadow: 0 18px 36px -28px rgba(2, 6, 23, 0.96);
|
||||
}
|
||||
|
||||
html.dark .chat-composer-textarea {
|
||||
background-color: transparent !important;
|
||||
caret-color: #67e8f9;
|
||||
}
|
||||
|
||||
html.dark .chat-composer-textarea::selection {
|
||||
background-color: rgba(56, 189, 248, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom Scrollbar */
|
||||
@@ -241,6 +246,8 @@ html.dark #app {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Legacy shim — maps unmigrated Tailwind color utilities to L1 tokens. Remove as views finish migration. */
|
||||
|
||||
html.dark .bg-white {
|
||||
background-color: var(--bg-surface) !important;
|
||||
}
|
||||
@@ -325,16 +332,6 @@ html.dark .ring-1 {
|
||||
--tw-ring-color: rgba(148, 163, 184, 0.3);
|
||||
}
|
||||
|
||||
html.dark .input-field {
|
||||
background-color: var(--bg-surface-soft) !important;
|
||||
border-color: var(--border-default) !important;
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
html.dark .input-field::placeholder {
|
||||
color: var(--text-muted) !important;
|
||||
}
|
||||
|
||||
html.dark input:not([type="checkbox"]):not([type="radio"]),
|
||||
html.dark textarea,
|
||||
html.dark select {
|
||||
|
||||
@@ -0,0 +1,863 @@
|
||||
/**
|
||||
* L2 Design System components — token-driven, no dark: color pairs.
|
||||
*/
|
||||
@layer components {
|
||||
.page-shell {
|
||||
min-height: 100vh;
|
||||
background-color: var(--bg-page);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
line-height: 2rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.section-desc {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.input-field-ds { @apply input-field; }
|
||||
|
||||
.select-field-ds { @apply select-field; }
|
||||
|
||||
.card-ds { @apply card; }
|
||||
|
||||
.card-ds-interactive {
|
||||
@apply card;
|
||||
}
|
||||
|
||||
.card-ds-interactive:hover {
|
||||
box-shadow: var(--shadow-elevated);
|
||||
border-color: rgba(14, 165, 233, 0.35);
|
||||
}
|
||||
|
||||
.card-padding {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.card-padding {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.surface-panel {
|
||||
background-color: var(--bg-surface);
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
/* Aliases — prefer .btn-secondary / .btn-ghost in style.css */
|
||||
.btn-secondary-ds { @apply btn-secondary; }
|
||||
.btn-ghost-ds { @apply btn-ghost; }
|
||||
|
||||
.btn-icon-ds {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
border-radius: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.btn-icon-ds:hover {
|
||||
background-color: var(--bg-surface-strong);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.alert-ds {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background-color: var(--status-success-bg);
|
||||
border-color: var(--status-success-border);
|
||||
color: var(--status-success-fg);
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background-color: var(--status-info-bg);
|
||||
border-color: var(--status-info-border);
|
||||
color: var(--status-info-fg);
|
||||
}
|
||||
|
||||
.alert-warning {
|
||||
background-color: var(--status-warning-bg);
|
||||
border-color: var(--status-warning-border);
|
||||
color: var(--status-warning-fg);
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
background-color: var(--status-error-bg);
|
||||
border-color: var(--status-error-border);
|
||||
color: var(--status-error-fg);
|
||||
}
|
||||
|
||||
.app-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: var(--header-height);
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
border-bottom: 1px solid var(--border-default);
|
||||
background-color: color-mix(in srgb, var(--bg-surface) 88%, transparent);
|
||||
backdrop-filter: blur(12px);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.app-sidebar {
|
||||
width: var(--sidebar-width);
|
||||
flex-shrink: 0;
|
||||
border-right: 1px solid var(--border-default);
|
||||
background-color: var(--bg-surface);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.app-sidebar--collapsed {
|
||||
width: var(--sidebar-collapsed-width);
|
||||
}
|
||||
|
||||
.sidebar-nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.625rem 1rem;
|
||||
margin: 0 0.5rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
transition: background-color 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
.sidebar-nav-item:hover {
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sidebar-nav-item--active {
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft));
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
html.dark .sidebar-nav-item--active {
|
||||
color: #7dd3fc;
|
||||
}
|
||||
|
||||
.token-swatch {
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid var(--border-default);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.token-swatch__color {
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.token-swatch__meta {
|
||||
padding: 0.5rem 0.75rem;
|
||||
background-color: var(--bg-surface);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.shell-preview {
|
||||
border: 1px dashed var(--border-default);
|
||||
border-radius: 1rem;
|
||||
overflow: hidden;
|
||||
background-color: var(--bg-page);
|
||||
}
|
||||
|
||||
.shell-preview__chrome {
|
||||
height: 2rem;
|
||||
background-color: var(--bg-surface-strong);
|
||||
border-bottom: 1px solid var(--border-default);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 0.5rem;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.shell-preview__dot {
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
border-radius: 9999px;
|
||||
background-color: var(--border-default);
|
||||
}
|
||||
|
||||
/* Admin — data tables (token-driven, no dark: pairs) */
|
||||
.admin-table-section {
|
||||
background-color: var(--bg-surface);
|
||||
border: 1px solid var(--border-default);
|
||||
@apply rounded-2xl shadow-sm overflow-hidden animate-fade-in;
|
||||
}
|
||||
|
||||
.admin-table-wrap {
|
||||
@apply overflow-x-auto;
|
||||
}
|
||||
|
||||
.admin-table-header {
|
||||
@apply px-8 py-6 border-b border-default flex justify-between items-center;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-table-header--stacked {
|
||||
@apply flex-col md:flex-row items-start md:items-center gap-4;
|
||||
}
|
||||
|
||||
.admin-table-filters {
|
||||
@apply px-8 py-4 border-b border-subtle gap-4;
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-table-filters--inline {
|
||||
@apply flex flex-wrap p-4 rounded-xl border border-default shadow-sm;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-table {
|
||||
@apply w-full text-left;
|
||||
}
|
||||
|
||||
.admin-table thead {
|
||||
background-color: var(--bg-surface-soft);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.admin-table thead th {
|
||||
@apply font-semibold text-muted uppercase tracking-wider;
|
||||
}
|
||||
|
||||
.admin-table tbody tr {
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.admin-table tbody tr:hover {
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-table-empty {
|
||||
@apply py-12 text-center text-sm text-muted;
|
||||
}
|
||||
|
||||
.admin-table-filter-input {
|
||||
@apply px-3 py-2 rounded-lg border text-sm outline-none transition;
|
||||
border-color: var(--border-default);
|
||||
background-color: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.admin-table-filter-input:focus {
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 2px var(--focus-ring);
|
||||
}
|
||||
|
||||
.admin-table-sticky-head {
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-table-sticky-cell {
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-report-table-wrap {
|
||||
@apply overflow-x-auto rounded-2xl border border-default shadow-elevated;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-report-table thead {
|
||||
@apply sticky top-0 text-xs uppercase tracking-wider;
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
var(--bg-surface-strong),
|
||||
color-mix(in srgb, var(--bg-surface-soft) 75%, #0ea5e9 25%)
|
||||
);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-table thead th {
|
||||
@apply font-semibold border-b border-default align-top;
|
||||
}
|
||||
|
||||
.admin-report-table tbody tr {
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.admin-report-table tbody tr:nth-child(odd) {
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-report-table tbody tr:nth-child(even) {
|
||||
background-color: color-mix(in srgb, var(--bg-surface-soft) 65%, transparent);
|
||||
}
|
||||
|
||||
.admin-report-table tbody tr:hover {
|
||||
background-color: color-mix(in srgb, #0ea5e9 8%, var(--bg-surface-soft));
|
||||
}
|
||||
|
||||
.admin-report-table tbody td {
|
||||
@apply text-sm border-b border-subtle align-top;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-filter-input {
|
||||
@apply w-full px-2 py-1 text-xs border rounded outline-none font-normal normal-case;
|
||||
border-color: var(--border-default);
|
||||
background-color: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.admin-report-filter-input:focus {
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 1px var(--focus-ring);
|
||||
}
|
||||
|
||||
/* Admin — reports module shell */
|
||||
.admin-report-section {
|
||||
@apply relative rounded-3xl border border-default shadow-elevated overflow-hidden animate-fade-in;
|
||||
background-color: var(--bg-surface);
|
||||
background-image: linear-gradient(
|
||||
145deg,
|
||||
var(--bg-surface) 0%,
|
||||
var(--bg-surface-soft) 55%,
|
||||
color-mix(in srgb, var(--bg-surface-soft) 88%, #0ea5e9 12%) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.admin-report-toolbar {
|
||||
@apply px-6 md:px-8 py-5 border-b border-default flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between sticky top-0 z-10;
|
||||
background-color: color-mix(in srgb, var(--bg-surface) 92%, transparent);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.admin-report-badge {
|
||||
@apply inline-flex items-center rounded-full border border-default px-3 py-1 text-xs font-medium;
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-badge--info {
|
||||
border-color: color-mix(in srgb, #0ea5e9 30%, var(--border-default));
|
||||
background-color: color-mix(in srgb, #0ea5e9 10%, var(--bg-surface-soft));
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-badge--indigo {
|
||||
border-color: color-mix(in srgb, #6366f1 30%, var(--border-default));
|
||||
background-color: color-mix(in srgb, #6366f1 10%, var(--bg-surface-soft));
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-panel {
|
||||
@apply p-4 md:p-5 rounded-2xl border border-default shadow-sm;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-report-setting-chip {
|
||||
@apply flex items-center gap-2 px-3 py-2 rounded-lg border border-default text-xs;
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-report-sort-row {
|
||||
@apply grid grid-cols-12 items-center gap-2 text-xs p-2 border border-default rounded-lg;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.admin-report-col-chip {
|
||||
@apply flex items-center justify-between gap-2 px-2 py-1.5 rounded-lg border border-default;
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-report-header-btn {
|
||||
@apply text-left transition-colors text-secondary hover:text-brand-600;
|
||||
}
|
||||
|
||||
.admin-report-page-btn {
|
||||
@apply rounded-lg border border-default px-2.5 py-1.5 text-xs text-secondary transition-colors;
|
||||
}
|
||||
|
||||
.admin-report-page-btn:hover:not(:disabled) {
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-report-page-btn--active {
|
||||
@apply border-brand-600 bg-brand-600 text-white;
|
||||
}
|
||||
|
||||
.admin-report-page-btn--active:hover {
|
||||
background-color: #0284c7;
|
||||
}
|
||||
|
||||
.admin-report-page-btn:disabled {
|
||||
@apply opacity-40 cursor-not-allowed;
|
||||
}
|
||||
|
||||
.admin-nav-btn {
|
||||
@apply px-4 py-3 text-left text-sm font-medium rounded-xl transition-all flex items-center gap-3 relative overflow-hidden whitespace-nowrap flex-shrink-0;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.admin-nav-btn:hover:not(.admin-nav-btn--active) {
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.admin-nav-btn--active {
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft));
|
||||
color: #0284c7;
|
||||
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
||||
}
|
||||
|
||||
html.dark .admin-nav-btn--active {
|
||||
color: #7dd3fc;
|
||||
box-shadow: none;
|
||||
outline: 1px solid color-mix(in srgb, #0ea5e9 25%, transparent);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
.admin-nav-subitem {
|
||||
@apply w-full text-left px-4 py-2 text-xs font-medium rounded-lg transition-colors flex items-center gap-2;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.admin-nav-subitem:hover:not(.admin-nav-subitem--active) {
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-nav-subitem--active {
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft));
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
html.dark .admin-nav-subitem--active {
|
||||
color: #7dd3fc;
|
||||
}
|
||||
|
||||
.admin-form-panel {
|
||||
@apply px-8 py-8 border-b border-default bg-surface;
|
||||
}
|
||||
|
||||
.admin-side-card {
|
||||
@apply card p-6 h-fit;
|
||||
}
|
||||
|
||||
.admin-panel {
|
||||
@apply rounded-2xl border border-default bg-surface shadow-sm;
|
||||
}
|
||||
|
||||
.admin-panel-lg {
|
||||
@apply rounded-3xl border border-default bg-surface shadow-sm;
|
||||
}
|
||||
|
||||
.admin-panel-padding {
|
||||
@apply p-6;
|
||||
}
|
||||
|
||||
.admin-stat-tile {
|
||||
@apply rounded-2xl bg-surface-soft px-4 py-3;
|
||||
}
|
||||
|
||||
.admin-modal-overlay {
|
||||
@apply fixed inset-0 z-50 flex items-start sm:items-center justify-center p-3 sm:p-4 overflow-y-auto bg-overlay backdrop-blur-sm;
|
||||
}
|
||||
|
||||
.admin-modal-panel {
|
||||
@apply card w-full shadow-elevated flex flex-col;
|
||||
}
|
||||
|
||||
.admin-modal-header {
|
||||
@apply px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-default flex justify-between items-start shrink-0;
|
||||
}
|
||||
|
||||
.admin-modal-body {
|
||||
@apply px-5 sm:px-8 py-5 space-y-5 overflow-y-auto flex-1;
|
||||
}
|
||||
|
||||
.admin-modal-footer {
|
||||
@apply px-5 sm:px-8 py-4 border-t border-default flex justify-end gap-3 bg-surface rounded-b-2xl shrink-0;
|
||||
}
|
||||
|
||||
.admin-modal-footer--muted {
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.admin-dropdown {
|
||||
@apply absolute z-20 mt-2 max-h-64 overflow-auto rounded-xl border border-default bg-surface shadow-elevated;
|
||||
}
|
||||
|
||||
.admin-code-block {
|
||||
@apply p-3 rounded-lg border border-default text-sm font-mono break-all;
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-pre-block {
|
||||
@apply mt-1 max-h-[200px] overflow-auto whitespace-pre-wrap rounded-lg border border-default p-2 font-mono text-[10px];
|
||||
background-color: var(--bg-surface-strong);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.admin-pre-block--sql {
|
||||
@apply mt-1 max-h-none overflow-auto whitespace-pre-wrap rounded-lg border border-default p-3 font-mono text-xs text-emerald-600;
|
||||
background-color: var(--bg-surface-strong);
|
||||
}
|
||||
|
||||
html.dark .admin-pre-block--sql {
|
||||
color: #6ee7b7;
|
||||
}
|
||||
|
||||
.admin-checkbox {
|
||||
@apply w-4 h-4 cursor-pointer rounded border-default text-brand-600 focus:ring-brand-500;
|
||||
}
|
||||
|
||||
.admin-checkbox-lg {
|
||||
@apply w-5 h-5 cursor-pointer rounded border-default text-blue-600 focus:ring-blue-500;
|
||||
}
|
||||
|
||||
/* Segment control — toggle / single-choice (not action buttons) */
|
||||
.segment-control {
|
||||
@apply inline-flex max-w-full flex-wrap gap-2;
|
||||
}
|
||||
|
||||
/* 2–3 个短选项:独立细边框芯片 */
|
||||
.segment-control--chips {
|
||||
@apply gap-2;
|
||||
}
|
||||
|
||||
/* 等分宽、独立细边框(如 Cron 四选一)— 无共用轨道 */
|
||||
.segment-control--chips-equal {
|
||||
@apply flex w-full flex-nowrap gap-2;
|
||||
}
|
||||
|
||||
.segment-control--chips-equal .segment-item {
|
||||
@apply min-w-0 flex-1 justify-center text-center;
|
||||
}
|
||||
|
||||
.segment-item {
|
||||
@apply shrink-0 cursor-pointer whitespace-nowrap rounded-xl border px-3 py-2 text-sm font-semibold transition-colors duration-200;
|
||||
color: var(--text-secondary);
|
||||
background-color: var(--bg-surface);
|
||||
border-color: var(--border-default);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.segment-item:hover:not(.segment-item--active) {
|
||||
color: var(--text-primary);
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.segment-item--active {
|
||||
color: #0284c7;
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface));
|
||||
border-color: color-mix(in srgb, #0ea5e9 38%, var(--border-default));
|
||||
}
|
||||
|
||||
html.dark .segment-item--active {
|
||||
color: #7dd3fc;
|
||||
background-color: color-mix(in srgb, #0ea5e9 20%, var(--bg-surface));
|
||||
border-color: color-mix(in srgb, #38bdf8 45%, var(--border-default));
|
||||
}
|
||||
|
||||
.segment-control--sm .segment-item {
|
||||
@apply px-3 py-1.5 text-xs;
|
||||
}
|
||||
|
||||
.segment-control--md .segment-item {
|
||||
@apply px-4 py-2.5 text-sm;
|
||||
}
|
||||
|
||||
/* @deprecated — use .segment-control + .segment-item */
|
||||
.btn-segment-group {
|
||||
@apply segment-control segment-control--chips segment-control--sm;
|
||||
}
|
||||
|
||||
.btn-segment-group .btn-segment {
|
||||
@apply segment-item;
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-segment-group .btn-segment.btn-segment--active {
|
||||
@apply segment-item--active;
|
||||
}
|
||||
|
||||
/* KB admin panel (embedded in AdminView) */
|
||||
.kb-admin-header {
|
||||
@apply flex flex-col gap-4 border-b border-default bg-surface px-8 py-6 lg:flex-row lg:items-start lg:justify-between;
|
||||
}
|
||||
|
||||
.kb-admin-toolbar {
|
||||
@apply inline-flex w-full items-stretch divide-x divide-subtle overflow-hidden rounded-xl border border-default sm:w-auto;
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.kb-admin-toolbar-btn {
|
||||
@apply inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors sm:flex-none sm:px-4;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.kb-admin-toolbar-btn:hover {
|
||||
background-color: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.kb-admin-body {
|
||||
@apply grid grid-cols-1 gap-6 bg-surface p-8 xl:grid-cols-[420px_minmax(0,1fr)];
|
||||
}
|
||||
|
||||
.kb-admin-section {
|
||||
@apply admin-panel p-6;
|
||||
}
|
||||
|
||||
.kb-admin-card {
|
||||
@apply admin-panel px-4 py-4;
|
||||
}
|
||||
|
||||
.kb-admin-empty {
|
||||
@apply rounded-2xl border border-dashed px-4 py-10 text-center text-sm text-muted;
|
||||
border-color: var(--border-default);
|
||||
background-color: var(--bg-surface-soft);
|
||||
}
|
||||
|
||||
.kb-admin-badge {
|
||||
@apply rounded-full bg-surface-soft px-2.5 py-1 text-xs font-medium text-secondary shrink-0;
|
||||
}
|
||||
|
||||
/* Chat — L2 */
|
||||
.chat-sidebar-btn {
|
||||
@apply flex w-full items-center justify-center gap-2 rounded-xl border border-default bg-surface-soft py-3 text-sm font-medium text-secondary shadow-sm transition-colors hover-surface-strong;
|
||||
}
|
||||
|
||||
.chat-sidebar-btn-icon {
|
||||
@apply flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-surface-soft text-secondary shadow-sm transition-colors hover-surface-strong;
|
||||
}
|
||||
|
||||
.chat-history-item {
|
||||
@apply relative flex w-full items-center justify-between rounded-lg transition-colors hover-surface-soft;
|
||||
}
|
||||
|
||||
.chat-history-item--active {
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft));
|
||||
}
|
||||
|
||||
.chat-history-link {
|
||||
@apply flex-1 truncate px-3 py-2.5 text-left text-sm pr-8 text-secondary;
|
||||
}
|
||||
|
||||
.chat-history-link--active {
|
||||
@apply font-medium text-brand-700;
|
||||
}
|
||||
|
||||
html.dark .chat-history-link--active {
|
||||
color: #7dd3fc;
|
||||
}
|
||||
|
||||
.chat-dropdown {
|
||||
@apply absolute z-50 rounded-xl border border-default bg-surface py-1 shadow-elevated;
|
||||
}
|
||||
|
||||
.chat-msg-assistant {
|
||||
@apply w-full rounded-2xl border border-default bg-surface px-6 py-4 text-[15px] leading-relaxed text-primary shadow-sm;
|
||||
}
|
||||
|
||||
.chat-agent-panel {
|
||||
@apply mb-4 rounded-2xl border border-default p-3;
|
||||
background-color: color-mix(in srgb, var(--bg-surface-soft) 85%, transparent);
|
||||
}
|
||||
|
||||
.chat-icon-muted {
|
||||
@apply text-muted transition-colors hover:text-secondary;
|
||||
}
|
||||
|
||||
/* Workspace logged-in — L3 main + L2 nav (reuse admin-nav rhythm) */
|
||||
.ws-main {
|
||||
@apply min-w-0 section-gap bg-page page-shell-mobile md:py-8 lg:px-8;
|
||||
}
|
||||
|
||||
.ws-nav-btn {
|
||||
@apply flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.ws-nav-btn:hover:not(.ws-nav-btn--active) {
|
||||
background-color: var(--bg-surface-soft);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.ws-nav-btn--active {
|
||||
background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft));
|
||||
color: #0284c7;
|
||||
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
||||
}
|
||||
|
||||
html.dark .ws-nav-btn--active {
|
||||
color: #7dd3fc;
|
||||
outline: 1px solid color-mix(in srgb, #0ea5e9 25%, transparent);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
.ws-nav-btn--danger {
|
||||
@apply text-red-500 hover:bg-red-50 hover:text-red-600;
|
||||
}
|
||||
|
||||
html.dark .ws-nav-btn--danger {
|
||||
@apply text-red-400 hover:bg-red-950/40 hover:text-red-300;
|
||||
}
|
||||
|
||||
.ws-card {
|
||||
@apply admin-panel-lg px-6 py-6 shadow-sm md:px-8;
|
||||
}
|
||||
|
||||
.ws-history-card {
|
||||
@apply w-full admin-panel p-3 text-left transition-colors hover:border-brand-300;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.ws-history-card:hover {
|
||||
background-color: color-mix(in srgb, #0ea5e9 8%, var(--bg-surface));
|
||||
}
|
||||
|
||||
/* Shared dialogs — app-wide (Dify, delete confirm, feedback, file preview) */
|
||||
.dialog-overlay {
|
||||
@apply fixed inset-0 flex items-start sm:items-center justify-center p-3 sm:p-4 overflow-y-auto bg-overlay backdrop-blur-sm;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.dialog-overlay--z80 {
|
||||
z-index: 80;
|
||||
}
|
||||
|
||||
.dialog-overlay--z110 {
|
||||
z-index: 110;
|
||||
}
|
||||
|
||||
.dialog-panel {
|
||||
@apply card w-full shadow-elevated flex flex-col;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
@apply flex items-center justify-between gap-4 border-b border-default shrink-0 px-5 py-4 sm:px-8 sm:pt-7 sm:pb-4;
|
||||
}
|
||||
|
||||
.dialog-header--compact {
|
||||
@apply px-6 py-4;
|
||||
}
|
||||
|
||||
.dialog-body {
|
||||
@apply overflow-y-auto flex-1 px-5 py-5 sm:px-8 form-stack;
|
||||
}
|
||||
|
||||
.dialog-body--flush {
|
||||
@apply px-0 py-0;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
@apply flex justify-end gap-3 border-t border-default shrink-0 px-5 py-4 sm:px-8 rounded-b-2xl;
|
||||
background-color: var(--bg-surface);
|
||||
}
|
||||
|
||||
.dialog-stat-card {
|
||||
@apply admin-panel px-4 py-4;
|
||||
}
|
||||
|
||||
.dialog-preview-body {
|
||||
@apply flex-1 overflow-auto p-4 bg-page;
|
||||
}
|
||||
|
||||
.dialog-preview-frame {
|
||||
@apply bg-surface border border-default rounded-lg;
|
||||
}
|
||||
|
||||
.dialog-icon-warning {
|
||||
@apply inline-flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full text-sm font-semibold leading-none mt-0.5;
|
||||
background-color: var(--status-warning-bg);
|
||||
color: var(--status-warning-fg);
|
||||
border: 1px solid var(--status-warning-border);
|
||||
}
|
||||
|
||||
.theme-toggle-btn {
|
||||
@apply flex items-center justify-center rounded-full border border-default backdrop-blur-md transition-all text-muted hover:text-primary hover:shadow-md;
|
||||
background-color: color-mix(in srgb, var(--bg-surface) 88%, transparent);
|
||||
}
|
||||
|
||||
.theme-toggle-btn--inline {
|
||||
@apply h-8 w-8 md:h-9 md:w-9 shadow-sm;
|
||||
}
|
||||
|
||||
.theme-toggle-btn--floating {
|
||||
@apply fixed bottom-5 right-5 z-[70] h-11 w-11 shadow-lg hover:shadow-xl;
|
||||
}
|
||||
|
||||
/* KB Workspace */
|
||||
.kb-ws-section {
|
||||
@apply admin-panel-lg p-6;
|
||||
}
|
||||
|
||||
.kb-ws-card {
|
||||
@apply admin-panel p-4 transition-colors h-full min-h-[260px] flex flex-col;
|
||||
}
|
||||
|
||||
.kb-ws-card--interactive {
|
||||
@apply kb-ws-card cursor-pointer hover:border-brand-300;
|
||||
}
|
||||
|
||||
.kb-ws-stat-grid {
|
||||
@apply mb-6 grid grid-cols-2 gap-3 admin-panel-lg p-4 md:grid-cols-4 xl:grid-cols-7;
|
||||
}
|
||||
|
||||
.kb-ws-stat-tile {
|
||||
@apply admin-stat-tile text-center transition-colors;
|
||||
}
|
||||
|
||||
.kb-ws-group-list-btn {
|
||||
@apply w-full admin-panel px-4 py-4 text-left transition-all;
|
||||
}
|
||||
|
||||
.kb-ws-group-list-btn--active {
|
||||
border-color: color-mix(in srgb, #0ea5e9 40%, var(--border-default));
|
||||
background-color: color-mix(in srgb, #0ea5e9 10%, var(--bg-surface-soft));
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
html.dark .kb-ws-group-list-btn--active {
|
||||
color: #7dd3fc;
|
||||
}
|
||||
|
||||
.kb-ws-badge-count {
|
||||
@apply kb-admin-badge;
|
||||
}
|
||||
|
||||
.kb-ws-icon-btn {
|
||||
@apply btn-icon-ds rounded-2xl border border-default;
|
||||
}
|
||||
|
||||
.kb-ws-tooltip {
|
||||
@apply pointer-events-none absolute left-0 top-8 z-10 hidden w-80 admin-panel px-4 py-3 text-sm text-muted shadow-elevated group-hover:block;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* L1 Design Tokens — single source for light/dark colors.
|
||||
* Toggle theme via html.dark (useTheme); do not duplicate values in components.
|
||||
*/
|
||||
:root {
|
||||
/* Surfaces */
|
||||
--bg-page: #f8fafc;
|
||||
--bg-surface: #ffffff;
|
||||
--bg-surface-soft: #f8fafc;
|
||||
--bg-surface-strong: #f1f5f9;
|
||||
|
||||
/* Text */
|
||||
--text-primary: #0f172a;
|
||||
--text-secondary: #334155;
|
||||
--text-muted: #64748b;
|
||||
|
||||
/* Borders & effects */
|
||||
--border-default: #e2e8f0;
|
||||
--border-subtle: #f1f5f9;
|
||||
--overlay-soft: rgba(15, 23, 42, 0.4);
|
||||
--shadow-elevated: 0 8px 30px -12px rgba(15, 23, 42, 0.2);
|
||||
--glow-accent: 0 0 0 1px rgba(14, 165, 233, 0.18), 0 16px 40px -22px rgba(14, 165, 233, 0.45);
|
||||
--focus-ring: rgba(14, 165, 233, 0.35);
|
||||
|
||||
/* Status — backgrounds & foregrounds */
|
||||
--status-success-bg: #eef8e8;
|
||||
--status-success-border: #b7e2a7;
|
||||
--status-success-fg: #389e0d;
|
||||
--status-info-bg: #eaf4ff;
|
||||
--status-info-border: #9fcbff;
|
||||
--status-info-fg: #1677ff;
|
||||
--status-warning-bg: #fff8e8;
|
||||
--status-warning-border: #ffd88a;
|
||||
--status-warning-fg: #d48806;
|
||||
--status-error-bg: #fff1f0;
|
||||
--status-error-border: #ffb3b0;
|
||||
--status-error-fg: #cf1322;
|
||||
|
||||
/* L3 layout constants */
|
||||
--header-height: 3.5rem;
|
||||
--sidebar-width: 16rem;
|
||||
--sidebar-collapsed-width: 4rem;
|
||||
--content-max-width: 80rem;
|
||||
|
||||
/* Spacing rhythm (L2/L3 reference — prefer semantic classes over raw gap-*) */
|
||||
--space-page-x: 1rem;
|
||||
--space-page-x-md: 2rem;
|
||||
--space-section: 1.5rem;
|
||||
--space-section-lg: 2rem;
|
||||
--space-card: 1.5rem;
|
||||
--space-form: 1rem;
|
||||
--radius-control: 0.75rem;
|
||||
--radius-surface: 1rem;
|
||||
|
||||
--glass-panel-bg: rgba(255, 255, 255, 0.68);
|
||||
--glass-panel-border: rgba(148, 163, 184, 0.26);
|
||||
--chat-composer-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.97) 100%);
|
||||
--chat-composer-shadow: 0 14px 28px -20px rgba(15, 23, 42, 0.38);
|
||||
--chat-composer-shadow-focus: 0 16px 34px -22px rgba(14, 165, 233, 0.45);
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
|
||||
--bg-page: #020617;
|
||||
--bg-surface: #0b1220;
|
||||
--bg-surface-soft: #0f172a;
|
||||
--bg-surface-strong: #1e293b;
|
||||
|
||||
--text-primary: #f8fafc;
|
||||
--text-secondary: #cbd5e1;
|
||||
--text-muted: #94a3b8;
|
||||
|
||||
--border-default: #334155;
|
||||
--border-subtle: #1e293b;
|
||||
--overlay-soft: rgba(2, 6, 23, 0.72);
|
||||
--shadow-elevated: 0 12px 30px -16px rgba(2, 6, 23, 0.85);
|
||||
--glow-accent: 0 0 0 1px rgba(56, 189, 248, 0.28), 0 20px 44px -24px rgba(56, 189, 248, 0.5);
|
||||
--focus-ring: rgba(56, 189, 248, 0.4);
|
||||
|
||||
--status-success-bg: rgba(34, 197, 94, 0.12);
|
||||
--status-success-border: rgba(34, 197, 94, 0.35);
|
||||
--status-success-fg: #86efac;
|
||||
--status-info-bg: rgba(56, 189, 248, 0.12);
|
||||
--status-info-border: rgba(56, 189, 248, 0.35);
|
||||
--status-info-fg: #7dd3fc;
|
||||
--status-warning-bg: rgba(250, 204, 21, 0.12);
|
||||
--status-warning-border: rgba(250, 204, 21, 0.35);
|
||||
--status-warning-fg: #fde047;
|
||||
--status-error-bg: rgba(239, 68, 68, 0.12);
|
||||
--status-error-border: rgba(239, 68, 68, 0.35);
|
||||
--status-error-fg: #fca5a5;
|
||||
|
||||
--glass-panel-bg: rgba(2, 6, 23, 0.66);
|
||||
--glass-panel-border: rgba(71, 85, 105, 0.5);
|
||||
--chat-composer-gradient: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(10, 16, 30, 0.92) 100%);
|
||||
--chat-composer-shadow: 0 18px 36px -28px rgba(2, 6, 23, 0.96);
|
||||
--chat-composer-shadow-focus: 0 16px 34px -22px rgba(56, 189, 248, 0.45);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* L1 semantic utilities — use these instead of bg-white dark:bg-slate-900 pairs.
|
||||
*/
|
||||
@layer utilities {
|
||||
.bg-page { background-color: var(--bg-page); }
|
||||
.bg-surface { background-color: var(--bg-surface); }
|
||||
.bg-surface-soft { background-color: var(--bg-surface-soft); }
|
||||
.bg-surface-strong { background-color: var(--bg-surface-strong); }
|
||||
|
||||
.text-primary { color: var(--text-primary); }
|
||||
.text-secondary { color: var(--text-secondary); }
|
||||
.text-muted { color: var(--text-muted); }
|
||||
|
||||
.border-default { border-color: var(--border-default); }
|
||||
.border-subtle { border-color: var(--border-subtle); }
|
||||
|
||||
.shadow-elevated { box-shadow: var(--shadow-elevated); }
|
||||
|
||||
.bg-overlay { background-color: var(--overlay-soft); }
|
||||
|
||||
.hover-surface-soft:hover { background-color: var(--bg-surface-soft); }
|
||||
.hover-surface-strong:hover { background-color: var(--bg-surface-strong); }
|
||||
|
||||
.divide-subtle > :not([hidden]) ~ :not([hidden]) {
|
||||
border-color: var(--border-subtle);
|
||||
}
|
||||
}
|
||||
+840
-827
File diff suppressed because it is too large.
Load diff
+200
-198
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
@@ -27,6 +27,7 @@ import { getAuthHeaders, getStoredAuthUser, logoutAuth } from '../utils/auth';
|
||||
import { copyTextToClipboard } from '../utils/clipboard';
|
||||
import { setLastChatAgentId } from '../utils/lastChatAgent';
|
||||
import { openAgentChatTab, registerOpenAgentId } from '../utils/agentTabs';
|
||||
import ChatShell from '../layouts/ChatShell.vue';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const { appliedTheme, toggleLightDark } = useTheme();
|
||||
@@ -2079,16 +2080,19 @@ const showChatRating = ref(false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative flex h-screen overflow-hidden bg-slate-50 text-slate-800 dark:bg-slate-950 dark:text-slate-100">
|
||||
<div
|
||||
v-if="isSidebarOpen && !isMobile"
|
||||
class="fixed inset-0 z-40 bg-slate-900/55 backdrop-blur-sm transition-opacity md:hidden"
|
||||
@click="isSidebarOpen = false"
|
||||
></div>
|
||||
<ChatShell>
|
||||
<template #overlay>
|
||||
<div
|
||||
v-if="isSidebarOpen && !isMobile"
|
||||
class="fixed inset-0 z-40 bg-overlay backdrop-blur-sm transition-opacity md:hidden"
|
||||
@click="isSidebarOpen = false"
|
||||
></div>
|
||||
</template>
|
||||
|
||||
<template #sidebar>
|
||||
<aside
|
||||
v-if="!isMobile"
|
||||
class="glass-panel fixed inset-y-0 left-0 z-50 flex h-full flex-col border-r bg-white transition-all duration-300 ease-in-out dark:bg-slate-950 md:relative md:translate-x-0"
|
||||
class="glass-panel fixed inset-y-0 left-0 z-50 flex h-full flex-col border-r border-default bg-surface transition-all duration-300 ease-in-out md:relative md:translate-x-0"
|
||||
:class="[
|
||||
isSidebarOpen ? 'translate-x-0 w-[86vw] max-w-[300px]' : '-translate-x-full w-[86vw] max-w-[300px]',
|
||||
isSidebarCollapsed ? 'md:w-[72px]' : 'md:w-80'
|
||||
@@ -2096,7 +2100,7 @@ const showChatRating = ref(false);
|
||||
>
|
||||
<template v-if="isSidebarCollapsed">
|
||||
<div class="flex h-full w-full flex-col items-center py-4">
|
||||
<button @click="isSidebarCollapsed = false" class="mb-6 text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button @click="isSidebarCollapsed = false" class="mb-6 text-muted transition-colors hover:text-secondary">
|
||||
<PanelLeftOpen class="h-5 w-5" />
|
||||
</button>
|
||||
|
||||
@@ -2104,17 +2108,17 @@ const showChatRating = ref(false);
|
||||
<Sparkles class="h-5 w-5" />
|
||||
</div>
|
||||
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" :title="$t('chat.createNewChat')">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="chat-sidebar-btn-icon" :title="$t('chat.createNewChat')">
|
||||
<Plus class="h-5 w-5" />
|
||||
</button>
|
||||
|
||||
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-slate-400">
|
||||
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Sparkles class="h-5 w-5" /></button>
|
||||
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-muted">
|
||||
<button class="transition-colors hover:text-secondary"><Sparkles class="h-5 w-5" /></button>
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20">
|
||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-5 w-5" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-secondary" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-5 w-5" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-secondary" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2123,47 +2127,45 @@ const showChatRating = ref(false);
|
||||
<div class="flex items-center justify-between p-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-sm font-bold text-white shadow-sm shadow-brand-500/25">AI</div>
|
||||
<span class="font-bold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<span class="font-bold text-primary">{{ currentAgent?.name || 'AI' }}</span>
|
||||
</div>
|
||||
<button @click="isSidebarCollapsed = true" class="text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button @click="isSidebarCollapsed = true" class="text-muted transition-colors hover:text-secondary">
|
||||
<PanelLeftClose class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="px-4 pb-4">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 py-3 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="chat-sidebar-btn">
|
||||
<Plus class="h-4 w-4" /> {{ $t('chat.createNewChat') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between px-4 py-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.history') }}</span>
|
||||
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.history') }}</span>
|
||||
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-muted transition-colors hover:text-secondary">
|
||||
{{ $t('chat.clearAll') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-2 scrollbar-thin">
|
||||
<div v-if="history.length === 0" class="py-8 text-center text-sm italic text-slate-400">{{ $t('chat.noHistory') }}</div>
|
||||
<div v-if="history.length === 0" class="py-8 text-center text-sm italic text-muted">{{ $t('chat.noHistory') }}</div>
|
||||
<div v-else class="space-y-0.5">
|
||||
<div
|
||||
v-for="item in history"
|
||||
:key="item.conversation_id"
|
||||
class="group relative flex w-full items-center justify-between rounded-lg transition-colors"
|
||||
:class="conversationId === item.conversation_id ? 'bg-brand-50 dark:bg-brand-900/20' : 'hover:bg-slate-50 dark:hover:bg-slate-800/50'"
|
||||
class="chat-history-item"
|
||||
:class="{ 'chat-history-item--active': conversationId === item.conversation_id }"
|
||||
>
|
||||
<button
|
||||
class="flex-1 truncate px-3 py-2.5 text-left text-sm pr-8"
|
||||
:class="conversationId === item.conversation_id
|
||||
? 'font-medium text-brand-700 dark:text-brand-300'
|
||||
: 'text-slate-600 dark:text-slate-300'"
|
||||
class="chat-history-link"
|
||||
:class="{ 'chat-history-link--active': conversationId === item.conversation_id }"
|
||||
@click="loadConversation(item.conversation_id); isSidebarOpen = false;"
|
||||
>
|
||||
{{ item.title || $t('chat.newChat') }}
|
||||
</button>
|
||||
<button
|
||||
@click="deleteHistoryItem(item.conversation_id, $event)"
|
||||
class="absolute right-2 p-1.5 text-slate-400 opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100 dark:hover:text-red-400"
|
||||
class="absolute right-2 p-1.5 text-muted opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100"
|
||||
:title="$t('chat.clearOneRecord')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
@@ -2173,8 +2175,8 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<div class="mt-auto flex flex-col p-4">
|
||||
<div v-if="userAgents.length > 0 && showAgentPanel" class="mb-4 rounded-2xl border border-slate-200 bg-slate-50/70 p-3 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-slate-500 dark:text-slate-400">
|
||||
<div v-if="userAgents.length > 0 && showAgentPanel" class="chat-agent-panel">
|
||||
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-muted">
|
||||
<LayoutGrid class="h-3.5 w-3.5" /> {{ $t('chat.agents') }}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-x-2 gap-y-1.5">
|
||||
@@ -2182,37 +2184,37 @@ const showChatRating = ref(false);
|
||||
v-for="agent in userAgents"
|
||||
:key="agent.id"
|
||||
@click="switchToAgent(agent)"
|
||||
class="grid w-full min-w-0 grid-cols-[1rem_1fr] items-center gap-1.5 rounded-xl px-2 py-2 text-left text-xs font-medium text-slate-600 transition-colors hover:bg-white hover:shadow-sm dark:text-slate-200 dark:hover:bg-slate-700/50"
|
||||
class="grid w-full min-w-0 grid-cols-[1rem_1fr] items-center gap-1.5 rounded-xl px-2 py-2 text-left text-xs font-medium text-secondary transition-colors hover-surface-soft hover:shadow-sm"
|
||||
>
|
||||
<div v-if="agent.icon_url" class="h-4 w-4 shrink-0 rounded bg-contain bg-center bg-no-repeat" :style="{ backgroundImage: `url(${agent.icon_url})` }"></div>
|
||||
<div v-else class="flex h-4 w-4 shrink-0 items-center justify-center rounded bg-brand-100 text-[9px] font-bold text-brand-600 dark:bg-brand-900/30 dark:text-brand-400">{{ agent.name.charAt(0) }}</div>
|
||||
<div v-else class="flex h-4 w-4 shrink-0 items-center justify-center rounded bg-brand-100 text-[9px] font-bold text-brand-600">{{ agent.name.charAt(0) }}</div>
|
||||
<span class="min-w-0 truncate">{{ agent.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bottom Icons -->
|
||||
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
||||
<div class="flex items-center justify-between text-muted relative" ref="userMenuRef">
|
||||
<button @click="showUserDropdown = !showUserDropdown" class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20 hover:bg-brand-700 transition-colors">
|
||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||
</button>
|
||||
|
||||
<!-- User Dropdown Menu -->
|
||||
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-xl border border-slate-100 dark:border-slate-700 py-1 z-50 animate-fade-in">
|
||||
<div class="px-4 py-3 border-b border-slate-50 dark:border-slate-700 flex items-center gap-3">
|
||||
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-surface rounded-xl shadow-xl border border-subtle py-1 z-50 animate-fade-in">
|
||||
<div class="px-4 py-3 border-b border-subtle flex items-center gap-3">
|
||||
<div class="w-10 h-10 bg-brand-600 rounded-full flex items-center justify-center text-white font-bold text-lg shrink-0 shadow-sm shadow-brand-500/20">
|
||||
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 truncate">{{ currentUser?.username || 'User' }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-else class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ currentUser?.role }}</div>
|
||||
<div class="text-sm font-bold text-primary truncate">{{ currentUser?.username || 'User' }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-muted truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-else class="text-xs text-muted truncate">{{ currentUser?.role }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 px-4 py-2">
|
||||
<span class="shrink-0 text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('chat.language') }}</span>
|
||||
<select v-model="locale" class="min-w-0 flex-1 rounded-lg border border-slate-200 bg-slate-50 px-2 py-1 text-xs text-slate-700 outline-none transition focus:border-brand-400 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200">
|
||||
<span class="shrink-0 text-xs font-medium text-muted">{{ $t('chat.language') }}</span>
|
||||
<select v-model="locale" class="min-w-0 flex-1 rounded-lg border border-default bg-surface-soft px-2 py-1 text-xs text-secondary outline-none transition focus:border-brand-400">
|
||||
<option value="zh-CN">简体中文</option>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
@@ -2220,71 +2222,70 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button @click="handleLogout" class="flex w-full items-center gap-2 border-t border-slate-50 px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50 dark:border-slate-700/50 dark:hover:bg-red-950/30">
|
||||
<button @click="handleLogout" class="flex w-full items-center gap-2 border-t border-slate-50 px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50">
|
||||
<LogOut class="w-4 h-4" />
|
||||
{{ $t('chat.logout') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Heart class="h-4 w-4" /></button> -->
|
||||
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Bell class="h-4 w-4" /></button> -->
|
||||
<button @click="toggleLightDark" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="appliedTheme === 'dark' ? ($t('theme.switchToLight') || 'Switch to light mode') : ($t('theme.switchToDark') || 'Switch to dark mode')">
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600' : ''" class="transition-colors hover:text-secondary" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<!-- <button class="transition-colors hover:text-secondary"><Heart class="h-4 w-4" /></button> -->
|
||||
<!-- <button class="transition-colors hover:text-secondary"><Bell class="h-4 w-4" /></button> -->
|
||||
<button @click="toggleLightDark" class="transition-colors hover:text-secondary" :title="appliedTheme === 'dark' ? ($t('theme.switchToLight') || 'Switch to light mode') : ($t('theme.switchToDark') || 'Switch to dark mode')">
|
||||
<Sun v-if="appliedTheme === 'dark'" class="h-4 w-4" />
|
||||
<Moon v-else class="h-4 w-4" />
|
||||
</button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-4 w-4" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-secondary" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-4 w-4" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-secondary" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-white dark:bg-slate-950">
|
||||
|
||||
<header v-if="isMobile && currentAgent" class="flex items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-slate-800">
|
||||
<header v-if="isMobile && currentAgent" class="flex items-center justify-between border-b border-default bg-surface px-4 py-2.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20">AI</div>
|
||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<span class="text-sm font-semibold text-primary">{{ currentAgent?.name || 'AI' }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.agents')">
|
||||
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition-colors hover-surface-soft" :title="$t('chat.agents')">
|
||||
<LayoutGrid class="h-5 w-5" />
|
||||
</button>
|
||||
<button @click="goToWorkspace('history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.history')">
|
||||
<button @click="goToWorkspace('history')" class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition-colors hover-surface-soft" :title="$t('chat.history')">
|
||||
<History class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-slate-800">
|
||||
<div class="mb-2 text-xs font-medium text-slate-400">{{ $t('chat.agents') }}</div>
|
||||
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-default bg-surface p-3 shadow-xl">
|
||||
<div class="mb-2 text-xs font-medium text-muted">{{ $t('chat.agents') }}</div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<button
|
||||
v-for="agent in userAgents"
|
||||
:key="agent.id"
|
||||
@click="switchToAgent(agent); showMobileAgentPopover = false"
|
||||
class="flex flex-col items-center gap-1.5 rounded-xl px-2 py-3 text-center transition-colors hover:bg-slate-100 dark:hover:bg-slate-700"
|
||||
class="flex flex-col items-center gap-1.5 rounded-xl px-2 py-3 text-center transition-colors hover-surface-soft"
|
||||
>
|
||||
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-sm font-bold text-brand-600 dark:bg-brand-900/30">
|
||||
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-sm font-bold text-brand-600">
|
||||
{{ agent.name.charAt(0) }}
|
||||
</div>
|
||||
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
|
||||
<span class="w-full truncate text-xs font-medium text-secondary">{{ agent.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">{{ $t('chat.noOtherAgents') }}</div>
|
||||
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-muted">{{ $t('chat.noOtherAgents') }}</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="!currentAgent" class="flex flex-1 flex-col items-center justify-center space-y-4">
|
||||
<Loader2 class="h-10 w-10 animate-spin text-brand-500" />
|
||||
<p class="text-sm animate-pulse text-slate-500 dark:text-slate-300">{{ $t('chat.loadingAgent') }}</p>
|
||||
<p class="text-sm animate-pulse text-muted">{{ $t('chat.loadingAgent') }}</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="currentAgent.type === 'iframe'" class="relative h-full w-full flex-1">
|
||||
<iframe
|
||||
:src="currentAgent.extra_config?.iframe_url"
|
||||
class="h-full w-full border-0 bg-white dark:bg-slate-950"
|
||||
class="h-full w-full border-0 bg-surface"
|
||||
allow="microphone; camera; clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
@@ -2304,7 +2305,7 @@ const showChatRating = ref(false);
|
||||
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-2xl font-bold text-white shadow-lg shadow-brand-500/20">
|
||||
AI
|
||||
</div>
|
||||
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
|
||||
<h2 class="text-center text-xl font-medium text-primary md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
|
||||
</div>
|
||||
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
@@ -2322,7 +2323,7 @@ const showChatRating = ref(false);
|
||||
class="text-[15px] leading-relaxed"
|
||||
:class="msg.role === 'user'
|
||||
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||
: 'w-full rounded-2xl border border-slate-200 bg-white px-6 py-4 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-100'"
|
||||
: 'chat-msg-assistant'"
|
||||
>
|
||||
<div
|
||||
v-if="msg.role === 'user'"
|
||||
@@ -2330,42 +2331,42 @@ const showChatRating = ref(false);
|
||||
>{{ msg.content }}</div>
|
||||
<div v-else>
|
||||
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
<div class="text-sm font-medium text-secondary">
|
||||
{{ $t('chat.leaveFormIntro') }} <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">{{ $t('chat.oaLeaveDirectLink') }}</a>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveFiller') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.fillerName"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.employeeId') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.createdAt') }}</span>
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveType') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.leaveType"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@change="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
>
|
||||
@@ -2374,20 +2375,20 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveApplicant') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
|
||||
type="text"
|
||||
:placeholder="$t('chat.selectLeaveApplicant')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default bg-surface px-3 py-2 pr-11 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-muted transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||
:title="$t('chat.pickLeaveApplicant')"
|
||||
@@ -2397,20 +2398,20 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveAgent') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
|
||||
type="text"
|
||||
:placeholder="$t('chat.selectLeaveAgent')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default bg-surface px-3 py-2 pr-11 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg)"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-muted transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg)"
|
||||
:title="$t('chat.pickLeaveAgent')"
|
||||
@@ -2420,39 +2421,39 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.startTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
||||
type="datetime-local"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.endTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
||||
type="datetime-local"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.duration') }}</span>
|
||||
<input
|
||||
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours, getLeaveFormPayload(msg)!.form.leaveType)"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.isOutOfOffice') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isOutOfOffice"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
@@ -2460,10 +2461,10 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5 md:col-span-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.isWorkInjury') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isWorkInjury"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
@@ -2471,58 +2472,58 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
|
||||
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700">
|
||||
{{ $t('chat.leaveConfirmGenerated') }}
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button
|
||||
@click="submitLeaveForm(msg)"
|
||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
||||
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
class="btn-primary btn-sm disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ getLeaveFormPayload(msg)?.submitting ? $t('chat.submitting') : $t('chat.submit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="msg.type === 'leave-confirmation' && getLeaveConfirmationPayload(msg)" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">{{ msg.content }}</div>
|
||||
<div class="rounded-2xl border border-slate-200 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveFillerInfo') }}</div>
|
||||
<div class="text-sm font-medium text-secondary">{{ msg.content }}</div>
|
||||
<div class="rounded-2xl border border-default bg-surface-soft/90 p-4">
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveFillerInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-muted">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-muted">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveApplicantInfo') }}</div>
|
||||
<div class="my-3 border-t border-default"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveApplicantInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-muted">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-muted">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveInfo') }}</div>
|
||||
<div class="my-3 border-t border-default"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours, getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-muted">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-muted">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours, getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button
|
||||
v-if="!getLeaveConfirmationPayload(msg)?.submitting && !getLeaveConfirmationPayload(msg)?.confirmed"
|
||||
@click="editLeaveConfirmation(msg, index)"
|
||||
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
class="rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ $t('chat.backToEdit') }}
|
||||
</button>
|
||||
@@ -2539,8 +2540,8 @@ const showChatRating = ref(false);
|
||||
<div
|
||||
class="rounded-2xl border px-4 py-4"
|
||||
:class="getLeaveResultPayload(msg)!.success
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-100'
|
||||
: 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-100'"
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-800'
|
||||
: 'border-rose-200 bg-rose-50 text-rose-800'"
|
||||
>
|
||||
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? $t('chat.oaSubmitResult') : $t('chat.oaSubmitFailed') }}</div>
|
||||
<div v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
|
||||
@@ -2548,7 +2549,7 @@ const showChatRating = ref(false);
|
||||
<a
|
||||
href="#"
|
||||
@click.prevent="openOARequestDirectly(getLeaveResultPayload(msg)!.referenceNo)"
|
||||
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline"
|
||||
>
|
||||
{{ $t('chat.leaveResultLinkText') }}
|
||||
</a>
|
||||
@@ -2560,7 +2561,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-slate-800 dark:text-slate-100 prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 dark:prose-code:bg-slate-800 dark:prose-code:text-blue-300 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100"
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100"
|
||||
@click="handleChatMarkdownClick"
|
||||
v-html="renderMarkdown(msg.content)"
|
||||
></div>
|
||||
@@ -2577,7 +2578,7 @@ const showChatRating = ref(false);
|
||||
v-for="(file, linkIndex) in getSourceLinks(getDisplayRetrieverResources(msg))"
|
||||
:key="`src-link-top-${linkIndex}-${file.url}`"
|
||||
@click="openPreview(file)"
|
||||
class="break-all rounded-lg border border-brand-200 bg-brand-50 px-2.5 py-1.5 text-xs text-brand-700 transition-colors hover:bg-brand-100 dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||
class="break-all rounded-lg border border-brand-200 bg-brand-50 px-2.5 py-1.5 text-xs text-brand-700 transition-colors hover:bg-brand-100"
|
||||
>
|
||||
{{ file.name }}
|
||||
</button>
|
||||
@@ -2585,38 +2586,38 @@ const showChatRating = ref(false);
|
||||
|
||||
<details
|
||||
v-if="getDisplayRetrieverResources(msg).length > 0"
|
||||
class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65"
|
||||
class="rounded-xl border border-default bg-surface-soft/90 px-4 py-3"
|
||||
:open="shouldExpandSourceDetails(msg)"
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-secondary">
|
||||
{{ $t('chat.sourceDocs') }} ({{ getDisplayRetrieverResources(msg).length }})
|
||||
</summary>
|
||||
<div class="mt-3 space-y-2">
|
||||
<div
|
||||
v-for="(doc, docIndex) in getDisplayRetrieverResources(msg)"
|
||||
:key="`${doc.document_name || 'doc'}-${doc.segment_id || docIndex}`"
|
||||
class="rounded-lg border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-900"
|
||||
class="rounded-lg border border-default bg-surface p-3"
|
||||
>
|
||||
<div class="break-all text-sm font-semibold text-slate-800 dark:text-slate-100">{{ getSourceTitle(doc) }}</div>
|
||||
<div v-if="getSourceMeta(doc)" class="mt-1 text-xs text-slate-500 dark:text-slate-400">{{ getSourceMeta(doc) }}</div>
|
||||
<div v-if="getSourceBrief(doc)" class="mt-2 whitespace-pre-wrap break-all text-xs text-slate-600 dark:text-slate-300">{{ getSourceBrief(doc) }}</div>
|
||||
<div class="break-all text-sm font-semibold text-primary">{{ getSourceTitle(doc) }}</div>
|
||||
<div v-if="getSourceMeta(doc)" class="mt-1 text-xs text-muted">{{ getSourceMeta(doc) }}</div>
|
||||
<div v-if="getSourceBrief(doc)" class="mt-2 whitespace-pre-wrap break-all text-xs text-secondary">{{ getSourceBrief(doc) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details
|
||||
v-if="msg.attribution_parts && msg.attribution_parts.length > 0"
|
||||
class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65"
|
||||
class="rounded-xl border border-default bg-surface-soft/90 px-4 py-3"
|
||||
open
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-secondary">
|
||||
{{ $t('chat.attributionParts') }}
|
||||
</summary>
|
||||
<ul class="mt-3 space-y-2">
|
||||
<li
|
||||
v-for="(part, partIndex) in msg.attribution_parts"
|
||||
:key="`attr-${partIndex}`"
|
||||
class="rounded-lg border border-slate-200 bg-white p-3 text-xs text-slate-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
|
||||
class="rounded-lg border border-default bg-surface p-3 text-xs text-secondary"
|
||||
>
|
||||
{{ part }}
|
||||
</li>
|
||||
@@ -2627,12 +2628,12 @@ const showChatRating = ref(false);
|
||||
<div
|
||||
v-if="msg.type !== 'leave-form'"
|
||||
class="mt-1 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100"
|
||||
:class="msg.role === 'user' ? 'justify-end text-slate-500' : 'justify-start text-slate-500'"
|
||||
:class="msg.role === 'user' ? 'justify-end text-muted' : 'justify-start text-muted'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="copyToClipboard(msg, index)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.copy')"
|
||||
>
|
||||
<Check v-if="copiedIndex === index" class="h-3.5 w-3.5 text-emerald-500" />
|
||||
@@ -2643,7 +2644,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="input = msg.content"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.edit')"
|
||||
>
|
||||
<Edit2 class="h-3.5 w-3.5" />
|
||||
@@ -2651,7 +2652,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="handleSend(msg.content)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.resend')"
|
||||
>
|
||||
<RotateCw class="h-3.5 w-3.5" />
|
||||
@@ -2662,7 +2663,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
v-if="index === messages.length - 1 && !isThinking"
|
||||
@click="regenerate"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.regenerate')"
|
||||
>
|
||||
<RotateCw class="h-3.5 w-3.5" />
|
||||
@@ -2670,7 +2671,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
v-if="showChatRating && !isThinking && !(msg as any).rated"
|
||||
@click="handleOpenFeedback(index)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.rate')"
|
||||
>
|
||||
<MessageSquareText class="h-3.5 w-3.5" />
|
||||
@@ -2683,13 +2684,13 @@ const showChatRating = ref(false);
|
||||
</template>
|
||||
|
||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex w-full max-w-4xl justify-start">
|
||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-slate-200 bg-white/95 px-5 py-3 shadow-md dark:border-slate-700 dark:bg-slate-900/85">
|
||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-default bg-surface/95 px-5 py-3 shadow-md">
|
||||
<div class="flex gap-1">
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400"></span>
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-75"></span>
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-150"></span>
|
||||
</div>
|
||||
<span class="text-sm font-medium text-slate-500 dark:text-slate-300">{{ $t('chat.thinking') }}</span>
|
||||
<span class="text-sm font-medium text-muted">{{ $t('chat.thinking') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="messages.length > 0" class="h-2 md:h-3"></div>
|
||||
@@ -2698,13 +2699,13 @@ const showChatRating = ref(false);
|
||||
|
||||
<footer class="safe-bottom sticky bottom-0 z-20 bg-transparent p-3 md:p-6">
|
||||
<div class="relative mx-auto max-w-4xl">
|
||||
<div class="flex flex-col rounded-2xl bg-white p-2 shadow-[0_0_15px_rgba(0,0,0,0.05)] transition-all dark:bg-slate-900">
|
||||
<div class="flex flex-col rounded-2xl bg-surface p-2 shadow-[0_0_15px_rgba(0,0,0,0.05)] transition-all">
|
||||
<textarea
|
||||
v-model="input"
|
||||
@keydown.enter.prevent="handleSend"
|
||||
rows="1"
|
||||
:placeholder="$t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent dark:text-slate-100"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-primary placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent"
|
||||
style="min-height: 44px; max-height: 220px;"
|
||||
:disabled="isThinking"
|
||||
spellcheck="false"
|
||||
@@ -2718,28 +2719,28 @@ const showChatRating = ref(false);
|
||||
@click="handleVoiceFeatureClick"
|
||||
type="button"
|
||||
:title="$t('chat.voiceFeature')"
|
||||
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
||||
class="text-muted transition-colors hover:text-brand-600"
|
||||
>
|
||||
<Mic class="h-5 w-5" />
|
||||
</button>
|
||||
<div class="relative" ref="kbMenuRef">
|
||||
<button
|
||||
@click="showKbDropdown = !showKbDropdown"
|
||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
class="flex items-center gap-1 rounded-lg border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
>
|
||||
<Database class="h-3.5 w-3.5 text-brand-500" />
|
||||
{{ getKbLabel(selectedKb) }} <ChevronDown class="h-3 w-3" />
|
||||
</button>
|
||||
<div
|
||||
v-if="showKbDropdown"
|
||||
class="absolute bottom-full left-0 mb-2 w-36 overflow-hidden rounded-xl border border-slate-100 bg-white py-1 shadow-xl animate-fade-in dark:border-slate-700 dark:bg-slate-900"
|
||||
class="absolute bottom-full left-0 mb-2 w-36 overflow-hidden rounded-xl border border-subtle bg-surface py-1 shadow-xl animate-fade-in"
|
||||
>
|
||||
<button
|
||||
v-for="option in kbOptions"
|
||||
:key="option"
|
||||
@click="selectedKb = option; showKbDropdown = false"
|
||||
class="flex w-full items-center justify-between px-3 py-2 text-xs text-slate-700 transition-colors hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
:class="{ 'font-bold text-brand-700 dark:text-brand-300': selectedKb === option }"
|
||||
class="flex w-full items-center justify-between px-3 py-2 text-xs text-secondary transition-colors hover:bg-surface-soft"
|
||||
:class="{ 'font-bold text-brand-700': selectedKb === option }"
|
||||
>
|
||||
{{ getKbLabel(option) }}
|
||||
<Check v-if="selectedKb === option" class="h-3.5 w-3.5" />
|
||||
@@ -2748,7 +2749,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<button
|
||||
@click="toggleBrowserPanel"
|
||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
class="flex items-center gap-1 rounded-lg border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
>
|
||||
<Globe class="h-3.5 w-3.5 text-brand-500" />
|
||||
{{ browserPanelOpen ? $t('chat.collapseBrowser') : $t('chat.openBrowser') }}
|
||||
@@ -2759,14 +2760,14 @@ const showChatRating = ref(false);
|
||||
:disabled="!input.trim() || isThinking"
|
||||
class="flex h-10 w-10 items-center justify-center rounded-full border shadow-sm transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:class="!input.trim() || isThinking
|
||||
? 'border-slate-200 bg-slate-100 text-slate-400 dark:border-slate-700 dark:bg-slate-800'
|
||||
? 'border-default bg-slate-100 text-muted'
|
||||
: 'border-brand-500 bg-brand-500 text-white shadow-[0_0_0_4px_rgba(59,130,246,0.18)] hover:scale-105 hover:bg-brand-600 hover:shadow-[0_0_0_6px_rgba(59,130,246,0.24)] active:scale-95'"
|
||||
>
|
||||
<Send class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-center text-[11px] text-slate-400">
|
||||
<div class="mt-3 text-center text-[11px] text-muted">
|
||||
{{ $t('chat.disclaimer') }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -2775,7 +2776,7 @@ const showChatRating = ref(false);
|
||||
|
||||
<div
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-0 z-40 bg-slate-900/40 backdrop-blur-sm lg:hidden"
|
||||
class="fixed inset-0 z-40 bg-overlay backdrop-blur-sm lg:hidden"
|
||||
@click="browserPanelOpen = false"
|
||||
></div>
|
||||
|
||||
@@ -2786,35 +2787,35 @@ const showChatRating = ref(false);
|
||||
>
|
||||
<div
|
||||
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
|
||||
:class="isBrowserResizing ? 'bg-brand-500' : 'bg-slate-200 dark:bg-slate-800'"
|
||||
:class="isBrowserResizing ? 'bg-brand-500' : 'bg-slate-200'"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-y-0 right-0 z-50 flex w-full max-w-[100vw] flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-slate-800 dark:bg-slate-950 sm:w-[420px] lg:static lg:z-0 lg:w-[420px] lg:shadow-none"
|
||||
class="fixed inset-y-0 right-0 z-50 flex w-full max-w-[100vw] flex-col border-l border-default bg-surface shadow-2xl sm:w-[420px] lg:static lg:z-0 lg:w-[420px] lg:shadow-none"
|
||||
:style="browserPanelStyle"
|
||||
>
|
||||
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
|
||||
<div class="flex items-center justify-between border-b border-default px-4 py-3">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold text-secondary">
|
||||
<Globe class="h-4 w-4 text-brand-500" />
|
||||
{{ $t('chat.browser') }}
|
||||
</div>
|
||||
<button
|
||||
@click="browserPanelOpen = false"
|
||||
class="rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-md p-1.5 text-muted transition-colors hover-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.closeBrowser')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 border-b border-slate-200 px-3 py-3 dark:border-slate-800">
|
||||
<div class="flex items-center gap-2 border-b border-default px-3 py-3">
|
||||
<input
|
||||
v-model="browserDraftUrl"
|
||||
type="text"
|
||||
:placeholder="$t('chat.browserInputPlaceholder')"
|
||||
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-brand-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
||||
class="flex-1 rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-primary outline-none transition focus:border-brand-400 focus:bg-surface"
|
||||
@keydown="handleBrowserUrlEnter"
|
||||
/>
|
||||
<button
|
||||
@@ -2825,24 +2826,24 @@ const showChatRating = ref(false);
|
||||
</button>
|
||||
<button
|
||||
@click="refreshBrowserPage"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-xl border border-default p-2 text-muted transition-colors hover:bg-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.refresh')"
|
||||
>
|
||||
<RotateCw class="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
@click="openBrowserInNewTab"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-xl border border-default p-2 text-muted transition-colors hover:bg-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.openInNewTab')"
|
||||
>
|
||||
<ExternalLink class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 bg-slate-100 dark:bg-slate-900">
|
||||
<div class="min-h-0 flex-1 bg-slate-100">
|
||||
<div
|
||||
v-if="!browserCurrentUrl"
|
||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
|
||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-muted"
|
||||
>
|
||||
<Globe class="h-8 w-8 text-brand-500" />
|
||||
<div>{{ $t('chat.browserHint1') }}</div>
|
||||
@@ -2852,15 +2853,15 @@ const showChatRating = ref(false);
|
||||
v-else
|
||||
:key="browserFrameKey"
|
||||
:src="browserCurrentUrl"
|
||||
class="h-full w-full border-0 bg-white dark:bg-slate-950"
|
||||
class="h-full w-full border-0 bg-surface"
|
||||
allow="clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ChatShell>
|
||||
|
||||
<FilePreviewModal
|
||||
v-model="filePreviewVisible"
|
||||
@@ -2883,38 +2884,39 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
<div
|
||||
v-if="showLeaveAgentDialog"
|
||||
class="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4"
|
||||
class="dialog-overlay z-[100] items-center"
|
||||
@click.self="closeLeaveAgentDialog"
|
||||
>
|
||||
<div class="flex w-full max-w-2xl max-h-[80vh] flex-col rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<div class="dialog-panel flex max-h-[80vh] max-w-2xl flex-col">
|
||||
<div class="dialog-header">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ $t('chat.oaDataConnected') }}</p>
|
||||
<h3 class="section-title">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
|
||||
<p class="section-desc mt-1">{{ $t('chat.oaDataConnected') }}</p>
|
||||
</div>
|
||||
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('admin.close')" @click="closeLeaveAgentDialog">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 relative shrink-0">
|
||||
<div class="dialog-body space-y-4 border-t-0 pt-4">
|
||||
<div class="relative shrink-0">
|
||||
<input
|
||||
v-model="leaveAgentKeyword"
|
||||
@keydown.enter="handleAgentSearch"
|
||||
type="text"
|
||||
:placeholder="$t('chat.searchByNameOrEmployeeId')"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 pr-10 text-sm outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="input-field pr-10"
|
||||
/>
|
||||
<button @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-slate-400 hover:text-brand-600">
|
||||
<button type="button" @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-muted hover:text-brand-600">
|
||||
<Search class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 space-y-3 overflow-y-auto pr-2 scrollbar-thin">
|
||||
<div class="max-h-[50vh] flex-1 space-y-3 overflow-y-auto pr-2 scrollbar-thin">
|
||||
<div v-if="leaveAgentLoading && leaveAgentPage === 1" class="flex justify-center py-8">
|
||||
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
||||
</div>
|
||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
|
||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-muted">
|
||||
{{ $t('chat.noData') }}
|
||||
</div>
|
||||
<template v-else>
|
||||
@@ -2922,14 +2924,14 @@ const showChatRating = ref(false);
|
||||
v-for="option in leaveAgentOptions"
|
||||
:key="option.uid"
|
||||
type="button"
|
||||
class="flex w-full items-center justify-between rounded-2xl border border-slate-200 px-4 py-4 text-left transition hover:border-brand-300 hover:bg-brand-50/50 dark:border-slate-700 dark:hover:border-brand-500/40 dark:hover:bg-brand-500/10"
|
||||
class="flex w-full items-center justify-between rounded-2xl border border-default px-4 py-4 text-left transition hover:border-brand-300 hover:bg-brand-50/50"
|
||||
@click="selectLeaveAgent(option)"
|
||||
>
|
||||
<div class="space-y-1">
|
||||
<div class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ option.name }}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
|
||||
<div class="text-sm font-semibold text-primary">{{ option.name }}</div>
|
||||
<div class="text-xs text-muted">UID:{{ option.uid }}</div>
|
||||
</div>
|
||||
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
|
||||
<div class="text-right text-xs text-muted">
|
||||
<div>{{ $t('chat.employeeId') }}:{{ option.employeeId }}</div>
|
||||
<div>{{ $t('chat.name') }}:{{ option.name }}</div>
|
||||
</div>
|
||||
@@ -2939,7 +2941,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
@click="loadAllAgents"
|
||||
:disabled="leaveAgentLoading"
|
||||
class="text-xs text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-300"
|
||||
class="text-xs text-muted hover:text-secondary disabled:opacity-50"
|
||||
>
|
||||
{{ $t('chat.loadAll') }}
|
||||
</button>
|
||||
@@ -2951,50 +2953,50 @@ const showChatRating = ref(false);
|
||||
{{ leaveAgentLoading ? $t('chat.loading') : $t('chat.loadMore') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="py-4 text-center text-xs text-slate-400">{{ $t('chat.noMoreData') }}</div>
|
||||
<div v-else class="py-4 text-center text-xs text-muted">{{ $t('chat.noMoreData') }}</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- OA 登录对话框 -->
|
||||
<Teleport to="body">
|
||||
<div v-if="showOALoginDialog" class="fixed inset-0 z-[9999] flex items-center justify-center">
|
||||
<div class="absolute inset-0 bg-black/40" @click="cancelOALogin"></div>
|
||||
<div class="relative w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-800">
|
||||
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.loginOaSystem') }}</h3>
|
||||
<div class="space-y-4">
|
||||
<div
|
||||
v-if="showOALoginDialog"
|
||||
class="dialog-overlay z-[9999] items-center"
|
||||
@click.self="cancelOALogin"
|
||||
>
|
||||
<div class="dialog-panel max-w-sm">
|
||||
<div class="dialog-header dialog-header--compact justify-center border-0 pb-2">
|
||||
<h3 class="section-title text-center">{{ $t('chat.loginOaSystem') }}</h3>
|
||||
</div>
|
||||
<div class="dialog-body space-y-4 border-t-0 pt-0">
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('chat.employeeId') }}</span>
|
||||
<span class="label-field">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="oaLoginEmployeeId"
|
||||
type="text"
|
||||
disabled
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-100 px-3 py-2.5 text-sm text-slate-600 outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-300"
|
||||
class="input-field bg-surface-soft"
|
||||
/>
|
||||
</label>
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('login.password') }}</span>
|
||||
<span class="label-field">{{ $t('login.password') }}</span>
|
||||
<input
|
||||
v-model="oaLoginPassword"
|
||||
type="password"
|
||||
:placeholder="$t('chat.enterOaPassword')"
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-800 outline-none focus:border-brand-400 focus:ring-2 focus:ring-brand-100 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100 dark:focus:border-brand-500 dark:focus:ring-brand-500/20"
|
||||
class="input-field"
|
||||
@keyup.enter="confirmOALogin"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-6 flex items-center justify-end gap-3">
|
||||
<button
|
||||
@click="cancelOALogin"
|
||||
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700"
|
||||
>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="cancelOALogin" class="btn-secondary">
|
||||
{{ $t('profile.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
@click="confirmOALogin"
|
||||
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 dark:bg-brand-500 dark:hover:bg-brand-600"
|
||||
>
|
||||
<button type="button" @click="confirmOALogin" class="btn-primary btn-sm">
|
||||
{{ $t('chat.confirmLogin') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@
|
||||
import { ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Lock, AlertCircle, CheckCircle } from 'lucide-vue-next';
|
||||
import MinimalShell from '../layouts/MinimalShell.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -19,17 +20,17 @@ const handleReset = async () => {
|
||||
status.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (password.value !== confirmPassword.value) {
|
||||
message.value = 'Passwords do not match';
|
||||
status.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
isLoading.value = true;
|
||||
status.value = 'idle';
|
||||
message.value = '';
|
||||
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/user/reset-password-confirm', {
|
||||
method: 'POST',
|
||||
@@ -39,7 +40,7 @@ const handleReset = async () => {
|
||||
new_password: password.value
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
const data = await res.json();
|
||||
if (res.ok) {
|
||||
status.value = 'success';
|
||||
@@ -51,7 +52,7 @@ const handleReset = async () => {
|
||||
status.value = 'error';
|
||||
message.value = data.error || 'Failed to reset password';
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
status.value = 'error';
|
||||
message.value = 'Network error occurred';
|
||||
} finally {
|
||||
@@ -61,46 +62,44 @@ const handleReset = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-screen bg-slate-50 dark:bg-slate-950 flex items-center justify-center p-4">
|
||||
<div class="max-w-md w-full bg-white dark:bg-slate-900 rounded-3xl shadow-xl p-8 md:p-10 border border-slate-100 dark:border-slate-700">
|
||||
<div class="text-center mb-8">
|
||||
<div class="w-12 h-12 bg-brand-100 rounded-xl mx-auto flex items-center justify-center text-brand-600 mb-4">
|
||||
<Lock class="w-6 h-6" />
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-slate-900 dark:text-slate-100">Reset Password</h2>
|
||||
<p class="text-slate-500 dark:text-slate-400 text-sm mt-2">Enter your new password below</p>
|
||||
</div>
|
||||
|
||||
<div v-if="status === 'success'" class="bg-green-50 text-green-700 p-4 rounded-xl flex items-start gap-3 mb-6">
|
||||
<CheckCircle class="w-5 h-5 shrink-0 mt-0.5" />
|
||||
<div>{{ message }}</div>
|
||||
</div>
|
||||
|
||||
<div v-if="status === 'error'" class="bg-red-50 text-red-700 p-4 rounded-xl flex items-start gap-3 mb-6">
|
||||
<AlertCircle class="w-5 h-5 shrink-0 mt-0.5" />
|
||||
<div>{{ message }}</div>
|
||||
</div>
|
||||
|
||||
<form v-if="status !== 'success'" @submit.prevent="handleReset" class="space-y-5">
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-slate-700 uppercase ml-1">New Password</label>
|
||||
<input v-model="password" type="password" class="input-field" placeholder="Enter new password" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-slate-700 uppercase ml-1">Confirm Password</label>
|
||||
<input v-model="confirmPassword" type="password" class="input-field" placeholder="Confirm new password" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" :disabled="isLoading" class="btn-primary w-full py-3 flex justify-center items-center gap-2">
|
||||
<div v-if="isLoading" class="animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-white"></div>
|
||||
<span>{{ isLoading ? 'Resetting...' : 'Reset Password' }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 text-center">
|
||||
<router-link to="/" class="text-sm font-medium text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200">Back to Login</router-link>
|
||||
<MinimalShell>
|
||||
<div class="text-center mb-8">
|
||||
<div class="w-12 h-12 bg-brand-100 rounded-xl mx-auto flex items-center justify-center text-brand-600 mb-4">
|
||||
<Lock class="w-6 h-6" />
|
||||
</div>
|
||||
<h2 class="page-title">Reset Password</h2>
|
||||
<p class="section-desc mt-2">Enter your new password below</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="status === 'success'" class="alert-ds alert-success mb-6">
|
||||
<CheckCircle class="w-5 h-5 shrink-0" />
|
||||
<div>{{ message }}</div>
|
||||
</div>
|
||||
|
||||
<div v-if="status === 'error'" class="alert-ds alert-error mb-6">
|
||||
<AlertCircle class="w-5 h-5 shrink-0" />
|
||||
<div>{{ message }}</div>
|
||||
</div>
|
||||
|
||||
<form v-if="status !== 'success'" @submit.prevent="handleReset" class="space-y-5">
|
||||
<div>
|
||||
<label class="label-field mb-1.5 block">New Password</label>
|
||||
<input v-model="password" type="password" class="input-field" placeholder="Enter new password" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="label-field mb-1.5 block">Confirm Password</label>
|
||||
<input v-model="confirmPassword" type="password" class="input-field" placeholder="Confirm new password" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" :disabled="isLoading" class="btn-primary w-full py-3 flex justify-center items-center gap-2">
|
||||
<div v-if="isLoading" class="animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-white"></div>
|
||||
<span>{{ isLoading ? 'Resetting...' : 'Reset Password' }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 text-center">
|
||||
<router-link to="/" class="text-sm font-medium text-muted hover:text-secondary">Back to Login</router-link>
|
||||
</div>
|
||||
</MinimalShell>
|
||||
</template>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -12,7 +12,7 @@ export default {
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: {
|
||||
sans: ['Inter', ...defaultTheme.fontFamily.sans],
|
||||
sans: ['"PingFang SC"', '"Microsoft YaHei"', '"Segoe UI"', 'system-ui', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
colors: {
|
||||
brand: {
|
||||
|
||||
Reference in new issue
Block a user