aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/Gaming
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-03-05 22:03:20 +0900
committernsfisis <nsfisis@gmail.com>2026-03-05 22:03:20 +0900
commit1fae954b09a49d93a1361788e859065bea43f0c0 (patch)
treecfc445acc3a2828dd9a91d2aa022bbbee0536743 /frontend/app/components/Gaming
parent7f29d334f26229753e68d20a5aaab33c39de9f06 (diff)
downloadphperkaigi-2026-albatross-1fae954b09a49d93a1361788e859065bea43f0c0.tar.gz
phperkaigi-2026-albatross-1fae954b09a49d93a1361788e859065bea43f0c0.tar.zst
phperkaigi-2026-albatross-1fae954b09a49d93a1361788e859065bea43f0c0.zip
fix(frontend): hide code column in ranking table when code is not available
Diffstat (limited to 'frontend/app/components/Gaming')
-rw-r--r--frontend/app/components/Gaming/RankingTable.tsx23
1 files changed, 17 insertions, 6 deletions
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>