Commit Graph

119 Commits

Author SHA1 Message Date
ZhouYongyou
8d796357b2 fix: 修復初始余額顯示錯誤(使用當前淨值而非配置值)
問題:
- 圖表顯示「初始余額 693.15 USDT」(實際應該是 600)
- 原因:使用 validHistory[0].total_equity(當前淨值)
- 導致初始余額隨著盈虧變化,數學邏輯錯誤

修復:
- 優先從 account.initial_balance 讀取真實配置值
- 備選方案:從歷史數據反推(淨值 - 盈虧)
- 默認值使用 1000(與創建交易員時的默認配置一致)

測試:
- 初始余額:600 USDT(固定)
- 當前淨值:693.15 USDT
- 盈虧:+93.15 USDT (+15.52%) ✓
2025-11-04 17:35:26 +08:00
Ember
0756c6d6f2 feat: Add Binance setup guide with tutorial modal
- Add Binance configuration tutorial image (guide.png)
- Implement "View Guide" button in exchange configuration modal
- Add tutorial display modal with image viewer
- Add i18n support for guide-related text (EN/ZH)
- Button only appears when configuring Binance exchange

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 14:50:38 +08:00
Icyoung
045535c8cc Merge pull request #361 from Icyoung/beta
Beta bugfix
2025-11-04 02:14:54 +08:00
icy
793a064a27 Add NOFX watermarks to charts and fix empty state internationalization
- Add NOFX watermark to ComparisonChart (competition page)
- Add NOFX watermark to EquityChart (dashboard page)
- Fix empty state handling and internationalization in CompetitionPage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 02:08:38 +08:00
icy
d8f325dc36 Fix ComparisonChart data display issue
The chart was not showing data because the API response format changed.
Fixed the calculation of PnL percentage by computing it from total_pnl
and balance values (initial_balance = balance - total_pnl).

Now the AI competition chart should properly display performance comparison data.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:54:21 +08:00
Icyoung
88d46b1dde Merge pull request #359 from Icyoung/beta
Beta Merge dev、Bug fix
2025-11-04 01:50:34 +08:00
icy
5507ae7b13 Remove all test dependencies and configurations
- Removed test script from package.json
- Removed testing dependencies (@testing-library/react, vitest, jsdom)
- Deleted test directory and vitest.config.ts
- Updated package-lock.json to reflect changes
- Build still works perfectly without test dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:44:40 +08:00
icy
e25f04c642 Remove unused test files
Removed App.test.tsx and AITradersPage.test.tsx that were causing TypeScript build issues and are not currently in use.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:43:02 +08:00
icy
8ca6f68867 Fix TypeScript build error
Removed unused 'Zap' import from App.tsx that was causing build failure.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:42:25 +08:00
icy
3af2dd41fb Fix: Add proper top padding to prevent HeaderBar overlap on all main app pages
Match main app layout with proven working /competition route layout:
- Use px-6 py-6 pt-24 padding (same as /competition route)
- Ensures HeaderBar doesn't overlap content on /traders and /dashboard pages
- Provides consistent 6rem (96px) top clearance for fixed positioned HeaderBar
- Removes responsive padding variants that differed from competition page

This fixes header overlap issues across all main application routes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:29:39 +08:00
icy
bfbefa0b33 Fix: Unify all pages to use HeaderBar component consistently
Replace the inline header implementation in main app with HeaderBar component to match landing page:
- Remove duplicate inline header code (168 lines)
- Use HeaderBar component for all main app pages like landing page does
- Ensure consistent header design across all routes (/competition, /traders, /dashboard)
- Maintain proper onPageChange navigation handling
- Keep all header functionality (user info, admin mode, language toggle, logout)

This fixes the header inconsistency where different pages used different header implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 01:04:16 +08:00
Liu Xiang Qian
72a373e9e4 Revert "Merge pull request #229 from xqliu/test/add-ut-infrastructure"
This reverts commit 683e77b92f, reversing
changes made to 791cecd2ff.
2025-11-04 00:58:12 +08:00
icy
f68cb60aeb Merge branch 'dev' into beta 2025-11-04 00:17:50 +08:00
icy
1ae1f90d8a Limit performance comparison chart to top 5 traders
Frontend changes to ensure equity-history-batch API only requests data for top 5 performers:
- Modify CompetitionPage to pass only top 5 traders to ComparisonChart component
- Update API comments to reflect the change from top 10 to top 5
- Optimize chart performance by reducing data volume and API calls

This ensures the performance comparison chart shows only the most relevant traders while improving load times.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 00:16:14 +08:00
icy
d5e0e1d8d5 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 23:46:54 +08:00
SkywalkerJi
683e77b92f Merge pull request #229 from xqliu/test/add-ut-infrastructure
test: Add minimal UT infrastructure and fix Issue #227
2025-11-04 00:28:34 +09:00
Liu Xiang Qian
cc448bf6e2 fix: Remove unused variables in AITradersPage.test.tsx to fix TypeScript compilation
Fixed TypeScript compilation errors by removing unused imports and variables:
- Removed unused 'screen' import from test-utils
- Removed unused 'fetcher' parameter from SWR mock
- Removed unused 'mockTrader' variable
- Removed unused 'TraderInfo' type import

All tests still pass (5/5) and frontend now compiles successfully.
2025-11-03 23:20:55 +08:00
icy
e553adcdbb Merge branch 'dev' into beta 2025-11-03 23:19:52 +08:00
icy
c6b9479cac Merge branch 'tinkle-nofx/dev' with conflict resolution
- Resolve UI layout conflicts in App.tsx
- Keep modern Binance-style header with authentication logic
- Maintain responsive design and user interface improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 23:19:25 +08:00
icy
e762939655 Prevent my-traders API calls when user is not logged in
- Add authentication checks to SWR calls in App.tsx and AITradersPage.tsx
- Only call api.getTraders when user and token are available
- Modify loadConfigs to skip authenticated API calls when not logged in
- Load only public supported models/exchanges for unauthenticated users
- Update useEffect dependencies to include user and token

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 23:14:10 +08:00
icy
cacdaf0b82 Add internationalization for AI scan interval configuration
- Add aiScanInterval and scanIntervalRecommend translation keys to translations.ts
- Update TraderConfigModal to use internationalized text instead of hardcoded Chinese
- Support language switching for scan interval labels and recommendations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:40:50 +08:00
Icyoung
791cecd2ff Merge pull request #336 from 0xEmberZz/fix-mobile-display-v2
UI : Fix mobile display
2025-11-03 22:40:17 +08:00
icy
8db61e085f Merge dev branch with conflict resolution
- Resolve TypeScript interface formatting conflict in CommunitySection.tsx
- Include updates from dev branch

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:31:01 +08:00
icy
b8492dec36 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 22:29:01 +08:00
icy
32bcd82c08 Optimize frontend to use batch API for equity history requests
- Add batch API methods (getEquityHistoryBatch, getTopTraders, getPublicTraderConfig) to api.ts
- Update ComparisonChart to use batch endpoint instead of individual calls
- Reduce network requests from 10 to 1 for performance comparison page
- Maintain backward compatibility with existing data structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:04:34 +08:00
Liu Xiang Qian
ddf6c44d65 feat: 添加 AI 扫描决策间隔配置支持
## 功能描述

在创建和编辑 Trader 时,支持配置 AI 扫描决策间隔(scan_interval_minutes),允许用户自定义 AI 决策的频率。

## 修改内容

### 后端修改 (api/server.go)

1. **CreateTraderRequest** 添加 `ScanIntervalMinutes` 字段
2. **UpdateTraderRequest** 添加 `ScanIntervalMinutes` 字段和 `SystemPromptTemplate` 字段
3. **handleCreateTrader** 处理扫描间隔默认值(默认 3 分钟)
4. **handleUpdateTrader** 支持更新扫描间隔
5. **handleGetTraderConfig** 返回中添加 `scan_interval_minutes` 字段

### 前端修改

#### web/src/types.ts
- `CreateTraderRequest` 添加 `scan_interval_minutes?` 可选字段
- `TraderConfigData` 添加 `scan_interval_minutes` 必填字段

#### web/src/components/TraderConfigModal.tsx
- 本地 `TraderConfigData` 接口添加 `scan_interval_minutes`
- 初始状态设置默认值为 3 分钟
- 添加 UI 输入框(范围 1-60 分钟)
- Label 优化为 "AI 扫描决策间隔 (分钟)"

#### web/src/components/AITradersPage.tsx
- `handleSaveEditTrader` 的更新请求中添加 `scan_interval_minutes`

#### web/src/components/landing/CommunitySection.tsx
- 修复 TypeScript 编译错误:定义 `CardProps` 接口
- 修正 `TestimonialCard` 组件的 prop 名称(author → authorName)

## 功能特性

-  支持 1-60 分钟的自定义间隔
-  默认值为 3 分钟
-  UI 提示建议范围:3-10 分钟
-  创建和编辑时均支持配置
-  后端验证和处理默认值

## 测试步骤

1. 创建新 Trader,设置自定义扫描间隔(如 10 分钟)
2. 验证 Trader 创建成功
3. 编辑现有 Trader,修改扫描间隔
4. 验证修改保存成功
5. 确认 AI 决策按照新的间隔执行
2025-11-03 21:55:26 +08:00
Ember
7a4e9f145c feat(web): comprehensive mobile responsive optimization for AI Traders and Competition pages
Optimized mobile display for AITradersPage:
- Header: Reduced padding (px-3 on mobile), smaller icons and text
- Action buttons: Smaller on mobile (px-3, text-xs) with horizontal scroll support
- Configuration cards: Responsive padding (p-3 on mobile), smaller gaps
- Model/Exchange items: Smaller icons (w-7 on mobile), truncate text overflow
- Trader list: Stack vertically on mobile, smaller buttons with wrapping support
- Empty states: Smaller icons and text on mobile

Maintained all i18n translations and preserved Binance design style.

Addresses #311

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:46:07 +08:00
Ember
4f4e9f2ca9 fix: improve mobile responsive layout for header and comparison chart
This is a partial fix for issue #311 mobile display problems.

Changes in this commit:
- Add responsive header layout with separate mobile/desktop views in App.tsx
- Fix language selector visibility on mobile (no longer hidden by menu)
- Add responsive breakpoints to ComparisonChart stats grid (2 cols on mobile, 4 on desktop)
- Adjust padding and text sizes for mobile screens
- Preserve all i18n (internationalization) functionality from upstream

Note: Additional components (CompetitionPage, AITradersPage) will need similar mobile
responsive improvements in follow-up commits.

Related to #311

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:38:52 +08:00
icy
290a1ac892 Fix TypeScript error in CommunitySection component
- Add missing CardProps interface definition
- Update TestimonialCard component to use correct prop types
- Fix authorName prop usage instead of author
- Resolve build error: Cannot find name 'CardProps'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 20:25:07 +08:00
icy
71e584008f Resolve merge conflicts in go.sum
- Keep newer version of go-sqlite3 (v1.14.32)
- Complete merge from dev branch

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 19:33:50 +08:00
icy
a86e0a4633 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 19:32:03 +08:00
Ember
f3cc95d267 Merge branch 'dev' into quote-tweet-link 2025-11-02 23:56:46 +08:00
Ember
a7a0bdff41 chore(landing): add lightweight AnimatedSection wrapper for main-based branch 2025-11-02 23:52:15 +08:00
Ember
97015d31a2 chore(landing): add lightweight AnimatedSection wrapper for main-based branch 2025-11-02 23:49:23 +08:00
Ember
0b86916d8c feat(landing): integrate real community tweets in CommunitySection with author avatars and links 2025-11-02 23:48:25 +08:00
icy
eae928ddf7 Merge branch 'dev' into beta
# Conflicts:
#	config/database.go
#	main.go
2025-11-02 22:11:07 +08:00
icy
dcf9dfc468 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-02 21:54:02 +08:00
Liu Xiang Qian
4577adabbd fix: Update model validation in handleSaveModelConfig to support both configured and supported models
- Change validation to check allModels first, then supportedModels
- This allows saving new model configurations without "model does not exist" error
- Fixes issue where users couldn't save AI model config after selecting from dropdown

Fixes #245

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 18:08:25 +08:00
Liu Xiang Qian
9ab7a36fbb test: Add minimal UT infrastructure and fix Issue #227
This commit sets up a minimal, KISS-principle testing infrastructure
for both backend and frontend, and includes the fix for Issue #227.

Backend Changes:
- Add Makefile with test commands (test, test-backend, test-frontend, test-coverage)
- Add example test: config/database_test.go
- Fix Go 1.25 printf format string warnings in trader/auto_trader.go
  (Changed log.Printf to log.Print for non-format strings)
- All backend tests pass ✓

Frontend Changes:
- Add Vitest configuration: web/vitest.config.ts (minimal setup)
- Add test utilities: web/src/test/test-utils.tsx
- Add example test: web/src/App.test.tsx
- Add dependencies: vitest, jsdom, @testing-library/react
- All frontend tests pass ✓

Issue #227 Fix:
- Fix AITradersPage to allow editing traders with disabled models/exchanges
- Change validation to use allModels/allExchanges instead of enabledModels/enabledExchanges
- Add comprehensive tests in web/src/components/AITradersPage.test.tsx
- Fixes: https://github.com/tinkle-community/nofx/issues/227

CI/CD:
- Add GitHub Actions workflow: .github/workflows/test.yml
- Non-blocking tests (continue-on-error: true)
- Runs on push/PR to main and dev branches

Test Results:
- Backend: 1 test passing
- Frontend: 5 tests passing (including 4 for Issue #227)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 10:58:31 +08:00
icy
f24b0fc2ab fix: resolve merge conflicts in RegisterPage.tsx
- Remove merge conflict markers
- Keep HeaderBar import instead of ArrowLeft
- Remove duplicate betaMode state declaration
- Remove duplicate useEffect hook
- Update translation keys to use authStep* variants
- Ensure proper beta mode functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 07:05:07 +08:00
icy
7c395a7585 fix: use CSS variables for form background in RegisterPage
Replace hardcoded colors with CSS variables:
- background: var(--panel-bg)
- border: var(--panel-border)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:43:39 +08:00
icy
f04e36f1b5 fix: restore header bar and fix layout in RegisterPage
- Add HeaderBar component to registration page
- Change background to use CSS variables (var(--brand-black))
- Remove "back to home" button
- Update layout structure to match LoginPage pattern
- Fix container padding and spacing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:42:51 +08:00
icy
703b929aba fix: resolve all TypeScript build errors
- Remove unused imports (LoginModal, Zap) and variables
- Fix Language type mismatches across components
- Update HeaderBar interface to use Language type
- Remove unused onLoginClick parameter
- Fix duplicate translation keys by renaming auth steps
- Remove invalid language prop from CommunitySection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:39:23 +08:00
icy
8069e7f0c5 fix: add beta_mode property to SystemConfig interface
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:31:51 +08:00
icy
b8c3488e1f fix: remove extra closing div tag in RegisterPage JSX
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:25:09 +08:00
icy
ce371860d1 feat: update UI components and add new assets
- Update App, CompetitionPage, CryptoFeatureCard components with improvements
- Enhance Header and LoginPage components
- Update styling in index.css and API configurations
- Add new hand background and hand image assets
- Remove old logo.png file
- Update server configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:23:06 +08:00
icy
5668d4ec63 feat(auth): integrate beta mode functionality in registration
- Add beta code input field to registration form when beta mode is enabled
- Check system config on component mount to determine beta mode status
- Require 6-character alphanumeric beta code for registration in beta mode
- Maintain existing internationalization and styling patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:22:38 +08:00
icy
b3103730c1 feat(i18n): internationalize footer and login modal components
- Update FooterSection to use language prop pattern instead of useLanguage hook
- Add language prop support to LoginModal component
- Ensure consistent internationalization approach across UI components
- Maintain proper prop interfaces for language handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:22:16 +08:00
icy
621f105ddd feat(i18n): internationalize landing page sections
- Update AboutSection, FeaturesSection, HowItWorksSection to use language prop pattern
- Replace useLanguage hook with language prop interface for consistency
- Add comprehensive internationalization support for landing page content
- Update HeroSection and LandingPage to support language prop flow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:21:48 +08:00
icy
e0347162cf feat(i18n): add navigation internationalization
- Add Chinese/English translations for navigation buttons (实时/Real-time, 配置/Config, 看板/Dashboard)
- Update HeaderBar component to use translation system for navigation elements
- Add realtimeNav, configNav, dashboardNav translation keys
- Support both desktop and mobile navigation internationalization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 06:20:28 +08:00