diff --git a/app/features/scanner/components/MatchCard.tsx b/app/features/scanner/components/MatchCard.tsx index 6c804c0a6..a25eab2cc 100644 --- a/app/features/scanner/components/MatchCard.tsx +++ b/app/features/scanner/components/MatchCard.tsx @@ -119,6 +119,7 @@ export function MatchCard({ const result = matchResult(match); const pov = povPlayer(match); + const matchOrigin = timelineOrigin(match); const meta = [ kind === "vod" && match.startsAt !== null ? `at ${formatPosition(match.startsAt - originT)}` @@ -228,9 +229,11 @@ export function MatchCard({ {match.objective || match.playerStatus ? ( ({ t: sample.t, data: sample }), + (sample) => ({ t: sample.t - matchOrigin, data: sample }), + )} + playerStatusSamples={(match.playerStatus?.samples ?? []).map( + (sample) => ({ ...sample, t: sample.t - matchOrigin }), )} - playerStatusSamples={match.playerStatus?.samples ?? []} teams={playerStatusTeams(match, TEAM_LABELS)} /> ) : null} @@ -244,6 +247,19 @@ export function MatchCard({ ); } +/** + * Live sessions stamp reads with wall-clock seconds and VoDs with file position; + * the timeline charts want seconds since the match began either way. + */ +function timelineOrigin(match: ScannerMatch): number { + return ( + match.startsAt ?? + match.objective?.samples[0]?.t ?? + match.playerStatus?.samples[0]?.t ?? + 0 + ); +} + function povPlayer(match: ScannerMatch): ScannerMatchPlayer | undefined { return match.pov ? match.teams[match.pov.team].players[match.pov.index]