diff --git a/frontend/src/pages/leaderboard/Leaderboard.tsx b/frontend/src/pages/leaderboard/Leaderboard.tsx index 4408d51..d566643 100644 --- a/frontend/src/pages/leaderboard/Leaderboard.tsx +++ b/frontend/src/pages/leaderboard/Leaderboard.tsx @@ -155,7 +155,7 @@ export default function Leaderboard() { {Object.entries(data.rankings).length > 0 ? ( - + ) : ( diff --git a/frontend/src/pages/leaderboard/components/RankingLists.tsx b/frontend/src/pages/leaderboard/components/RankingLists.tsx index c606ab7..e6785d5 100644 --- a/frontend/src/pages/leaderboard/components/RankingLists.tsx +++ b/frontend/src/pages/leaderboard/components/RankingLists.tsx @@ -14,6 +14,7 @@ import { formatMicroseconds } from "../../../lib/utils/ranking.ts"; import { getMedalIcon } from "../../../components/common/medal.tsx"; import { fetchCodes } from "../../../api/api.ts"; import { CodeDialog } from "./CodeDialog.tsx"; +import { isExpired } from "../../../lib/date/utils.ts"; interface RankingItem { file_name: string; @@ -27,6 +28,7 @@ interface RankingItem { interface RankingsListProps { rankings: Record; leaderboardId?: string; + deadline?: string; } const styles: Record> = { @@ -70,13 +72,16 @@ const styles: Record> = { loc: { fontFamily: "monospace", color: "text.secondary", + textAlign: "right", }, }; export default function RankingsList({ rankings, leaderboardId, + deadline, }: RankingsListProps) { + const showLoc = !!deadline && isExpired(deadline); const [expanded, setExpanded] = useState>({}); const [colorHash, _] = useState( Math.random().toString(36).slice(2, 8), @@ -168,12 +173,12 @@ export default function RankingsList({ {item.user_name} {getMedalIcon(item.rank)} - + {formatMicroseconds(item.score)} - + {item.prev_score > 0 && `+${formatMicroseconds(item.prev_score)}`} @@ -187,16 +192,18 @@ export default function RankingsList({ /> - - - {(() => { - const code = codes.get(item?.submission_id); - if (!code) return ""; - const lines = code.split("\n").length; - return `${lines} LOC`; - })()} - - + {showLoc && ( + + + {(() => { + const code = codes.get(item?.submission_id); + if (!code) return ""; + const lines = code.split("\n").length; + return `${lines} LOC`; + })()} + + + )} ))}