Skip to content

Commit 06db2fc

Browse files
authored
Refine strategy switch layout and DCA naming
1 parent 0702a1c commit 06db2fc

5 files changed

Lines changed: 83 additions & 82 deletions

File tree

tests/strategy_switch_worker_validation.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ assert.ok(indexHtml.includes('incomeLayerStartUsdVariable = "INCOME_LAYER_START_
3434
assert.ok(indexHtml.includes('el("income-layer-mode-select").addEventListener("change"'));
3535
assert.ok(indexHtml.includes('el("income-layer-start-usd-input").addEventListener("input"'));
3636
assert.ok(indexHtml.includes('el("income-layer-max-ratio-input").addEventListener("input"'));
37-
assert.ok(indexHtml.includes('label_zh: "纳斯达克 / 标普智能定投"'));
37+
assert.ok(indexHtml.includes('label_zh: "纳指100 / 标普500 智能定投"'));
38+
assert.ok(indexHtml.includes('class="form-section income-layer-section"'));
39+
assert.ok(indexHtml.includes('class="control-block reserve-policy-block section-wide"'));
3840
assert.ok(indexHtml.includes('profile: "ibit_smart_dca"'));
3941
assert.ok(indexHtml.includes('IBIT 比特币 ETF 智能定投'));
4042
assert.ok(indexHtml.includes('localStrategyLabels'));
4143
assert.ok(indexHtml.includes('function strategyLabelSet('));
4244
assert.ok(indexHtml.includes("account-block"));
4345
assert.ok(indexHtml.includes("strategy-block"));
44-
assert.ok(indexHtml.includes("grid-template-columns: repeat(4, minmax(0, 1fr));"));
45-
assert.ok(indexHtml.includes("grid-column: 1 / span 2;"));
46-
assert.ok(indexHtml.includes("grid-column: 3 / span 2;"));
46+
assert.ok(indexHtml.includes(".form-section {"));
47+
assert.ok(indexHtml.includes(".form-section + .form-section"));
48+
assert.ok(indexHtml.includes("grid-template-columns: repeat(2, minmax(0, 1fr));"));
4749
assert.ok(indexHtml.includes("grid-column: 1 / -1;"));
4850
assert.ok(indexHtml.includes('reservePolicyNone'));
4951
assert.ok(indexHtml.includes('reservePolicyRatio'));
@@ -74,7 +76,7 @@ assert.ok(indexHtml.includes('function currentReservedCashPolicyText('));
7476
assert.ok(indexHtml.includes('function hasPendingChanges('));
7577
assert.ok(indexHtml.includes('function pendingChangeState('));
7678
assert.ok(indexHtml.includes('reservedCashTouched: false'));
77-
assert.ok(indexHtml.includes('.reserve-ratio-block'));
79+
assert.ok(indexHtml.includes('reserve-ratio-block'));
7880
assert.ok(indexHtml.includes('.summary-row.pending'));
7981
assert.ok(indexHtml.includes('function currentEntryHasState('));
8082
assert.ok(indexHtml.includes('changes.reserveCashChanged'));

web/strategy-switch-console/index.html

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@
406406

407407
.quick-form {
408408
display: grid;
409-
grid-template-columns: repeat(4, minmax(0, 1fr));
409+
grid-template-columns: repeat(2, minmax(0, 1fr));
410410
align-items: start;
411-
gap: 14px;
411+
gap: 16px 14px;
412412
}
413413

414414
.control-block {
@@ -422,20 +422,21 @@
422422
font-weight: 760;
423423
}
424424

425-
.account-block,
426-
.account-status-block,
427-
.income-layer-mode-block,
428-
.income-layer-start-block,
429-
.min-reserve-block {
430-
grid-column: 1 / span 2;
425+
.form-section {
426+
grid-column: 1 / -1;
427+
display: grid;
428+
grid-template-columns: repeat(2, minmax(0, 1fr));
429+
align-items: start;
430+
gap: 14px;
431+
}
432+
433+
.form-section + .form-section {
434+
padding-top: 16px;
435+
border-top: 1px solid var(--line);
431436
}
432437

433-
.strategy-block,
434-
.plugin-mode-block,
435-
.reserve-policy-block,
436-
.income-layer-ratio-block,
437-
.reserve-ratio-block {
438-
grid-column: 3 / span 2;
438+
.section-wide {
439+
grid-column: 1 / -1;
439440
}
440441

441442
.mode-block {
@@ -666,21 +667,13 @@
666667
}
667668

668669
.platform-strip,
669-
.quick-form {
670+
.quick-form,
671+
.form-section {
670672
grid-template-columns: 1fr;
671673
}
672674

673-
.account-block,
674-
.strategy-block,
675675
.mode-block,
676-
.account-status-block,
677-
.plugin-mode-block,
678-
.reserve-policy-block,
679-
.income-layer-mode-block,
680-
.income-layer-start-block,
681-
.income-layer-ratio-block,
682-
.min-reserve-block,
683-
.reserve-ratio-block {
676+
.section-wide {
684677
grid-column: auto;
685678
}
686679

@@ -793,53 +786,59 @@ <h2 id="platform-title">LongBridge</h2>
793786
</div>
794787
</div>
795788

796-
<label class="control-block account-status-block">
797-
<span data-i18n="runtimeTargetMode">账号运行状态</span>
798-
<select id="runtime-target-enabled-select"></select>
799-
<span class="selection-meta" data-i18n="runtimeTargetModeMeta">停用后正式运行会跳过,模拟运行和健康检查仍可用。</span>
800-
</label>
801-
802-
<label class="control-block plugin-mode-block">
803-
<span data-i18n="pluginMode">插件启用范围</span>
804-
<select id="plugin-mode-select"></select>
805-
<span class="selection-meta" data-i18n="pluginModeMeta">选择本次切换使用策略默认插件,或完全关闭插件。</span>
806-
</label>
807-
808-
<label class="control-block income-layer-mode-block">
809-
<span data-i18n="incomeLayerMode">收入层状态</span>
810-
<select id="income-layer-mode-select"></select>
811-
<span class="selection-meta" id="income-layer-mode-meta"></span>
812-
</label>
813-
814-
<label class="control-block income-layer-start-block">
815-
<span data-i18n="incomeLayerStartUsd">收入层起始金额</span>
816-
<input id="income-layer-start-usd-input" type="number" inputmode="decimal" min="0" step="1000">
817-
<span class="selection-meta" id="income-layer-start-meta"></span>
818-
</label>
819-
820-
<label class="control-block reserve-policy-block">
821-
<span data-i18n="reservedCashMode">预留现金策略</span>
822-
<select id="reserve-policy-mode-select"></select>
823-
<span class="selection-meta" data-i18n="reservedCashModeMeta">选择是否沿用、清空或覆盖平台预留现金。</span>
824-
</label>
825-
826-
<label class="control-block income-layer-ratio-block">
827-
<span data-i18n="incomeLayerMaxRatio">收入层最高比例</span>
828-
<input id="income-layer-max-ratio-input" type="number" inputmode="decimal" min="0" max="1" step="0.01">
829-
<span class="selection-meta" id="income-layer-ratio-meta"></span>
830-
</label>
789+
<div class="form-section runtime-section">
790+
<label class="control-block account-status-block">
791+
<span data-i18n="runtimeTargetMode">账号运行状态</span>
792+
<select id="runtime-target-enabled-select"></select>
793+
<span class="selection-meta" data-i18n="runtimeTargetModeMeta">停用后正式运行会跳过,模拟运行和健康检查仍可用。</span>
794+
</label>
795+
796+
<label class="control-block plugin-mode-block">
797+
<span data-i18n="pluginMode">插件启用范围</span>
798+
<select id="plugin-mode-select"></select>
799+
<span class="selection-meta" data-i18n="pluginModeMeta">选择本次切换使用策略默认插件,或完全关闭插件。</span>
800+
</label>
801+
</div>
831802

832-
<label class="control-block min-reserve-block">
833-
<span id="min-reserved-cash-label">最小预留现金</span>
834-
<input id="min-reserved-cash-input" type="number" inputmode="decimal" min="0" step="1">
835-
<span class="selection-meta" data-i18n="reservedCashMeta">固定金额下限,可单独设置或与比例取较大值。</span>
836-
</label>
803+
<div class="form-section income-layer-section">
804+
<label class="control-block income-layer-mode-block section-wide">
805+
<span data-i18n="incomeLayerMode">收入层状态</span>
806+
<select id="income-layer-mode-select"></select>
807+
<span class="selection-meta" id="income-layer-mode-meta"></span>
808+
</label>
809+
810+
<label class="control-block income-layer-start-block">
811+
<span data-i18n="incomeLayerStartUsd">收入层起始金额</span>
812+
<input id="income-layer-start-usd-input" type="number" inputmode="decimal" min="0" step="1000">
813+
<span class="selection-meta" id="income-layer-start-meta"></span>
814+
</label>
815+
816+
<label class="control-block income-layer-ratio-block">
817+
<span data-i18n="incomeLayerMaxRatio">收入层最高比例</span>
818+
<input id="income-layer-max-ratio-input" type="number" inputmode="decimal" min="0" max="1" step="0.01">
819+
<span class="selection-meta" id="income-layer-ratio-meta"></span>
820+
</label>
821+
</div>
837822

838-
<label class="control-block reserve-ratio-block">
839-
<span data-i18n="reservedCashRatio">预留现金比例</span>
840-
<input id="reserved-cash-ratio-input" type="number" inputmode="decimal" min="0" max="1" step="0.01">
841-
<span class="selection-meta" data-i18n="reservedCashRatioMeta">例如 0.03 表示 3%。</span>
842-
</label>
823+
<div class="form-section reserve-policy-section">
824+
<label class="control-block reserve-policy-block section-wide">
825+
<span data-i18n="reservedCashMode">预留现金策略</span>
826+
<select id="reserve-policy-mode-select"></select>
827+
<span class="selection-meta" data-i18n="reservedCashModeMeta">选择是否沿用、清空或覆盖平台预留现金。</span>
828+
</label>
829+
830+
<label class="control-block min-reserve-block">
831+
<span id="min-reserved-cash-label">最小预留现金</span>
832+
<input id="min-reserved-cash-input" type="number" inputmode="decimal" min="0" step="1">
833+
<span class="selection-meta" data-i18n="reservedCashMeta">固定金额下限,可单独设置或与比例取较大值。</span>
834+
</label>
835+
836+
<label class="control-block reserve-ratio-block">
837+
<span data-i18n="reservedCashRatio">预留现金比例</span>
838+
<input id="reserved-cash-ratio-input" type="number" inputmode="decimal" min="0" max="1" step="0.01">
839+
<span class="selection-meta" data-i18n="reservedCashRatioMeta">例如 0.03 表示 3%。</span>
840+
</label>
841+
</div>
843842
</div>
844843

845844
<div class="run-area" id="run-area">
@@ -901,7 +900,7 @@ <h2 data-i18n="summary">切换摘要</h2>
901900
const defaultStrategyProfiles = [
902901
{ profile: "tqqq_growth_income", label: "TQQQ Growth Income", label_en: "TQQQ Growth Income", label_zh: "TQQQ 增长收益", domain: "us_equity", runtime_enabled: true },
903902
{ 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 },
904-
{ 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 },
903+
{ 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 },
905904
{ profile: "ibit_smart_dca", label: "IBIT Smart DCA", label_en: "IBIT Smart DCA", label_zh: "IBIT 比特币 ETF 智能定投", domain: "us_equity", runtime_enabled: true },
906905
{ profile: "global_etf_rotation", label: "Global ETF Rotation", label_en: "Global ETF Rotation", label_zh: "全球 ETF 轮动", domain: "us_equity", runtime_enabled: true },
907906
{ 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 @@ <h2 data-i18n="summary">切换摘要</h2>
914913
const localStrategyLabels = {
915914
tqqq_growth_income: { zh: "TQQQ 增长收益", en: "TQQQ Growth Income" },
916915
soxl_soxx_trend_income: { zh: "SOXL/SOXX 半导体趋势收益", en: "SOXL/SOXX Semiconductor Trend Income" },
917-
nasdaq_sp500_smart_dca: { zh: "纳斯达克 / 标普智能定投", en: "Nasdaq/S&P 500 Smart DCA" },
916+
nasdaq_sp500_smart_dca: { zh: "纳指100 / 标普500 智能定投", en: "Nasdaq 100 / S&P 500 Smart DCA" },
918917
ibit_smart_dca: { zh: "IBIT 比特币 ETF 智能定投", en: "IBIT Smart DCA" },
919918
global_etf_rotation: { zh: "全球 ETF 轮动", en: "Global ETF Rotation" },
920919
russell_1000_multi_factor_defensive: { zh: "罗素 1000 多因子防御", en: "Russell 1000 Multi-Factor Defensive" },

web/strategy-switch-console/page_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/strategy-switch-console/strategy-profiles.example.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
},
1818
{
1919
"profile": "nasdaq_sp500_smart_dca",
20-
"label": "Nasdaq/S&P 500 Smart DCA",
21-
"label_en": "Nasdaq/S&P 500 Smart DCA",
22-
"label_zh": "纳斯达克 / 标普智能定投",
20+
"label": "Nasdaq 100 / S&P 500 Smart DCA",
21+
"label_en": "Nasdaq 100 / S&P 500 Smart DCA",
22+
"label_zh": "纳指100 / 标普500 智能定投",
2323
"domain": "us_equity",
2424
"runtime_enabled": true
2525
},

web/strategy-switch-console/strategy_profiles_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)