From 4e2a0ea3b39fc27ce6526a6a7d4d7b76f460bd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B1=BC=E5=BC=80=E5=8F=91?= Date: Sun, 10 May 2026 20:56:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E7=BB=9F=E4=B8=80=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=9B=BE=E6=A0=87=E4=B8=BA=E9=93=85=E7=AC=94=20SVG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Account 页面昵称编辑:修改文字 → 铅笔图标 - 移除保存/取消按钮,统一为 Enter 保存、Esc/失焦取消 --- tauri-app/src/pages/Profile/Account.tsx | 80 ++++++++++++++----------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/tauri-app/src/pages/Profile/Account.tsx b/tauri-app/src/pages/Profile/Account.tsx index 357b819..d2aaad9 100644 --- a/tauri-app/src/pages/Profile/Account.tsx +++ b/tauri-app/src/pages/Profile/Account.tsx @@ -88,44 +88,54 @@ export default function Account() { 昵称 {editing ? ( - <> - setNickname(e.target.value)} - maxLength={20} - autoFocus - style={{ - padding: '4px 10px', - borderRadius: '6px', - border: '1px solid var(--border-color)', - fontSize: 'var(--font-sm)', - outline: 'none', - width: '160px', - }} - onKeyDown={(e) => { if (e.key === 'Enter') handleSaveNickname(); }} - /> - - - + setNickname(e.target.value)} + maxLength={20} + autoFocus + disabled={saving} + style={{ + padding: '4px 10px', + borderRadius: '6px', + border: '1px solid var(--border-color)', + fontSize: 'var(--font-sm)', + outline: 'none', + width: '160px', + fontFamily: 'inherit', + }} + onKeyDown={(e) => { + if (e.key === 'Enter') handleSaveNickname(); + if (e.key === 'Escape') { + setEditing(false); + setNickname(displayName); + setError(''); + } + }} + onBlur={() => { + setEditing(false); + setNickname(displayName); + setError(''); + }} + /> ) : ( <> {displayName} - + setEditing(true)} + > + 修改昵称 + + )}