-
+ {showEmptyOperationsState && (
+
+ 운영할 공식 경기 데이터가 없습니다.
+
+ )}
+
+ {showSupportingLayout && (
+
+ {showTeamsPanel && (
+
{match.status === "recruiting" ? (
<>
) : (
+ {usesTabbedLayout &&
+ showTeamsPanel &&
+ match.teams.length === 0 && (
+
+ 등록된 팀이 없습니다.
+
+ )}
{match.teams.map((team) => (
))}
@@ -2313,10 +2500,20 @@ export default function MatchDetailPage() {
)}
)}
-
+
+ )}
-
- {match.schedule.length > 0 && (
+
+ {usesTabbedLayout && showInfoPanel && !hasMatchInfo && (
+
+ 등록된 일정이나 안내가 없습니다.
+
+ )}
+
+ {showInfoPanel && match.schedule.length > 0 && (
{match.schedule.map((item, index) => (
@@ -2331,7 +2528,8 @@ export default function MatchDetailPage() {
)}
- {canManageAuction &&
+ {showOperationsPanel &&
+ canManageAuction &&
(match.status === "team-built" ||
match.status === "in-progress") && (
@@ -2449,7 +2647,7 @@ export default function MatchDetailPage() {
)}
- {match.prizes.length > 0 && (
+ {showInfoPanel && match.prizes.length > 0 && (
{match.prizes.map((prize, index) => (
@@ -2465,7 +2663,7 @@ export default function MatchDetailPage() {
)}
- {match.notices.length > 0 && (
+ {showInfoPanel && match.notices.length > 0 && (
{match.notices.map((notice, index) => (
@@ -2482,6 +2680,8 @@ export default function MatchDetailPage() {
)}
+ )}
+
);
}
diff --git a/apps/web/test/match-detail-tabs.test.ts b/apps/web/test/match-detail-tabs.test.ts
new file mode 100644
index 00000000..019abf66
--- /dev/null
+++ b/apps/web/test/match-detail-tabs.test.ts
@@ -0,0 +1,77 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import {
+ createMatchDetailTabSearchParams,
+ createMatchDetailTabs,
+ moveMatchDetailTabFocus,
+ resolveMatchDetailTab,
+} from "../src/components/competition/match-detail-tabs.ts";
+
+test("uses tabs only in progress or when finished and exposes operations only to managers", () => {
+ assert.deepEqual(
+ createMatchDetailTabs({ status: "recruiting", canManage: true }),
+ [],
+ );
+ assert.deepEqual(
+ createMatchDetailTabs({ status: "team-built", canManage: true }),
+ [],
+ );
+
+ const publicTabs = createMatchDetailTabs({
+ status: "in-progress",
+ canManage: false,
+ });
+ assert.deepEqual(
+ publicTabs.map((tab) => tab.id),
+ ["bracket", "games", "teams", "info"],
+ );
+ assert.deepEqual(
+ publicTabs.map((tab) => tab.label),
+ ["대진표·순위", "경기 기록", "팀", "일정·안내"],
+ );
+
+ const managerTabs = createMatchDetailTabs({
+ status: "finished",
+ canManage: true,
+ });
+ assert.deepEqual(
+ managerTabs.map((tab) => tab.id),
+ ["bracket", "games", "teams", "info", "ops"],
+ );
+});
+
+test("falls back to the bracket for missing, invalid, or unauthorized tabs", () => {
+ const publicTabs = createMatchDetailTabs({
+ status: "in-progress",
+ canManage: false,
+ });
+
+ assert.equal(resolveMatchDetailTab(null, []), null);
+ assert.equal(resolveMatchDetailTab(null, publicTabs), "bracket");
+ assert.equal(resolveMatchDetailTab("unknown", publicTabs), "bracket");
+ assert.equal(resolveMatchDetailTab("ops", publicTabs), "bracket");
+ assert.equal(resolveMatchDetailTab("games", publicTabs), "games");
+});
+
+test("updates the tab query without mutating or dropping unrelated parameters", () => {
+ const current = new URLSearchParams("season=2026&tab=teams&from=history");
+ const next = createMatchDetailTabSearchParams(current, "games");
+
+ assert.equal(next.get("tab"), "games");
+ assert.equal(next.get("season"), "2026");
+ assert.equal(next.get("from"), "history");
+ assert.equal(current.get("tab"), "teams");
+});
+
+test("moves tab focus with wrapping arrow keys and boundary keys", () => {
+ const tabs = createMatchDetailTabs({
+ status: "in-progress",
+ canManage: false,
+ });
+
+ assert.equal(moveMatchDetailTabFocus(tabs, "bracket", "ArrowRight"), "games");
+ assert.equal(moveMatchDetailTabFocus(tabs, "bracket", "ArrowLeft"), "info");
+ assert.equal(moveMatchDetailTabFocus(tabs, "info", "ArrowRight"), "bracket");
+ assert.equal(moveMatchDetailTabFocus(tabs, "teams", "Home"), "bracket");
+ assert.equal(moveMatchDetailTabFocus(tabs, "games", "End"), "info");
+});