Restore visible game operation tabs

This commit is contained in:
npc0-hue
2026-08-27 09:52:54 +08:00
parent 1c52703b3e
commit 9022cf0bea
3 changed files with 12 additions and 11 deletions
+2 -1
View File
@@ -175,7 +175,8 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).toContain("plugin:${page.key}");
expect(serverDetailPageSource).toContain("ServerDetailSectionNav");
expect(serverDetailPageSource).toContain('aria-label="游戏运营功能"');
expect(serverDetailPageSource).toContain("server-plugin-section-picker-active");
expect(serverDetailPageSource).toContain("server-plugin-section-tabs");
expect(serverDetailPageSource).not.toContain("server-plugin-section-picker");
expect(serverDetailPageSource).toContain('section === "files"');
expect(serverDetailPageSource).toContain("PluginPageSection");
expect(serverDetailPageSource).toContain("PluginPageHostPage");
+8 -8
View File
@@ -268,17 +268,17 @@ function serverDetailSectionEntries(plugin?: GamePluginResponse): Array<{ id: Se
function ServerDetailSectionNav({ entries, section, onChange }: { entries: Array<{ id: ServerDetailSection; label: string }>; section: ServerDetailSection; onChange: (section: ServerDetailSection) => void }) {
const pluginEntries = entries.filter((entry) => entry.id.startsWith("plugin:"));
const platformEntries = entries.filter((entry) => !entry.id.startsWith("plugin:"));
const activePluginSection = section.startsWith("plugin:") ? section : "";
return (
<nav className="section-tabs" aria-label="server sections">
{pluginEntries.length > 0 && (
<label className={cx("server-plugin-section-picker", activePluginSection && "server-plugin-section-picker-active")}>
<span></span>
<select aria-label="游戏运营功能" value={activePluginSection} onChange={(event) => event.target.value && onChange(event.target.value as ServerDetailSection)}>
<option value="" disabled></option>
{pluginEntries.map((entry) => <option key={entry.id} value={entry.id}>{entry.label}</option>)}
</select>
</label>
<div className="server-plugin-section-tabs" aria-label="游戏运营功能">
<span className="server-plugin-section-label"></span>
{pluginEntries.map((entry) => (
<button key={entry.id} type="button" className={cx("section-tab", section === entry.id && "section-tab-active")} aria-current={section === entry.id ? "page" : undefined} onClick={() => onChange(entry.id)}>
{entry.label}
</button>
))}
</div>
)}
{platformEntries.map((entry) => (
<button key={entry.id} type="button" className={cx("section-tab", section === entry.id && "section-tab-active")} aria-current={section === entry.id ? "page" : undefined} onClick={() => onChange(entry.id)}>