diff --git a/TODO b/TODO index c2fe356223..5d38db8bf7 100644 --- a/TODO +++ b/TODO @@ -1,16 +1,10 @@ better play by play log - test other sports - - football - - benchmark - - hockey - - t - - textOnly - - benchmark - baseball - showScore in LiveGame - - t - textOnly - bold = false + - output.bold - benchmark - make text JSX, get rid of any processing in LiveGame - test performance @@ -22,7 +16,7 @@ better play by play log - go back to editing DOM? - then i still can't use jsx in processLiveGameEvents text output - maybe not that slow in prod mode, benchmark -- colored text for football interceptions/fumble/downs turnovers, hockey power plays, maybe baseball outs, maybe baseball/hockey/football scores +- colored text for football interceptions/fumble/downs turnovers, hockey penalty, maybe baseball outs, maybe baseball/hockey/football scores no need to track scoringSummary at all for basketball diff --git a/src/ui/util/processLiveGameEvents.baseball.ts b/src/ui/util/processLiveGameEvents.baseball.ts index 0849a1e44f..1c30c61bd7 100644 --- a/src/ui/util/processLiveGameEvents.baseball.ts +++ b/src/ui/util/processLiveGameEvents.baseball.ts @@ -565,6 +565,7 @@ const processLiveGameEvents = ({ const output = getText(e, getName); text = output.text; + t = actualT; bold = output.bold; stop = true; @@ -576,6 +577,7 @@ const processLiveGameEvents = ({ overtimes, quarters, sportState, + t, text, }; }; diff --git a/src/ui/util/processLiveGameEvents.hockey.ts b/src/ui/util/processLiveGameEvents.hockey.ts index 5dc170bb2f..2ce23656e9 100644 --- a/src/ui/util/processLiveGameEvents.hockey.ts +++ b/src/ui/util/processLiveGameEvents.hockey.ts @@ -65,8 +65,6 @@ const getText = ( ) => { let text; - let showTeamAndClock = true; - if (event.type === "injury") { text = `${event.names[0]} was injured!`; } @@ -74,18 +72,15 @@ const getText = ( text = `Start of ${helpers.ordinal(event.quarter)} ${getPeriodName( boxScore.numPeriods, )}`; - showTeamAndClock = false; } if (event.type === "overtime") { const overtimes = event.quarter - boxScore.numPeriods; text = `Start of ${ overtimes === 1 ? "" : `${helpers.ordinal(overtimes)} ` } overtime`; - showTeamAndClock = false; } if (event.type === "gameOver") { text = "End of game"; - showTeamAndClock = false; } if (event.type === "hit") { text = `${event.names[0]} hit ${event.names[1]}`; @@ -167,13 +162,6 @@ const getText = ( throw new Error(`Invalid event type "${event.type}"`); } - if (showTeamAndClock) { - const actualT = (event as any).t === 0 ? 1 : 0; - text = `${formatClock((event as any).clock)} - ${ - boxScore.teams[actualT].abbrev - } - ${text}`; - } - return text; }; @@ -296,6 +284,9 @@ const processLiveGameEvents = ({ } text = getText(e, boxScore); + t = actualT; + textOnly = + e.type === "gameOver" || e.type === "quarter" || e.type === "overtime"; boxScore.time = formatClock(e.clock); stop = true; } @@ -328,7 +319,9 @@ const processLiveGameEvents = ({ return { overtimes, quarters, + t, text, + textOnly, }; };