-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(web): improve trader config UX for initial balance and prompt templates (#629 #630) #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(web): improve trader config UX for initial balance and prompt templates (#629 #630) #673
Conversation
🤖 Advisory Check ResultsThese are advisory checks to help improve code quality. They won't block your PR from being merged. 📋 PR InformationTitle Format: ✅ Good - Follows Conventional Commits 🔧 Backend ChecksGo Formatting: Files needing formattingGo Vet: ✅ Good Fix locally: go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests⚛️ Frontend ChecksBuild & Type Check: ✅ Success Fix locally: cd web
npm run build # Test build (includes type checking)📖 ResourcesQuestions? 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. |
0eb10b4 to
c4c6e18
Compare
🤖 Advisory Check ResultsThese are advisory checks to help improve code quality. They won't block your PR from being merged. 📋 PR InformationTitle Format: ✅ Good - Follows Conventional Commits 🔧 Backend ChecksGo Formatting: Files needing formattingGo Vet: ✅ Good Fix locally: go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests⚛️ Frontend ChecksBuild & Type Check: ✅ Success Fix locally: cd web
npm run build # Test build (includes type checking)📖 ResourcesQuestions? 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. |
…mplates (NoFxAiOS#629 NoFxAiOS#630) - Add onBlur validation for initial_balance input to enforce minimum of 100 - Add detailed prompt template descriptions with i18n support - Fix Traditional Chinese to Simplified Chinese - Extract hardcoded Chinese text to i18n translation system - Add translation keys for all prompt templates and descriptions Fixes NoFxAiOS#629, Fixes NoFxAiOS#630
c4c6e18 to
cf92a4e
Compare
🤖 Advisory Check ResultsThese are advisory checks to help improve code quality. They won't block your PR from being merged. 📋 PR InformationTitle Format: ✅ Good - Follows Conventional Commits 🔧 Backend ChecksGo Formatting: Files needing formattingGo Vet: ✅ Good Fix locally: go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests⚛️ Frontend ChecksBuild & Type Check: ✅ Success Fix locally: cd web
npm run build # Test build (includes type checking)📖 ResourcesQuestions? 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. |
谈不上专业,就稳健、风险、多空均衡的基础策略 |
代码审查报告 - PR #673审查结果:✅ 通过(UX改进)业务层面审查✅ 需求验证
✅ 功能完整性
技术层面审查✅ 问题#629 - 初始余额UX一致性问题分析: 解决方案: onBlur={(e) => {
const value = Number(e.target.value)
if (value < 100) {
handleInputChange('initial_balance', 100)
}
}}优点:
✅ 问题#630 - Prompt模板描述问题分析: 解决方案:
{
'default': '📊 默认稳健',
'adaptive': '🛡️ 保守策略',
'adaptive_relaxed': '⚡ 激进策略',
'Hansen': '🎯 Hansen 策略',
'nof1': '🌐 NoF1 英文框架',
'taro_long_prompts': '📈 Taro 长仓',
}
<div className="mt-2 p-3 rounded" style={{...}}>
<div className="text-xs font-semibold mb-1">
📊 默认稳健策略
</div>
<div className="text-xs">
最大化夏普比率,平衡风险收益,适合新手和长期稳定交易
</div>
</div>优点:
E2E 验证报告✅ 测试场景1:初始余额低于最小值✅ 测试场景2:初始余额箭头按钮✅ 测试场景3:Prompt模板选择✅ 测试场景4:多语言切换代码质量审查✅ 代码结构模板名称映射: const getTemplateName = (name: string) => {
const keyMap: Record<string, string> = {
default: 'promptTemplateDefault',
adaptive: 'promptTemplateAdaptive',
// ...
}
const key = keyMap[name]
return key ? t(key, language) : name.charAt(0).toUpperCase() + name.slice(1)
}优点:
✅ i18n 集成完整的翻译:
命名规范:
✅ UI一致性描述框样式: style={{
background: 'rgba(240, 185, 11, 0.05)', // 金色淡背景
border: '1px solid rgba(240, 185, 11, 0.15)', // 金色边框
}}符合Binance设计规范:
🟡 改进建议(非 BLOCKING)建议1:提取模板配置// 提取为独立配置文件
// src/config/promptTemplates.ts
export const PROMPT_TEMPLATES = {
default: {
nameKey: 'promptTemplateDefault',
descKey: 'promptDescDefault',
contentKey: 'promptDescDefaultContent',
icon: '📊',
},
adaptive: {
nameKey: 'promptTemplateAdaptive',
descKey: 'promptDescAdaptive',
contentKey: 'promptDescAdaptiveContent',
icon: '🛡️',
},
// ...
} as const
// 使用
{PROMPT_TEMPLATES[template.name] && (
<option value={template.name}>
{PROMPT_TEMPLATES[template.name].icon} {t(PROMPT_TEMPLATES[template.name].nameKey, language)}
</option>
)}建议2:添加Tooltip// 为每个模板添加悬停提示
<Tooltip content={t(contentKey, language)}>
<option value={template.name}>
{getTemplateName(template.name)}
</option>
</Tooltip>建议3:添加预览功能// 允许用户预览完整的prompt内容
<button onClick={() => showPromptPreview(template.name)}>
预览完整提示词
</button>建议4:添加帮助链接// 链接到文档或示例
<div className="mt-2">
<a href="/docs/prompt-templates" className="text-xs text-[#F0B90B]">
📖 查看详细策略说明
</a>
</div>UI/UX 设计验证✅ 用户体验改进Before - #629: After - #629: Before - #630: After - #630: ✅ 信息层次
性能影响✅ 无性能问题
总结这是一个高质量的UX改进 PR: 优点
改进空间(非 BLOCKING)
审查结论:✅ 通过,建议合并 重要性:
影响范围:
|
…mplates (NoFxAiOS#629 NoFxAiOS#630) (NoFxAiOS#673) - Add onBlur validation for initial_balance input to enforce minimum of 100 - Add detailed prompt template descriptions with i18n support - Fix Traditional Chinese to Simplified Chinese - Extract hardcoded Chinese text to i18n translation system - Add translation keys for all prompt templates and descriptions Fixes NoFxAiOS#629, Fixes NoFxAiOS#630
…mplates (NoFxAiOS#629 NoFxAiOS#630) (NoFxAiOS#673) - Add onBlur validation for initial_balance input to enforce minimum of 100 - Add detailed prompt template descriptions with i18n support - Fix Traditional Chinese to Simplified Chinese - Extract hardcoded Chinese text to i18n translation system - Add translation keys for all prompt templates and descriptions Fixes NoFxAiOS#629, Fixes NoFxAiOS#630
…mplates (#629 #630) (#673) - Add onBlur validation for initial_balance input to enforce minimum of 100 - Add detailed prompt template descriptions with i18n support - Fix Traditional Chinese to Simplified Chinese - Extract hardcoded Chinese text to i18n translation system - Add translation keys for all prompt templates and descriptions Fixes #629, Fixes #630
…mplates (#629 #630) (#673) - Add onBlur validation for initial_balance input to enforce minimum of 100 - Add detailed prompt template descriptions with i18n support - Fix Traditional Chinese to Simplified Chinese - Extract hardcoded Chinese text to i18n translation system - Add translation keys for all prompt templates and descriptions Fixes #629, Fixes #630
Pull Request - Frontend
Summary
Improves user experience in the trader configuration modal with two enhancements:
#629 - 初始金額 UX 一致性改進
Problem
Inconsistent behavior between manual input and arrow adjustments:
min="100"andstep="100"User Experience:
Solution
Add
onBlurvalidation to enforce minimum value consistently:Plus added helper text explaining the rule.
Impact
#630 - Prompt 模板添加详細描述
Problem
Poor discoverability for beginners:
Current UX:
Solution
Template Descriptions:
Impact
Changes
File:
web/src/components/TraderConfigModal.tsxInitial Balance (#629):
onBlurhandler to enforce min value (100 USDT)onChangefree for typingPrompt Templates (#630):
getTemplateName()mapping functionTesting
Fixes #629
Fixes #630
Co-Authored-By: Claude [email protected]
🎯 Type of Change | 變更類型
🔗 Related Issues | 相關 Issue
🧪 Testing | 測試
Test Environment | 測試環境
Manual Testing | 手動測試
🌐 Internationalization | 國際化
✅ Checklist | 檢查清單
Code Quality | 代碼質量
npm run build)npm run lint| 已運行npm run lintDocumentation | 文檔
Git
devbranch | 已 rebase 到最新dev分支By submitting this PR, I confirm | 提交此 PR,我確認:
🌟 Thank you for your contribution! | 感謝你的貢獻!