diff --git a/frontend/src/pages/leaderboard/components/RankingLists.tsx b/frontend/src/pages/leaderboard/components/RankingLists.tsx index 27f42de..e9fe3b3 100644 --- a/frontend/src/pages/leaderboard/components/RankingLists.tsx +++ b/frontend/src/pages/leaderboard/components/RankingLists.tsx @@ -70,11 +70,6 @@ const styles: Record> = { color: "text.secondary", minWidth: "90px", }, - loc: { - fontFamily: "monospace", - color: "text.secondary", - textAlign: "right", - }, submissionId: { fontFamily: "monospace", color: "text.secondary", @@ -86,7 +81,7 @@ export default function RankingsList({ leaderboardId, deadline, }: RankingsListProps) { - const showLoc = !!deadline && isExpired(deadline); + const expired = !!deadline && isExpired(deadline); const me = useAuthStore((s) => s.me); const isAdmin = !!me?.user?.is_admin; const [expanded, setExpanded] = useState>({}); @@ -112,7 +107,7 @@ export default function RankingsList({ }, [rankings]); useEffect(() => { - if (!showLoc) return; + if (!expired && !isAdmin) return; if (!submissionIds || submissionIds.length === 0 || !leaderboardId) return; fetchCodes(leaderboardId, submissionIds) .then((data) => { @@ -126,7 +121,7 @@ export default function RankingsList({ // soft error handle it since it's not critical console.warn("[RankingsList] Failed to fetch codes:", err); }); - }, [leaderboardId, submissionIds, showLoc]); + }, [leaderboardId, submissionIds, expired, isAdmin]); const toggleExpanded = (field: string) => { setExpanded((prev) => ({ @@ -181,35 +176,23 @@ export default function RankingsList({ {item.user_name} {getMedalIcon(item.rank)} - + {formatMicroseconds(item.score)} - + {item.prev_score > 0 && `+${formatMicroseconds(item.prev_score)}`} - {showLoc && ( - - - {(() => { - const code = codes.get(item?.submission_id); - if (!code) return ""; - const lines = code.split("\n").length; - return `${lines} LOC`; - })()} - - - )} - + {isAdmin && ( - + ID: {item.submission_id}