fix(web): improve copy functionality for Google Authenticator secret (#616)
Pull Request - Frontend | 前端 PR
📝 Description | 描述
English: Fixed the issue where the copy button for Google Authenticator secret key had no feedback, leaving users unsure if the copy succeeded.
中文: 修复了 Google 验证器密钥复制按钮无反馈的问题,导致用户不确定复制是否成功。
🎯 Type of Change | 变更类型
- [x] 🐛 Bug fix | 修复 Bug
🔗 Related Issues | 相关 Issue
- Closes #616 | 关闭 #616
📋 Changes Made | 具体变更
English:
- Added
copySuccessstate to track copy status - Enhanced
copyToClipboardfunction with:- async/await for proper asynchronous handling
- Visual feedback (button turns green, shows ✓ Copied! for 2 seconds)
- Error handling with fallback to
document.execCommandfor older browsers - Error message display if copy fails
- Updated copy button UI:
- Added transition-all animation
- Background changes to green (#0ECB81) on success
- Text changes from 'Copy' to '✓ Copied!'
中文:
- 添加
copySuccessstate 追踪复制状态 - 增强
copyToClipboard函数:- 使用 async/await 正确处理异步操作
- 添加视觉反馈(按钮变绿色,显示 ✓ Copied! 2秒)
- 添加错误处理,降级到
document.execCommand支持旧浏览器 - 复制失败时显示错误提示
- 更新复制按钮 UI:
- 添加 transition-all 动画效果
- 复制成功时背景变为绿色 (#0ECB81)
- 文字从 'Copy' 变为 '✓ Copied!'
🧪 Testing | 测试
Test Environment | 测试环境
- OS | 操作系统: macOS
- Node Version | Node 版本: Latest
- Browser(s) | 浏览器: Chrome, Safari
Manual Testing | 手动测试
- [x] Tested in development mode | 开发模式测试通过
- [x] Tested production build | 生产构建测试通过
- [x] Tested on multiple browsers | 多浏览器测试通过
- [x] Verified no existing functionality broke | 确认没有破坏现有功能
Test Results | 测试结果:
- ✅ Button turns green and shows ✓ Copied! on success
- ✅ Automatically reverts to original state after 2 seconds
- ✅ Fallback works in older browsers
- ✅ Compatible with upstream changes (betaMode, password toggle)
✅ Checklist | 检查清单
Code Quality | 代码质量
- [x] Code follows project style | 代码遵循项目风格
- [x] Self-review completed | 已完成代码自查
- [x] Comments added for complex logic | 已添加必要注释
By submitting this PR, I confirm | 提交此 PR,我确认:
- [x] I have read the Contributing Guidelines | 已阅读贡献指南
- [x] I agree to the Code of Conduct | 同意行为准则
- [x] My contribution is licensed under AGPL-3.0 | 贡献遵循 AGPL-3.0 许可证
🤖 Advisory Check Results
These are advisory checks to help improve code quality. They won't block your PR from being merged.
📋 PR Information
Title Format: ✅ Good - Follows Conventional Commits PR Size: 🟢 Small (36 lines: +30 -6)
🔧 Backend Checks
Go Formatting: ⚠️ Needs formatting
Files needing formatting
api/server.go
manager/trader_manager.go
Go Vet: ✅ Good Tests: ✅ Passed
Fix locally:
go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests
⚛️ Frontend Checks
Build & Type Check: ✅ Success
Fix locally:
cd web
npm run build # Test build (includes type checking)
📖 Resources
Questions? Feel free to ask in the comments! 🙏
These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml.
🤖 Advisory Check Results
These are advisory checks to help improve code quality. They won't block your PR from being merged.
📋 PR Information
Title Format: ✅ Good - Follows Conventional Commits PR Size: 🟢 Small (39 lines: +32 -7)
🔧 Backend Checks
Go Formatting: ✅ Good Go Vet: ✅ Good Tests: ✅ Passed
Fix locally:
go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests
⚛️ Frontend Checks
Build & Type Check: ✅ Success
Fix locally:
cd web
npm run build # Test build (includes type checking)
📖 Resources
Questions? Feel free to ask in the comments! 🙏
These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml.
Could you provide a snapshot for this?
Havet got what this used for can put some business scenario and test screenshot ? Thanks.
@the-dev-z
🤖 Advisory Check Results
These are advisory checks to help improve code quality. They won't block your PR from being merged.
📋 PR Information
Title Format: ✅ Good - Follows Conventional Commits PR Size: 🟢 Small (17 lines: +11 -6)
🔧 Backend Checks
Go Formatting: ⚠️ Needs formatting
Files needing formatting
decision/prompt_manager_test.go
market/data_test.go
trader/hyperliquid_trader_race_test.go
Go Vet: ✅ Good Tests: ✅ Passed
Fix locally:
go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests
⚛️ Frontend Checks
Build & Type Check: ✅ Success
Fix locally:
cd web
npm run build # Test build (includes type checking)
📖 Resources
Questions? Feel free to ask in the comments! 🙏
These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 14 committers have signed the CLA.
:white_check_mark: tinkle-community
:x: xqliu
:x: tangmengqiu
:x: the-dev-z
:x: tinkle
:x: hzb1115
:x: Icyoung
:x: deloz
:x: CoderMageFox
:x: wquguru
:x: 0xEmberZz
:x: ljh740
:x: Im-Sue
:x: zpng
tinkle seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.