From 2c416084dee5d339df5252135b8214fc02b058ca Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Fri, 19 Jun 2026 00:44:42 +0800 Subject: [PATCH] Refine strategy switch layout and DCA naming --- tests/strategy_switch_worker_validation.mjs | 12 +- web/strategy-switch-console/index.html | 143 +++++++++--------- web/strategy-switch-console/page_asset.js | 2 +- .../strategy-profiles.example.json | 6 +- .../strategy_profiles_asset.js | 2 +- 5 files changed, 83 insertions(+), 82 deletions(-) diff --git a/tests/strategy_switch_worker_validation.mjs b/tests/strategy_switch_worker_validation.mjs index f18605e..ae0508f 100644 --- a/tests/strategy_switch_worker_validation.mjs +++ b/tests/strategy_switch_worker_validation.mjs @@ -34,16 +34,18 @@ assert.ok(indexHtml.includes('incomeLayerStartUsdVariable = "INCOME_LAYER_START_ assert.ok(indexHtml.includes('el("income-layer-mode-select").addEventListener("change"')); assert.ok(indexHtml.includes('el("income-layer-start-usd-input").addEventListener("input"')); assert.ok(indexHtml.includes('el("income-layer-max-ratio-input").addEventListener("input"')); -assert.ok(indexHtml.includes('label_zh: "纳斯达克 / 标普智能定投"')); +assert.ok(indexHtml.includes('label_zh: "纳指100 / 标普500 智能定投"')); +assert.ok(indexHtml.includes('class="form-section income-layer-section"')); +assert.ok(indexHtml.includes('class="control-block reserve-policy-block section-wide"')); assert.ok(indexHtml.includes('profile: "ibit_smart_dca"')); assert.ok(indexHtml.includes('IBIT 比特币 ETF 智能定投')); assert.ok(indexHtml.includes('localStrategyLabels')); assert.ok(indexHtml.includes('function strategyLabelSet(')); assert.ok(indexHtml.includes("account-block")); assert.ok(indexHtml.includes("strategy-block")); -assert.ok(indexHtml.includes("grid-template-columns: repeat(4, minmax(0, 1fr));")); -assert.ok(indexHtml.includes("grid-column: 1 / span 2;")); -assert.ok(indexHtml.includes("grid-column: 3 / span 2;")); +assert.ok(indexHtml.includes(".form-section {")); +assert.ok(indexHtml.includes(".form-section + .form-section")); +assert.ok(indexHtml.includes("grid-template-columns: repeat(2, minmax(0, 1fr));")); assert.ok(indexHtml.includes("grid-column: 1 / -1;")); assert.ok(indexHtml.includes('reservePolicyNone')); assert.ok(indexHtml.includes('reservePolicyRatio')); @@ -74,7 +76,7 @@ assert.ok(indexHtml.includes('function currentReservedCashPolicyText(')); assert.ok(indexHtml.includes('function hasPendingChanges(')); assert.ok(indexHtml.includes('function pendingChangeState(')); assert.ok(indexHtml.includes('reservedCashTouched: false')); -assert.ok(indexHtml.includes('.reserve-ratio-block')); +assert.ok(indexHtml.includes('reserve-ratio-block')); assert.ok(indexHtml.includes('.summary-row.pending')); assert.ok(indexHtml.includes('function currentEntryHasState(')); assert.ok(indexHtml.includes('changes.reserveCashChanged')); diff --git a/web/strategy-switch-console/index.html b/web/strategy-switch-console/index.html index f7e783e..217220b 100644 --- a/web/strategy-switch-console/index.html +++ b/web/strategy-switch-console/index.html @@ -406,9 +406,9 @@ .quick-form { display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); + grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; - gap: 14px; + gap: 16px 14px; } .control-block { @@ -422,20 +422,21 @@ font-weight: 760; } - .account-block, - .account-status-block, - .income-layer-mode-block, - .income-layer-start-block, - .min-reserve-block { - grid-column: 1 / span 2; + .form-section { + grid-column: 1 / -1; + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + align-items: start; + gap: 14px; + } + + .form-section + .form-section { + padding-top: 16px; + border-top: 1px solid var(--line); } - .strategy-block, - .plugin-mode-block, - .reserve-policy-block, - .income-layer-ratio-block, - .reserve-ratio-block { - grid-column: 3 / span 2; + .section-wide { + grid-column: 1 / -1; } .mode-block { @@ -666,21 +667,13 @@ } .platform-strip, - .quick-form { + .quick-form, + .form-section { grid-template-columns: 1fr; } - .account-block, - .strategy-block, .mode-block, - .account-status-block, - .plugin-mode-block, - .reserve-policy-block, - .income-layer-mode-block, - .income-layer-start-block, - .income-layer-ratio-block, - .min-reserve-block, - .reserve-ratio-block { + .section-wide { grid-column: auto; } @@ -793,53 +786,59 @@

LongBridge

- - - - - - - - - - - +
+ + + +
- +
+ + + + + +
- +
+ + + + + +
@@ -901,7 +900,7 @@

切换摘要

const defaultStrategyProfiles = [ { profile: "tqqq_growth_income", label: "TQQQ Growth Income", label_en: "TQQQ Growth Income", label_zh: "TQQQ 增长收益", domain: "us_equity", runtime_enabled: true }, { profile: "soxl_soxx_trend_income", label: "SOXL/SOXX Semiconductor Trend Income", label_en: "SOXL/SOXX Semiconductor Trend Income", label_zh: "SOXL/SOXX 半导体趋势收益", domain: "us_equity", runtime_enabled: true }, - { profile: "nasdaq_sp500_smart_dca", label: "Nasdaq/S&P 500 Smart DCA", label_en: "Nasdaq/S&P 500 Smart DCA", label_zh: "纳斯达克 / 标普智能定投", domain: "us_equity", runtime_enabled: true }, + { profile: "nasdaq_sp500_smart_dca", label: "Nasdaq 100 / S&P 500 Smart DCA", label_en: "Nasdaq 100 / S&P 500 Smart DCA", label_zh: "纳指100 / 标普500 智能定投", domain: "us_equity", runtime_enabled: true }, { profile: "ibit_smart_dca", label: "IBIT Smart DCA", label_en: "IBIT Smart DCA", label_zh: "IBIT 比特币 ETF 智能定投", domain: "us_equity", runtime_enabled: true }, { profile: "global_etf_rotation", label: "Global ETF Rotation", label_en: "Global ETF Rotation", label_zh: "全球 ETF 轮动", domain: "us_equity", runtime_enabled: true }, { profile: "russell_1000_multi_factor_defensive", label: "Russell 1000 Multi-Factor Defensive", label_en: "Russell 1000 Multi-Factor Defensive", label_zh: "罗素 1000 多因子防御", domain: "us_equity", runtime_enabled: true }, @@ -914,7 +913,7 @@

切换摘要

const localStrategyLabels = { tqqq_growth_income: { zh: "TQQQ 增长收益", en: "TQQQ Growth Income" }, soxl_soxx_trend_income: { zh: "SOXL/SOXX 半导体趋势收益", en: "SOXL/SOXX Semiconductor Trend Income" }, - nasdaq_sp500_smart_dca: { zh: "纳斯达克 / 标普智能定投", en: "Nasdaq/S&P 500 Smart DCA" }, + nasdaq_sp500_smart_dca: { zh: "纳指100 / 标普500 智能定投", en: "Nasdaq 100 / S&P 500 Smart DCA" }, ibit_smart_dca: { zh: "IBIT 比特币 ETF 智能定投", en: "IBIT Smart DCA" }, global_etf_rotation: { zh: "全球 ETF 轮动", en: "Global ETF Rotation" }, russell_1000_multi_factor_defensive: { zh: "罗素 1000 多因子防御", en: "Russell 1000 Multi-Factor Defensive" }, diff --git a/web/strategy-switch-console/page_asset.js b/web/strategy-switch-console/page_asset.js index 5e0035e..76c3220 100644 --- a/web/strategy-switch-console/page_asset.js +++ b/web/strategy-switch-console/page_asset.js @@ -1,2 +1,2 @@ // Generated by scripts/sync_strategy_switch_page_asset.py; do not edit by hand. -export const PAGE_HTML = "\n\n\n \n \n \n QuantRuntimeSettings Strategy Switch\n \n\n\n
\n
\n

策略切换

\n

选平台、目标账号和策略,一次执行完成切换。

\n
\n
\n \n \n \n \n
\n
\n\n
\n
\n 初始化控制台\n

读取策略配置

\n

正在读取登录状态、账号配置和当前状态。

\n
\n
\n
\n\n
\n \n\n
\n
\n
\n 当前平台\n

LongBridge

\n
\n\n \n\n
\n \n\n \n\n
\n 模式\n
\n \n \n
\n
\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n
\n\n
\n \n

登录后才可执行切换。

\n

\n
\n
\n\n \n
\n
\n\n \n\n\n"; +export const PAGE_HTML = "\n\n\n \n \n \n QuantRuntimeSettings Strategy Switch\n \n\n\n
\n
\n

策略切换

\n

选平台、目标账号和策略,一次执行完成切换。

\n
\n
\n \n \n \n \n
\n
\n\n
\n
\n 初始化控制台\n

读取策略配置

\n

正在读取登录状态、账号配置和当前状态。

\n
\n
\n
\n\n
\n \n\n
\n
\n
\n 当前平台\n

LongBridge

\n
\n\n \n\n
\n \n\n \n\n
\n 模式\n
\n \n \n
\n
\n\n
\n \n\n \n
\n\n
\n \n\n \n\n \n
\n\n
\n \n\n \n\n \n
\n
\n\n
\n \n

登录后才可执行切换。

\n

\n
\n
\n\n \n
\n
\n\n \n\n\n"; diff --git a/web/strategy-switch-console/strategy-profiles.example.json b/web/strategy-switch-console/strategy-profiles.example.json index 261ec91..508bd5b 100644 --- a/web/strategy-switch-console/strategy-profiles.example.json +++ b/web/strategy-switch-console/strategy-profiles.example.json @@ -17,9 +17,9 @@ }, { "profile": "nasdaq_sp500_smart_dca", - "label": "Nasdaq/S&P 500 Smart DCA", - "label_en": "Nasdaq/S&P 500 Smart DCA", - "label_zh": "纳斯达克 / 标普智能定投", + "label": "Nasdaq 100 / S&P 500 Smart DCA", + "label_en": "Nasdaq 100 / S&P 500 Smart DCA", + "label_zh": "纳指100 / 标普500 智能定投", "domain": "us_equity", "runtime_enabled": true }, diff --git a/web/strategy-switch-console/strategy_profiles_asset.js b/web/strategy-switch-console/strategy_profiles_asset.js index f45417e..c386541 100644 --- a/web/strategy-switch-console/strategy_profiles_asset.js +++ b/web/strategy-switch-console/strategy_profiles_asset.js @@ -1,2 +1,2 @@ // Generated by scripts/sync_strategy_switch_page_asset.py; do not edit by hand. -export const DEFAULT_STRATEGY_PROFILES = [{"profile": "tqqq_growth_income", "label": "TQQQ Growth Income", "label_en": "TQQQ Growth Income", "label_zh": "TQQQ 增长收益", "domain": "us_equity", "runtime_enabled": true}, {"profile": "soxl_soxx_trend_income", "label": "SOXL/SOXX Semiconductor Trend Income", "label_en": "SOXL/SOXX Semiconductor Trend Income", "label_zh": "SOXL/SOXX 半导体趋势收益", "domain": "us_equity", "runtime_enabled": true}, {"profile": "nasdaq_sp500_smart_dca", "label": "Nasdaq/S&P 500 Smart DCA", "label_en": "Nasdaq/S&P 500 Smart DCA", "label_zh": "纳斯达克 / 标普智能定投", "domain": "us_equity", "runtime_enabled": true}, {"profile": "ibit_smart_dca", "label": "IBIT Smart DCA", "label_en": "IBIT Smart DCA", "label_zh": "IBIT 比特币 ETF 智能定投", "domain": "us_equity", "runtime_enabled": true}, {"profile": "global_etf_rotation", "label": "Global ETF Rotation", "label_en": "Global ETF Rotation", "label_zh": "全球 ETF 轮动", "domain": "us_equity", "runtime_enabled": true}, {"profile": "russell_1000_multi_factor_defensive", "label": "Russell 1000 Multi-Factor Defensive", "label_en": "Russell 1000 Multi-Factor Defensive", "label_zh": "罗素 1000 多因子防御", "domain": "us_equity", "runtime_enabled": true}, {"profile": "mega_cap_leader_rotation_top50_balanced", "label": "Mega Cap Leader Rotation Top50 Balanced", "label_en": "Mega Cap Leader Rotation Top50 Balanced", "label_zh": "美股巨头 Top50 均衡轮动", "domain": "us_equity", "runtime_enabled": true}, {"profile": "hk_dividend_gold_defensive_rotation", "label": "HK Dividend-Gold Defensive Rotation", "label_en": "HK Dividend-Gold Defensive Rotation", "label_zh": "港股红利黄金防御轮动", "domain": "hk_equity", "runtime_enabled": true}, {"profile": "hk_global_etf_tactical_rotation", "label": "HK Global ETF Tactical Rotation", "label_en": "HK Global ETF Tactical Rotation", "label_zh": "港股全球 ETF 战术轮动", "domain": "hk_equity", "runtime_enabled": true}, {"profile": "hk_low_vol_dividend_quality_snapshot", "label": "HK Low-Vol Dividend Quality Snapshot", "label_en": "HK Low-Vol Dividend Quality Snapshot", "label_zh": "港股低波红利质量快照", "domain": "hk_equity", "runtime_enabled": true}]; +export const DEFAULT_STRATEGY_PROFILES = [{"profile": "tqqq_growth_income", "label": "TQQQ Growth Income", "label_en": "TQQQ Growth Income", "label_zh": "TQQQ 增长收益", "domain": "us_equity", "runtime_enabled": true}, {"profile": "soxl_soxx_trend_income", "label": "SOXL/SOXX Semiconductor Trend Income", "label_en": "SOXL/SOXX Semiconductor Trend Income", "label_zh": "SOXL/SOXX 半导体趋势收益", "domain": "us_equity", "runtime_enabled": true}, {"profile": "nasdaq_sp500_smart_dca", "label": "Nasdaq 100 / S&P 500 Smart DCA", "label_en": "Nasdaq 100 / S&P 500 Smart DCA", "label_zh": "纳指100 / 标普500 智能定投", "domain": "us_equity", "runtime_enabled": true}, {"profile": "ibit_smart_dca", "label": "IBIT Smart DCA", "label_en": "IBIT Smart DCA", "label_zh": "IBIT 比特币 ETF 智能定投", "domain": "us_equity", "runtime_enabled": true}, {"profile": "global_etf_rotation", "label": "Global ETF Rotation", "label_en": "Global ETF Rotation", "label_zh": "全球 ETF 轮动", "domain": "us_equity", "runtime_enabled": true}, {"profile": "russell_1000_multi_factor_defensive", "label": "Russell 1000 Multi-Factor Defensive", "label_en": "Russell 1000 Multi-Factor Defensive", "label_zh": "罗素 1000 多因子防御", "domain": "us_equity", "runtime_enabled": true}, {"profile": "mega_cap_leader_rotation_top50_balanced", "label": "Mega Cap Leader Rotation Top50 Balanced", "label_en": "Mega Cap Leader Rotation Top50 Balanced", "label_zh": "美股巨头 Top50 均衡轮动", "domain": "us_equity", "runtime_enabled": true}, {"profile": "hk_dividend_gold_defensive_rotation", "label": "HK Dividend-Gold Defensive Rotation", "label_en": "HK Dividend-Gold Defensive Rotation", "label_zh": "港股红利黄金防御轮动", "domain": "hk_equity", "runtime_enabled": true}, {"profile": "hk_global_etf_tactical_rotation", "label": "HK Global ETF Tactical Rotation", "label_en": "HK Global ETF Tactical Rotation", "label_zh": "港股全球 ETF 战术轮动", "domain": "hk_equity", "runtime_enabled": true}, {"profile": "hk_low_vol_dividend_quality_snapshot", "label": "HK Low-Vol Dividend Quality Snapshot", "label_en": "HK Low-Vol Dividend Quality Snapshot", "label_zh": "港股低波红利质量快照", "domain": "hk_equity", "runtime_enabled": true}];