style: 将 Unicode 转义序列替换为可读的中文字符

This commit is contained in:
2026-03-02 06:48:32 +08:00
parent 70344bcd98
commit 08e5abe165
6 changed files with 14 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ export function HistoryList({ sendJSON }: HistoryListProps) {
const handleItemClick = useCallback(
(text: string) => {
sendJSON({ type: "paste", text });
showToast("\u53d1\u9001\u7c98\u8d34\u2026");
showToast("发送粘贴…");
},
[sendJSON, showToast],
);
@@ -27,20 +27,20 @@ export function HistoryList({ sendJSON }: HistoryListProps) {
<section className="flex min-h-0 flex-1 flex-col overflow-hidden">
<div className="flex shrink-0 items-center justify-between pb-2.5">
<h2 className="font-semibold text-[13px] text-fg-dim uppercase tracking-[0.06em]">
{"\u5386\u53f2\u8bb0\u5f55"}
{"历史记录"}
</h2>
<button
type="button"
onClick={clearHistory}
className="cursor-pointer rounded-lg border-none bg-transparent px-2.5 py-1 font-medium text-fg-dim text-xs transition-all duration-150 active:bg-danger/[0.08] active:text-danger"
>
{"\u6e05\u7a7a"}
{"清空"}
</button>
</div>
{history.length === 0 ? (
<p className="py-10 text-center text-fg-dim text-sm">
{"\u6682\u65e0\u8bb0\u5f55"}
{"暂无记录"}
</p>
) : (
<div className="scrollbar-thin flex-1 overflow-y-auto">

View File

@@ -73,10 +73,10 @@ export function MicButton({ onStart, onStop }: MicButtonProps) {
width={48}
height={48}
fill="currentColor"
aria-label="\u9ea6\u514b\u98ce"
aria-label="麦克风"
role="img"
>
<title>{"\u9ea6\u514b\u98ce"}</title>
<title>{"麦克风"}</title>
<path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z" />
<path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z" />
</svg>
@@ -99,7 +99,7 @@ export function MicButton({ onStart, onStop }: MicButtonProps) {
</div>
</div>
<p className="font-medium text-fg-dim text-sm">
{"\u6309\u4f4f\u8bf4\u8bdd"}
{"按住说话"}
</p>
</section>
);

View File

@@ -17,7 +17,7 @@ export function PreviewBox() {
<p
className={`break-words text-base leading-relaxed ${hasText ? "" : "text-fg-dim"}`}
>
{hasText ? text : "\u6309\u4f4f\u8bf4\u8bdd\u2026"}
{hasText ? text : "按住说话…"}
</p>
</div>
</section>

View File

@@ -2,17 +2,17 @@ import { useAppStore } from "../stores/app-store";
const statusConfig = {
connected: {
text: "\u5df2\u8fde\u63a5",
text: "已连接",
dotClass: "bg-success shadow-[0_0_6px_rgba(52,211,153,0.5)]",
borderClass: "border-success/15",
},
disconnected: {
text: "\u5df2\u65ad\u5f00",
text: "已断开",
dotClass: "bg-danger shadow-[0_0_6px_rgba(244,63,94,0.4)]",
borderClass: "border-edge",
},
connecting: {
text: "\u8fde\u63a5\u4e2d\u2026",
text: "连接中…",
dotClass: "bg-accent animate-pulse-dot",
borderClass: "border-edge",
},

View File

@@ -91,7 +91,7 @@ export function useRecorder({ sendJSON, sendBinary }: UseRecorderOptions) {
abortRef.current = null;
useAppStore
.getState()
.showToast(`\u9ea6\u514b\u98ce\u9519\u8bef: ${(err as Error).message}`);
.showToast(`麦克风错误: ${(err as Error).message}`);
}
}, [initAudio]);

View File

@@ -58,10 +58,10 @@ export function useWebSocket() {
if (msg.text) store.addHistory(msg.text);
break;
case "pasted":
store.showToast("\u2705 \u5df2\u7c98\u8d34");
store.showToast("✅ 已粘贴");
break;
case "error":
store.showToast(`\u274c ${msg.message || "\u9519\u8bef"}`);
store.showToast(` ${msg.message || "错误"}`);
break;
}
} catch {