From 1fae954b09a49d93a1361788e859065bea43f0c0 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Thu, 5 Mar 2026 22:03:20 +0900
Subject: fix(frontend): hide code column in ranking table when code is not
 available

---
 frontend/app/components/Gaming/RankingTable.tsx | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

(limited to 'frontend/app/components/Gaming/RankingTable.tsx')

diff --git a/frontend/app/components/Gaming/RankingTable.tsx b/frontend/app/components/Gaming/RankingTable.tsx
index 4ba3987..60f4808 100644
--- a/frontend/app/components/Gaming/RankingTable.tsx
+++ b/frontend/app/components/Gaming/RankingTable.tsx
@@ -10,9 +10,18 @@ type Props = {
 
 export default function RankingTable({ problemLanguage }: Props) {
 	const ranking = useAtomValue(rankingAtom);
+	const showCode = ranking.some((entry) => entry.code != null);
 
 	return (
-		<DataTable headers={["順位", "プレイヤー", "スコア", "提出時刻", "コード"]}>
+		<DataTable
+			headers={[
+				"順位",
+				"プレイヤー",
+				"スコア",
+				"提出時刻",
+				...(showCode ? ["コード"] : []),
+			]}
+		>
 			{ranking.map((entry, index) => (
 				<tr key={entry.player.user_id}>
 					<DataTableCell>{index + 1}</DataTableCell>
@@ -24,11 +33,13 @@ export default function RankingTable({ problemLanguage }: Props) {
 					<DataTableCell>
 						{formatUnixTimestamp(entry.submitted_at)}
 					</DataTableCell>
-					<DataTableCell>
-						{entry.code && (
-							<CodePopover code={entry.code} language={problemLanguage} />
-						)}
-					</DataTableCell>
+					{showCode && (
+						<DataTableCell>
+							{entry.code && (
+								<CodePopover code={entry.code} language={problemLanguage} />
+							)}
+						</DataTableCell>
+					)}
 				</tr>
 			))}
 		</DataTable>
-- 
cgit v1.3.1

