WeKnora/frontend
lyingbug b4aa5bbe8d
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376)
* refactor(frontend): batch 1 of style consistency cleanup

- theme.css: alias --td-font-family-mono to --app-font-family-mono so the
  29 monospace call sites follow the user's code-font setting
- replace 115 hardcoded rgba(7,192,95,x) brand tints with
  color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track
  the dark-mode brand color
- strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by
  theme.css); keep the 3 undefined tokens untouched
- menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file
  and its global import
- AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki
  drawer styles into components/css/wiki-graph-drawer.less imported by
  both chat and WikiBrowser so styling no longer depends on load order
- creatChat: remove four !important fixed-width media queries; chat root no
  longer forces font-size: 20px
- list pages: create buttons use native theme="primary" (drops the purple
  gradient on AgentList); header-action-btn no longer needs !important
- add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token
  fallbacks, z-index !important, raster icons)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): unify destructive confirmations on useConfirmDelete

- useConfirmDelete now uses the danger dialog theme with a red confirm
  button; it is the single entry point for delete/leave confirmations
- AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled
  del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete;
  circle.png asset removed
- FAQ single-entry delete gains a confirmation (it deleted immediately);
  new knowledgeEditor.faq.confirmDelete key in all five locales
- VectorStore/StorageBackend delete dialogs and the generated-question
  popconfirm use the danger theme like the rest of the app
- style guard raster-icon baseline lowered to 10

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(frontend): shared modal shell with Esc, overlay close and unsaved guard

Add composables/useModalShell and wire it into the four full-screen
settings-style modals (Settings, AgentEditorModal,
OrganizationSettingsModal, KnowledgeBaseEditorModal):

- Esc closes the modal everywhere (previously only Settings); it defers
  to any open TDesign dialog/drawer/popup and to the agent editor's own
  placeholder popups
- overlay click closes everywhere (Settings gains it)
- editors snapshot their form after load/save; closing with unsaved
  changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of
  silently discarding
- new common.unsavedChanges.* keys in all five locales

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(frontend): mark instant-effect sections in the knowledge base editor

Share, data source and activity sections apply changes immediately, but
the editor footer still showed Cancel / Save, so users either re-saved
or assumed Cancel would undo. Those sections now show an "applies
immediately" note with a single Close button; other sections keep the
Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all
five locales.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): consistent success wording and confirm labels (zh-CN)

- toasts use the "已X" form everywhere: 25 zh-CN values such as
  保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体;
  common.copySuccess now reads the same as common.copied
- confirm buttons in dialogs and popconfirms use the bare verb
  (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除
- GeneralSettings no longer pops a bare "成功" toast after theme / font /
  font-size changes, which are self-evident and applied instantly

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): extract SettingsModalShell for the four settings-style modals

Settings, AgentEditorModal, OrganizationSettingsModal and
KnowledgeBaseEditorModal each carried a copy of the same overlay / panel /
sidebar-nav / footer markup and ~20 CSS blocks, already drifting
(1000/1080/1100px widths, three shadows, different nav paddings).

components/SettingsModalShell.vue now owns that chrome: one 1080x780
panel, grouped nav with badges, optional loading overlay, footer with a
note slot and an actions slot. Consumers keep only their content and
wire `@close` to their useModalShell.requestClose. Settings keeps its
sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its
image icon through the `nav-icon` slot.

Net: -1025 lines across the four modals.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): shared resource-card mixins and EmptyState for list pages

KnowledgeBaseList, AgentList and OrganizationList each re-declared the
same 136px card (border, radius, shadow, hover, header/title/description/
bottom, more-button reveal, feature badges) with small drifts, plus a
copy of the empty-state block using the upload illustration for every
kind of emptiness.

- components/css/resource-card.less: .resource-card(),
  .resource-card-grid() and .resource-feature-badge() mixins; the pages
  keep only their own variants (type gradients, favourite star,
  decoration). More-buttons stay visible on touch devices.
- components/EmptyState.vue: icon / title / description / actions; the
  11 empty states now use a matching TDesign icon instead of upload.svg
- badge accent colours move from hard-coded old-blue / material orange /
  pink / slate rgba to color-mix over theme tokens (new
  --app-accent-purple in theme.css); style guard legacy-blue baseline
  drops from 40 to 18

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): shared settings-section mixins for header, row, info, control

25 settings/system/integration pages each re-declared .section-header,
.setting-row, .setting-info and .setting-control with five different
header margins (18-32px), three description sizes and assorted paddings.
components/css/settings-section.less now provides
.settings-section-header() / .setting-row() / .setting-info() /
.setting-control() / .setting-save-state(); pages keep only their
deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed
label column). PlatformAPIKeys' style block switches to less so it can
use the mixins. Net -570 lines.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe

- components/css/provider-card.less: .provider-card() /
  -interactive() / -add() / -badge() / -badge-color() / -body() /
  -header() / -title() / -subtitle() / -more() shared by the model,
  vector store, web search, storage, parser and sandbox settings cards;
  MCP and skill cards reuse the 26px badge variant
- vendor badge colours are now `.provider-card-badge-color(#hex)`: the
  foreground is mixed 75/25 with the text colour so it stays readable in
  dark mode, the background is the same colour at 12% alpha
- 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin,
  sandbox-terminal-spin, ...) collapse into a global `wk-spin` in
  theme.css; 23 files updated, one source test adjusted

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons

- ModelEditorDialog: the API key field is a plain t-input type="password"
  and relies on TDesign's built-in show/hide eye instead of a hand-rolled
  suffix toggle, matching every other secret field in the app
- chat answer toolbar buttons are 28px with 6px radius, the same size as
  the user-message actions and the input control bar

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(frontend): app design tokens, tokenized literals, global TDesign overrides

theme.css gains an app-level token set derived from the de-facto scale
already used in the codebase, so values do not change:
  --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px)
  --app-text-{2xs..4xl}              (10..24px)
  --app-space-{1..10}                (4px grid)
  --app-motion-{instant,fast,base,slow} (120/150/200/300ms)
  --z-{sticky,dropdown,modal,drawer,popover,toast}

A codemod mapped 675 border-radius, 1904 font-size and 551 transition
duration literals in 191 files onto those tokens (value-preserving; five
source-text tests now accept either form).

assets/theme/tdesign-overrides.less holds global-intent TDesign
overrides; its `.wk-popover` skin replaces six per-file copies of the
blurred popover panel (TenantMembers x2, UserProfile,
OrganizationSettingsModal, systemAdminDialog.less,
share-to-space-panel.overlay.less) without !important.

styleGuard ratchets now also cover radius / font-size / motion literals,
`transition: all`, total `!important` and z-index !important.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(frontend): keep symmetric side insets for the chat column on narrow viewports

.chat had padding 0 0 20px 20px so the scrollbar could sit on the content
edge, but that also left the message list and input box flush against the
right edge whenever the viewport was narrower than 960px + sidebar. The
inset now lives on .msg_list and .input-container (--chat-content-inset,
20px each side, max-width 960px + insets); the scroll container still
spans the full column so the scrollbar stays on the edge. Wide layouts are
unchanged (960px content, centered).

* chore(frontend): strip trailing whitespace flagged by pre-push

* test(frontend): accept tokenized font-size and shell-rendered loading overlay

Two source-text assertions only ran in CI (Node 24 discovers .test.ts,
local Node 20 does not):
- ChatQuestionMinimap: the 13px preview font is now var(--app-text-md)
- modelUsageDetails: the editors' loading overlay is rendered by
  SettingsModalShell via :loading instead of an inline v-if
Both regexes now accept either form.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 23:11:08 +08:00
..
public feat(i18n): add Japanese (ja-JP) locale support (#3080) 2026-09-07 19:20:41 +08:00
scripts feat(browser): add picture-in-picture task preview 2026-09-12 11:11:36 +08:00
src refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) 2026-09-17 23:11:08 +08:00
.dockerignore feat(ui): multi-stage Docker frontend build (no host npm) (#3074) 2026-09-07 19:33:57 +08:00
.gitignore init commit 2025-08-05 15:08:07 +08:00
Dockerfile chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
docker-entrypoint.sh feat(i18n): add Japanese (ja-JP) locale support (#3080) 2026-09-07 19:20:41 +08:00
embed.html feat(embed): add widget, visitor chat, and management UI (#1657) 2026-06-12 23:10:39 +08:00
env.d.ts feat(frontend): inject commit ID into frontend build for version tracking 2026-06-09 18:08:57 +08:00
index.html fix(frontend): bundle tdesign-icons sprite locally for offline deploys 2026-04-23 18:21:49 +08:00
nginx-api-proxy.conf fix(embed): enforce host origin allowlists on framed pages 2026-09-14 18:03:57 +08:00
nginx-http.conf feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
nginx.conf feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
package-lock.json chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
package.json chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
package.json.md5 fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
pnpm-workspace.yaml fix(frontend): configure pnpm v11 build approvals in workspace file 2026-05-08 16:34:33 +08:00
tsconfig.app.json fix lint and test failures 2026-07-01 17:31:42 +08:00
tsconfig.json init commit 2025-08-05 15:08:07 +08:00
tsconfig.node.json init commit 2025-08-05 15:08:07 +08:00
vite.config.ts feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00