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( const handleItemClick = useCallback(
(text: string) => { (text: string) => {
sendJSON({ type: "paste", text }); sendJSON({ type: "paste", text });
showToast("\u53d1\u9001\u7c98\u8d34\u2026"); showToast("发送粘贴…");
}, },
[sendJSON, showToast], [sendJSON, showToast],
); );
@@ -27,20 +27,20 @@ export function HistoryList({ sendJSON }: HistoryListProps) {
<section className="flex min-h-0 flex-1 flex-col overflow-hidden"> <section className="flex min-h-0 flex-1 flex-col overflow-hidden">
<div className="flex shrink-0 items-center justify-between pb-2.5"> <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]"> <h2 className="font-semibold text-[13px] text-fg-dim uppercase tracking-[0.06em]">
{"\u5386\u53f2\u8bb0\u5f55"} {"历史记录"}
</h2> </h2>
<button <button
type="button" type="button"
onClick={clearHistory} 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" 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> </button>
</div> </div>
{history.length === 0 ? ( {history.length === 0 ? (
<p className="py-10 text-center text-fg-dim text-sm"> <p className="py-10 text-center text-fg-dim text-sm">
{"\u6682\u65e0\u8bb0\u5f55"} {"暂无记录"}
</p> </p>
) : ( ) : (
<div className="scrollbar-thin flex-1 overflow-y-auto"> <div className="scrollbar-thin flex-1 overflow-y-auto">

View File

@@ -73,10 +73,10 @@ export function MicButton({ onStart, onStop }: MicButtonProps) {
width={48} width={48}
height={48} height={48}
fill="currentColor" fill="currentColor"
aria-label="\u9ea6\u514b\u98ce" aria-label="麦克风"
role="img" 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="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" /> <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> </svg>
@@ -99,7 +99,7 @@ export function MicButton({ onStart, onStop }: MicButtonProps) {
</div> </div>
</div> </div>
<p className="font-medium text-fg-dim text-sm"> <p className="font-medium text-fg-dim text-sm">
{"\u6309\u4f4f\u8bf4\u8bdd"} {"按住说话"}
</p> </p>
</section> </section>
); );

View File

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

View File

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

View File

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

View File

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