From e24fb2cc19353bb89caf2d2fd529948098c45bb3 Mon Sep 17 00:00:00 2001 From: cfy666 <3087823110@qq.com> Date: Sun, 21 Jun 2026 23:50:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=E6=83=85=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=92=8C=E8=AE=BE=E5=A4=87=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E7=9A=84=20emoji=20=E7=BB=9F=E4=B8=80=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=20SVG=20=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 scenarioIcons.tsx 提取情景图标渲染逻辑 - 情景芯片、设备选择器、警告提示等 emoji 全部改为 Feather-style SVG - 调整 CSS 确保 SVG 图标居中对齐 --- frontend/src/App.css | 11 +- frontend/src/App.tsx | 39 +++++- frontend/src/components/ChatPanel/index.tsx | 19 +-- frontend/src/components/ConfigPanel/index.tsx | 4 +- .../components/CreateScenarioModal/index.tsx | 22 ++-- .../components/EditScenarioModal/index.tsx | 32 +++-- frontend/src/components/LandingPage/index.tsx | 44 +++---- .../src/components/SessionSidebar/index.tsx | 6 +- frontend/src/lib/i18n/zh-CN.ts | 6 +- frontend/src/lib/scenarioIcons.tsx | 124 ++++++++++++++++++ 10 files changed, 232 insertions(+), 75 deletions(-) create mode 100644 frontend/src/lib/scenarioIcons.tsx diff --git a/frontend/src/App.css b/frontend/src/App.css index e6ad6e2..9afbf9a 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1623,15 +1623,17 @@ body { } .scenario-chip--add .scenario-chip__icon { - font-size: 0.88rem; - font-weight: 300; - line-height: 1; + display: inline-flex; + align-items: center; } .scenario-chip__icon { font-size: 0.9rem; line-height: 1; flex-shrink: 0; + display: inline-flex; + align-items: center; + justify-content: center; } .scenario-chip__name { @@ -1681,6 +1683,9 @@ body { font-size: 0.72rem; color: var(--color-text-muted); flex-shrink: 0; + display: inline-flex; + align-items: center; + justify-content: center; } .device-select { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d485be6..df95d42 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -19,11 +19,34 @@ import { EditScenarioModal } from "./components/EditScenarioModal"; import { AuthProvider, useAuth } from "./lib/auth"; import { loadConfig, loadTheme, saveTheme } from "./lib/storage"; import { I18nContext, parseLocale, t } from "./lib/i18n"; +import { renderScenarioIconById } from "./lib/scenarioIcons"; import type { Locale } from "./lib/i18n"; import type { Theme } from "./types"; import type { UserScenario } from "./lib/api/scenarios"; import "./App.css"; +// ---- 统一 SVG 图标系统(Feather-style,stroke-based) ---- + +const SVG_PROPS = { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round" as const, strokeLinejoin: "round" as const }; + +/** 系统情景 SVG 图标映射 */ +function scenarioSvgIcon(id: string) { + switch (id) { + case "free_chat": + return (); + case "interviewer": + return (); + case "english_teacher": + return (); + case "debate": + return (); + case "interpreter": + return (); + default: + return null; + } +} + /** 内部组件,确保在 I18nContext.Provider 内部使用 hooks */ function AppContent() { const { isAuthenticated, isLoading, user, logout, accessToken } = useAuth(); @@ -378,7 +401,7 @@ function AppContent() {