feat(web): B4 枚举标签映射 — labelFor 未知值原样显示
- 新增 lib/enums.ts:platform/mood 标签 + labelFor(kind,value),未知值原样返回(display-raw 红线),注释标明权威来源是 GET /api/v1/meta/enums - 4 处 mood 渲染改用标签(Nav/TopBar/chat×2);未动 types.ts 的 MODES/Mode - 新增纯逻辑测试 enums.test.ts(47 项,esbuild+node,零新依赖) - 未动 admin channelFields 的第二份 PLATFORM_LABEL(记入待办)
This commit is contained in:
1 parent
22e8398110
commit
f42ea1e41c
5 files changed
+151
-4
No files matched your search
@@ -3,6 +3,7 @@ import { useAppStore } from "../store/useAppStore";
|
||||
import { useModeStore } from "../store/useModeStore";
|
||||
import { applyTheme, readTheme, type ThemeMode } from "../lib/theme";
|
||||
import { personaAvatar } from "../lib/persona";
|
||||
import { labelFor } from "../lib/enums";
|
||||
import type { Mode, WsStatus } from "../lib/types";
|
||||
import { Tag } from "./primitives";
|
||||
import { Icon, type IconName } from "./Icon";
|
||||
@@ -67,7 +68,7 @@ export function TopBar({ onMenu }: { onMenu: () => void }): React.ReactNode {
|
||||
|
||||
<div className="flex-1" />
|
||||
|
||||
{mood ? <Tag tone="accent" className="hidden sm:inline-flex">心情 · {mood}</Tag> : null}
|
||||
{mood ? <Tag tone="accent" className="hidden sm:inline-flex">心情 · {labelFor("mood", mood)}</Tag> : null}
|
||||
|
||||
<AwakenBadge />
|
||||
|
||||
|
||||
Reference in new issue
Block a user