From 3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 29 Mar 2025 01:51:53 +0900 Subject: feat: show code in ranking page --- frontend/app/components/Gaming/CodePopover.tsx | 43 +++++++++++++++++++++++++ frontend/app/components/Gaming/RankingTable.tsx | 5 +++ 2 files changed, 48 insertions(+) create mode 100644 frontend/app/components/Gaming/CodePopover.tsx (limited to 'frontend/app/components') diff --git a/frontend/app/components/Gaming/CodePopover.tsx b/frontend/app/components/Gaming/CodePopover.tsx new file mode 100644 index 0000000..a574a77 --- /dev/null +++ b/frontend/app/components/Gaming/CodePopover.tsx @@ -0,0 +1,43 @@ +import { Popover } from "@base-ui-components/react/popover"; +import { faCode, faXmark } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { calcCodeSize } from "../../states/play"; +import BorderedContainer from "../BorderedContainer"; +import CodeBlock from "../Gaming/CodeBlock"; + +type Props = { + code: string; +}; + +export default function CodePopover({ code }: Props) { + const codeSize = calcCodeSize(code); + + return ( + + + + + + + + +
+
+ コードサイズ: {codeSize} +
+ + + +
+ +
+
+
+
+
+ ); +} diff --git a/frontend/app/components/Gaming/RankingTable.tsx b/frontend/app/components/Gaming/RankingTable.tsx index a1e41f5..38d5200 100644 --- a/frontend/app/components/Gaming/RankingTable.tsx +++ b/frontend/app/components/Gaming/RankingTable.tsx @@ -1,6 +1,7 @@ import { useAtomValue } from "jotai"; import React from "react"; import { rankingAtom } from "../../states/watch"; +import CodePopover from "./CodePopover"; function TableHeaderCell({ children }: { children: React.ReactNode }) { return ( @@ -40,6 +41,7 @@ export default function RankingTable() { プレイヤー スコア 提出時刻 + コード @@ -54,6 +56,9 @@ export default function RankingTable() { {formatUnixTimestamp(entry.submitted_at)} + + {entry.code && } + ))} -- cgit v1.2.3-70-g09d2