Skip to content

Commit

Permalink
Got everything working
Browse files Browse the repository at this point in the history
  • Loading branch information
jwngr committed Jul 7, 2024
1 parent ba4e893 commit b8b0ab0
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 17 deletions.
2 changes: 1 addition & 1 deletion data/ndSchedules/1989.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"home": []
},
"time": "8:00 PM",
"coverage": "RAYCOM / WGN",
"coverage": "RAYCOM / WGN-TV",
"headCoach": "Lou Holtz",
"rankings": {
"home": {
Expand Down
11 changes: 6 additions & 5 deletions scripts/ndSchedules/validators/validateCoverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const {CURRENT_SEASON} = require('../../lib/constants');

const EXPECTED_TV_CHANNELS = [
'ABC',
'ABC / ESPN',
'ABC / ESPN2',
'ACCN',
'CBS',
'CBSSN',
Expand All @@ -17,13 +15,16 @@ const EXPECTED_TV_CHANNELS = [
'NBC',
'NBCSN',
'PEACOCK',
'RAYCOM / WGN',
'SPORTSCHANNEL',
'TBS',
'USA',
'USA / WGN-TV',
'WGN-TV',
];
// TODO: Handle multi-network broadcasts explicitly in the data model as an array of networks.
'ABC / ESPN',
'ABC / ESPN2',
'RAYCOM / WGN-TV',
'USA / WGN-TV',
];

module.exports = ({season, coverage}, assert) => {
const wrappedAssert = (statement, message) => {
Expand Down
18 changes: 16 additions & 2 deletions website/src/components/Game.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,16 @@ export const TelevisionCoverage = styled.div<TelevisionCoverageProps>`
case TVNetwork.Peacock:
return '48px';
case TVNetwork.ABC:
case TVNetwork.NBC:
case TVNetwork.CBS:
case TVNetwork.KATZ:
case TVNetwork.NBC:
case TVNetwork.NBCSN:
case TVNetwork.SPORTSCHANNEL:
case TVNetwork.WGN_TV:
case TVNetwork.ABC_ESPN:
case TVNetwork.ABC_ESPN2:
case TVNetwork.RAYCOM_WGN:
case TVNetwork.USA_WGN_TV:
case TVNetwork.Unknown:
return '32px';
default:
Expand Down Expand Up @@ -298,9 +305,16 @@ export const TelevisionCoverage = styled.div<TelevisionCoverageProps>`
case TVNetwork.TBS:
return '18px';
case TVNetwork.ABC:
case TVNetwork.NBC:
case TVNetwork.CBS:
case TVNetwork.KATZ:
case TVNetwork.NBC:
case TVNetwork.NBCSN:
case TVNetwork.SPORTSCHANNEL:
case TVNetwork.WGN_TV:
case TVNetwork.ABC_ESPN:
case TVNetwork.ABC_ESPN2:
case TVNetwork.RAYCOM_WGN:
case TVNetwork.USA_WGN_TV:
case TVNetwork.Unknown:
return '24px';
default:
Expand Down
26 changes: 24 additions & 2 deletions website/src/components/TVNetworkLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import styled from 'styled-components';

import abcLogo from '../images/tvLogos/abc.png';
import accnLogo from '../images/tvLogos/accn.png';
Expand All @@ -17,7 +18,13 @@ import usaLogo from '../images/tvLogos/usa.png';
import {assertNever} from '../lib/utils';
import {TVNetwork} from '../models';

function getTvNetworkLogo(network: TVNetwork) {
export const ChannelName = styled.p`
font-size: 24px;
font-weight: bold;
margin-right: 16px;
`;

function getTvNetworkLogo(network: TVNetwork): string | null {
switch (network) {
case TVNetwork.ABC:
return abcLogo;
Expand Down Expand Up @@ -47,11 +54,26 @@ function getTvNetworkLogo(network: TVNetwork) {
return usaLogo;
case TVNetwork.Unknown:
return unknownNetworkLogo;
case TVNetwork.KATZ:
case TVNetwork.SPORTSCHANNEL:
case TVNetwork.WGN_TV:
case TVNetwork.ABC_ESPN:
case TVNetwork.ABC_ESPN2:
case TVNetwork.RAYCOM_WGN:
case TVNetwork.USA_WGN_TV:
// TODO: Add logos for these networks.
return null;
default:
assertNever(network);
}
}

export const TVNetworkLogo: React.FC<{readonly network: TVNetwork}> = ({network}) => {
return <img key={network} src={getTvNetworkLogo(network)} alt={`${network} logo`} />;
const logo = getTvNetworkLogo(network);

if (!logo) {
return <ChannelName>{network}</ChannelName>;
}

return <img key={network} src={logo} alt={`${network} logo`} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export const ChannelLogo = styled.div<ChannelLogoProps>`
case TVNetwork.USA:
return '44px';
case TVNetwork.FOX:
case TVNetwork.KATZ:
case TVNetwork.SPORTSCHANNEL:
case TVNetwork.WGN_TV:
case TVNetwork.ABC_ESPN:
case TVNetwork.ABC_ESPN2:
case TVNetwork.RAYCOM_WGN:
case TVNetwork.USA_WGN_TV:
case TVNetwork.Unknown:
return '40px';
case TVNetwork.TBS:
Expand Down
27 changes: 21 additions & 6 deletions website/src/components/gameSummary/MatchupHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ export const MatchupHistory: React.FC<{

const specialPositions = {
first: i === 0,
last: i === _.size(matchupsToShow) - 1,
last: i === matchupsToShow.length - 1,
};

const selectedSeasonIndex = matchupsToShow.findIndex(
(game) => game?.season === selectedSeason
);
const isFirst = i === 0;
const isLast = i === matchupsToShow.length - 1;
const previousHistoricalGame = matchupsToShow[i - 1];
const nextHistoricalGame = matchupsToShow[i + 1];

return (
<HistoricalMatchup
Expand All @@ -152,9 +153,23 @@ export const MatchupHistory: React.FC<{
selectedGame.fullDate === historicalGame.fullDate
}
isSeasonOnTop={i % 2 === 0}
// Show gap indicators on either side if the previous / next displayed season is
// not actually the next / previous season due to list truncation.
// TODO: Properly handle seasons with multiple games against the same team (e.g.
// Clemson 2020).
gaps={{
left: i > 0 && selectedSeasonIndex === i - 1,
right: i < _.size(matchupsToShow) - 1 && selectedSeasonIndex === i + 1,
left: Boolean(
!isFirst &&
previousHistoricalGame &&
allSeasonsWithMatchupsAgainstTeam.indexOf(historicalGame.season) !==
allSeasonsWithMatchupsAgainstTeam.indexOf(previousHistoricalGame.season) + 1
),
right: Boolean(
!isLast &&
nextHistoricalGame &&
allSeasonsWithMatchupsAgainstTeam.indexOf(historicalGame.season) !==
allSeasonsWithMatchupsAgainstTeam.indexOf(nextHistoricalGame.season) - 1
),
}}
specialPositions={specialPositions}
/>
Expand Down
7 changes: 7 additions & 0 deletions website/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ export const getTvChannelUrl = (network: TVNetwork): string | null => {
case TVNetwork.TBS:
return 'https://www.tbs.com/watchtbs';
case TVNetwork.CSTV:
case TVNetwork.KATZ:
case TVNetwork.Peacock:
case TVNetwork.SPORTSCHANNEL:
case TVNetwork.USA:
case TVNetwork.WGN_TV:
case TVNetwork.ABC_ESPN:
case TVNetwork.ABC_ESPN2:
case TVNetwork.RAYCOM_WGN:
case TVNetwork.USA_WGN_TV:
case TVNetwork.Unknown:
return null;
default:
Expand Down
9 changes: 9 additions & 0 deletions website/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,21 @@ export enum TVNetwork {
ESPN = 'ESPN',
ESPN2 = 'ESPN2',
FOX = 'FOX',
KATZ = 'KATZ',
NBC = 'NBC',
NBCSN = 'NBCSN',
Peacock = 'PEACOCK',
TBS = 'TBS',
USA = 'USA',
SPORTSCHANNEL = 'SPORTSCHANNEL',
WGN_TV = 'WGN-TV',
// TODO: Consider removing this type and using `null` instead.
Unknown = 'UNKNOWN',
// TODO: Handle multi-network broadcasts explicitly in the data model as an array of networks.
ABC_ESPN = 'ABC / ESPN',
ABC_ESPN2 = 'ABC / ESPN2',
RAYCOM_WGN = 'RAYCOM / WGN-TV',
USA_WGN_TV = 'USA / WGN-TV',
}

export interface Team {
Expand Down
2 changes: 1 addition & 1 deletion website/src/resources/schedule.json
Original file line number Diff line number Diff line change
Expand Up @@ -24015,7 +24015,7 @@
"home": []
},
"time": "8:00 PM",
"coverage": "RAYCOM / WGN",
"coverage": "RAYCOM / WGN-TV",
"headCoach": "Lou Holtz",
"rankings": {
"home": {
Expand Down

0 comments on commit b8b0ab0

Please sign in to comment.