From ed69e912dd07a436ee07536c5df548df68d0c9a6 Mon Sep 17 00:00:00 2001 From: m0rph3us1987 Date: Sat, 7 Mar 2026 12:00:39 +0100 Subject: [PATCH] Adjusted log --- Log.tsx | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Log.tsx b/Log.tsx index 11accd8..0e0cc06 100644 --- a/Log.tsx +++ b/Log.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react'; import { Medal, CheckCircle2, History } from 'lucide-react'; import { useCTF } from './CTFContext'; -import { calculateChallengeValue, getFirstBloodBonusFactor } from './services/scoring'; +import { calculateChallengeValue, getFirstBloodBonusFactor, calculateTeamTotalScore } from './services/scoring'; export const Log: React.FC = () => { const { state } = useCTF(); @@ -10,11 +10,34 @@ export const Log: React.FC = () => { return [...state.solves].sort((a, b) => b.timestamp - a.timestamp); }, [state.solves]); + const topTeams = useMemo(() => { + return state.teams + .filter(t => !t.isAdmin && !t.isDisabled) + .map(team => ({ ...team, score: calculateTeamTotalScore(team.id, state.challenges, state.solves) })) + .sort((a, b) => b.score - a.score) + .slice(0, 3); + }, [state]); + return (
-
- -

Event Log

+
+
+ +

Event Log

+
+ {topTeams.length > 0 && ( +
+ {topTeams.map((team, idx) => ( +
+ + {idx + 1} + + {team.name} + {team.score} PTS +
+ ))} +
+ )}
{sortedSolves.length === 0 ? (