Skip to content

Commit 1c65a3a

Browse files
Pigbibiclaude
andcommitted
fix(ui): sync functions now show actual current values instead of 沿用当前配置
- syncCashOnlyExecutionForAccount: reads entry.cash_only_execution, shows 是/否 - syncOptionOverlayForAccount: reads entry.option_overlay_enabled, shows 开启/关闭 - syncIncomeLayerForAccount: reads entry config, shows enabled/disabled Previously all three defaulted to 'current' dropdown option without showing the actual configured value. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e3222b2 commit 1c65a3a

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

web/strategy-switch-console/index.html

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,18 +2937,23 @@ <h2 data-i18n="summary">切换摘要</h2>
29372937
if (!form || form.incomeLayerTouched) return;
29382938
const defaults = incomeLayerDefaultForStrategy(form.strategy);
29392939
const current = currentIncomeLayerForAccount(platform, selectedAccount(platform));
2940-
form.incomeLayerMode = "current";
2940+
const entry = currentEntryForAccount(platform, selectedAccount(platform));
2941+
if (entry && incomeLayerFieldsConfigured(entry)) {
2942+
form.incomeLayerMode = current.enabled === false ? "disabled" : "enabled";
2943+
} else {
2944+
form.incomeLayerMode = "current";
2945+
}
29412946
form.incomeLayerStartUsd = current.startUsd || String(defaults?.startUsd || "");
29422947
form.incomeLayerMaxRatio = current.maxRatio || defaults?.maxRatio || "";
29432948
}
29442949

29452950
function syncOptionOverlayForAccount(platform) {
29462951
const form = state.forms[platform];
29472952
if (!form || form.optionOverlayTouched) return;
2948-
const account = selectedAccount(platform);
2949-
const configured = normalizeOptionOverlayMode(account?.option_overlay_mode);
2950-
if (configured !== "current") {
2951-
form.optionOverlayMode = configured;
2953+
const entry = currentEntryForAccount(platform, selectedAccount(platform));
2954+
const rawValue = cleanOptionalBoolean(entry?.option_overlay_enabled);
2955+
if (rawValue !== null) {
2956+
form.optionOverlayMode = rawValue ? "enabled" : "disabled";
29522957
return;
29532958
}
29542959
form.optionOverlayMode = optionOverlaySupported(form.strategy) ? "current" : "disabled";
@@ -2957,9 +2962,13 @@ <h2 data-i18n="summary">切换摘要</h2>
29572962
function syncCashOnlyExecutionForAccount(platform) {
29582963
const form = state.forms[platform];
29592964
if (!form || form.cashOnlyExecutionTouched) return;
2960-
const account = selectedAccount(platform);
2961-
const configured = normalizeCashOnlyExecutionMode(account?.cash_only_execution_mode);
2962-
form.cashOnlyExecutionMode = configured !== "current" ? configured : "current";
2965+
const entry = currentEntryForAccount(platform, selectedAccount(platform));
2966+
const rawValue = cleanOptionalBoolean(entry?.cash_only_execution);
2967+
if (rawValue !== null) {
2968+
form.cashOnlyExecutionMode = rawValue ? "enabled" : "disabled";
2969+
return;
2970+
}
2971+
form.cashOnlyExecutionMode = "current";
29632972
}
29642973

29652974
function syncDcaForAccount(platform) {

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.

0 commit comments

Comments
 (0)