Skip to content

Commit 9d37817

Browse files
authored
Hide current status rows in public preview (#29)
1 parent a79382f commit 9d37817

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

tests/strategy_switch_worker_validation.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ assert.equal(indexHtml.includes(".innerHTML"), false);
1313
assert.ok(indexHtml.includes('<body class="app-loading">'));
1414
assert.ok(indexHtml.includes('id="boot-screen"'));
1515
assert.ok(indexHtml.includes('id="app-shell"'));
16+
assert.ok(indexHtml.includes('publicSummary: "公开预览"'));
1617
assert.match(indexHtml, /body\.app-loading \.shell\s*\{\s*display: none;/);
1718

1819
const headers = __test.responseHeaders({ "Content-Type": "text/html; charset=utf-8" });

web/strategy-switch-console/index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ <h2 data-i18n="summary">切换摘要</h2>
845845
live: "实盘",
846846
paper: "Dry run",
847847
summary: "当前配置状态",
848+
publicSummary: "公开预览",
848849
copySummary: "复制状态",
849850
loginToRun: "登录后切换",
850851
loadingConfig: "读取配置中",
@@ -894,6 +895,7 @@ <h2 data-i18n="summary">切换摘要</h2>
894895
live: "Live",
895896
paper: "Dry run",
896897
summary: "Current Config",
898+
publicSummary: "Public Preview",
897899
copySummary: "Copy state",
898900
loginToRun: "Sign in to switch",
899901
loadingConfig: "Loading config",
@@ -1197,13 +1199,16 @@ <h2 data-i18n="summary">切换摘要</h2>
11971199
function summaryRows(inputs) {
11981200
const account = selectedAccount();
11991201
const currentProfile = currentStrategyForAccount(state.selected, account);
1200-
return [
1202+
const rows = [
12011203
[t("repository"), repositories[state.selected]],
12021204
[t("selectedAccount"), account.label],
1203-
[t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")],
12041205
[t("selectedMarket"), supportedDomainLabel(state.selected, account)],
12051206
[t("nextStrategy"), strategyLabel(inputs.strategy_profile)],
12061207
];
1208+
if (state.auth.allowed) {
1209+
rows.splice(2, 0, [t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")]);
1210+
}
1211+
return rows;
12071212
}
12081213

12091214
function applyLanguage() {
@@ -1292,6 +1297,7 @@ <h2 data-i18n="summary">切换摘要</h2>
12921297
const inputs = buildInputs();
12931298
const list = el("summary-list");
12941299
list.replaceChildren();
1300+
document.querySelector(".summary-head h2").textContent = state.auth.allowed ? t("summary") : t("publicSummary");
12951301
for (const [label, value] of summaryRows(inputs)) {
12961302
const row = document.createElement("div");
12971303
row.className = "summary-row";
@@ -1303,10 +1309,7 @@ <h2 data-i18n="summary">切换摘要</h2>
13031309
list.appendChild(row);
13041310
}
13051311

1306-
const account = selectedAccount();
1307-
const currentEntry = currentEntryForAccount(state.selected, account);
1308-
const currentMode = normalizeExecutionMode(currentEntry?.execution_mode, currentEntry?.dry_run_only);
1309-
el("mode-pill").textContent = currentMode ? modeLabel(currentMode) : t("notRead");
1312+
el("mode-pill").textContent = modeLabel(inputs.execution_mode);
13101313
}
13111314

13121315
function renderAuth() {

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)