From d52c6cda05af68c1d3502907f3aefab2bd9000a7 Mon Sep 17 00:00:00 2001 From: baiqing Date: Mon, 11 May 2026 23:41:29 +0800 Subject: [PATCH] feat(capsule): animated thinking shine indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把 transcribing / polishing 阶段的胶囊从原来的"三个圆点 + 文案"换成 扫光的 thinking 文字效果: - 移除 ProcessingDots 组件 - 文字字号 11 → 14,字重 500,扫光 linear-gradient + background-clip: text - 进入 transcribing / polishing 的头 2 秒走 0.9s/cycle 快速扫光(提示「刚开始」), 之后切回 2.4s 稳态。React 副作用切 duration 不重启动画,会平滑减速 - 切换 state 时多一道 220ms 淡入(cap-state-enter)让用户更容易感知 - 5 个 locale 的 capsule.thinking 文案统一为 'thinking'(小写英文),与扫光字面 视觉一致,避免不同语言长度差影响排版 CSS keyframes 改名 cap-dot → cap-shine,并加 cap-state-enter。 --- openless-all/app/src/components/Capsule.tsx | 75 +++++++++++++-------- openless-all/app/src/i18n/en.ts | 2 +- openless-all/app/src/i18n/ja.ts | 2 +- openless-all/app/src/i18n/ko.ts | 2 +- openless-all/app/src/i18n/zh-CN.ts | 2 +- openless-all/app/src/i18n/zh-TW.ts | 2 +- 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/openless-all/app/src/components/Capsule.tsx b/openless-all/app/src/components/Capsule.tsx index 848b9a9b..76ce96db 100644 --- a/openless-all/app/src/components/Capsule.tsx +++ b/openless-all/app/src/components/Capsule.tsx @@ -56,26 +56,6 @@ function AudioBars({ level }: AudioBarsProps) { ); } -function ProcessingDots() { - return ( -
- {[0, 1, 2].map(i => ( - - ))} -
- ); -} - interface CenterTextProps { os: OS; kind: 'default' | 'processing' | 'error'; @@ -176,6 +156,20 @@ function Pill({ os, state, level, insertedChars, message, onCancel, onConfirm }: const processingLayout = getCapsuleMessageLayout(os, 'processing'); const enabled = state === 'recording'; + // "thinking" 扫光速度:进入 transcribing/polishing 的头 2 秒走快速(0.9s/cycle,提示 + // 「流式刚开始」),之后切回慢速(2.4s)作为稳态。切回 idle / done / 其他 state 也复位 + // 为 fast,下次进入时从头开始 burst。 + const [shineFast, setShineFast] = useState(true); + useEffect(() => { + if (state === 'transcribing' || state === 'polishing') { + setShineFast(true); + const t = setTimeout(() => setShineFast(false), 2000); + return () => clearTimeout(t); + } + setShineFast(true); + return undefined; + }, [state]); + let center: JSX.Element; switch (state) { case 'recording': @@ -187,24 +181,43 @@ function Pill({ os, state, level, insertedChars, message, onCancel, onConfirm }:
-
diff --git a/openless-all/app/src/i18n/en.ts b/openless-all/app/src/i18n/en.ts index a58e295f..83245938 100644 --- a/openless-all/app/src/i18n/en.ts +++ b/openless-all/app/src/i18n/en.ts @@ -30,7 +30,7 @@ export const en: typeof zhCN = { durationMinutes: '{{value}}m', }, capsule: { - thinking: 'Thinking…', + thinking: 'thinking', cancelled: 'Cancelled', error: 'Something went wrong', inserted: 'Inserted {{count}}', diff --git a/openless-all/app/src/i18n/ja.ts b/openless-all/app/src/i18n/ja.ts index e5a6eca1..884dfd14 100644 --- a/openless-all/app/src/i18n/ja.ts +++ b/openless-all/app/src/i18n/ja.ts @@ -32,7 +32,7 @@ export const ja: typeof zhCN = { durationMinutes: '{{value}} 分', }, capsule: { - thinking: '考えています', + thinking: 'thinking', cancelled: 'キャンセルしました', error: 'エラーが発生しました', inserted: '{{count}} 文字を入力しました', diff --git a/openless-all/app/src/i18n/ko.ts b/openless-all/app/src/i18n/ko.ts index 535513e1..05db092f 100644 --- a/openless-all/app/src/i18n/ko.ts +++ b/openless-all/app/src/i18n/ko.ts @@ -32,7 +32,7 @@ export const ko: typeof zhCN = { durationMinutes: '{{value}}분', }, capsule: { - thinking: '생각 중', + thinking: 'thinking', cancelled: '취소됨', error: '오류 발생', inserted: '{{count}}자 입력됨', diff --git a/openless-all/app/src/i18n/zh-CN.ts b/openless-all/app/src/i18n/zh-CN.ts index 6c0aa3ff..91b00c19 100644 --- a/openless-all/app/src/i18n/zh-CN.ts +++ b/openless-all/app/src/i18n/zh-CN.ts @@ -28,7 +28,7 @@ export const zhCN = { durationMinutes: '{{value}} 分钟', }, capsule: { - thinking: '正在思考中', + thinking: 'thinking', cancelled: '已取消', error: '出错了', inserted: '已插入 {{count}}', diff --git a/openless-all/app/src/i18n/zh-TW.ts b/openless-all/app/src/i18n/zh-TW.ts index a10ccab5..a22e408c 100644 --- a/openless-all/app/src/i18n/zh-TW.ts +++ b/openless-all/app/src/i18n/zh-TW.ts @@ -30,7 +30,7 @@ export const zhTW: typeof zhCN = { durationMinutes: '{{value}} 分鐘', }, capsule: { - thinking: '正在思考中', + thinking: 'thinking', cancelled: '已取消', error: '出錯了', inserted: '已插入 {{count}}',