diff --git a/dotcom-rendering/src/components/Football/LiveScoresPage.tsx b/dotcom-rendering/src/components/Football/LiveScoresPage.tsx index 122220a61f3..0fca5d494ff 100644 --- a/dotcom-rendering/src/components/Football/LiveScoresPage.tsx +++ b/dotcom-rendering/src/components/Football/LiveScoresPage.tsx @@ -1,9 +1,9 @@ -import { FELiveScoresType } from 'src/types/sports'; +import { FEFootballPageType } from 'src/types/sports'; import { css } from '@emotion/react'; import { MatchList } from './MatchList'; interface Props { - liveScores: FELiveScoresType; + liveScores: FEFootballPageType; } const sportsPageStyles = css` @@ -34,13 +34,9 @@ export const LiveScoresPage = ({ liveScores }: Props) => { css={[matchContainerStyles]} data-show-more-contains="football-matches" > - {liveScores.matchesGroupedByDateAndCompetition.map( - (item) => { - return ( - - ); - }, - )} + {liveScores.matchesList.map((item) => { + return ; + })} diff --git a/dotcom-rendering/src/components/Football/MatchList.tsx b/dotcom-rendering/src/components/Football/MatchList.tsx index b32727876e0..8f0bb8fd1fe 100644 --- a/dotcom-rendering/src/components/Football/MatchList.tsx +++ b/dotcom-rendering/src/components/Football/MatchList.tsx @@ -8,9 +8,9 @@ export const MatchList: React.FC = ({ dateCompetition }) => { return ( <>
{dateCompetition.date}
- {dateCompetition.competitions.map((comp) => ( -
-

{comp.competition.fullName}

+ {dateCompetition.competitionMatches.map((comp) => ( +
+

{comp.competitionSummary.fullName}

diff --git a/dotcom-rendering/src/model/sports-schema.json b/dotcom-rendering/src/model/sports-schema.json index 90e7caaec7c..5b15777e197 100644 --- a/dotcom-rendering/src/model/sports-schema.json +++ b/dotcom-rendering/src/model/sports-schema.json @@ -3,10 +3,14 @@ "properties": { "pageTitle": { "type": "string" + }, + "pageType": { + "type": "string" } }, "required": [ - "pageTitle" + "pageTitle", + "pageType" ], "$schema": "http://json-schema.org/draft-07/schema#" } diff --git a/dotcom-rendering/src/model/validate.ts b/dotcom-rendering/src/model/validate.ts index 51a6cae5894..eb32056d54e 100644 --- a/dotcom-rendering/src/model/validate.ts +++ b/dotcom-rendering/src/model/validate.ts @@ -15,7 +15,7 @@ import sportSchema from './sports-schema.json'; import frontSchema from './front-schema.json'; import newslettersPageSchema from './newsletter-page-schema.json'; import tagPageSchema from './tag-page-schema.json'; -import { FELiveScoresType } from 'src/types/sports'; +import { FEFootballPageType } from 'src/types/sports'; const options: Options = { verbose: false, @@ -38,7 +38,7 @@ const validateEditionsCrossword = ajv.compile( editionsCrosswordSchema, ); -const validateSports = ajv.compile(sportSchema); +const validateSports = ajv.compile(sportSchema); export const validateAsArticleType = (data: unknown): FEArticleType => { if (validateArticle(data)) return data; @@ -64,7 +64,7 @@ export const validateAsEditionsCrosswordType = ( ); }; -export const validateAsSports = (data: unknown): FELiveScoresType => { +export const validateAsSports = (data: unknown): FEFootballPageType => { if (validateSports(data)) { return data; } diff --git a/dotcom-rendering/src/server/render.sports.web.tsx b/dotcom-rendering/src/server/render.sports.web.tsx index bc248f201f8..9820e0e52e2 100644 --- a/dotcom-rendering/src/server/render.sports.web.tsx +++ b/dotcom-rendering/src/server/render.sports.web.tsx @@ -1,4 +1,4 @@ -import { FELiveScoresType } from '../types/sports'; +import { FEFootballPageType } from '../types/sports'; import { LiveScoresPage } from '../components/Football/LiveScoresPage'; import { renderToStringWithEmotion } from '../lib/emotion'; import { getPathFromManifest } from '../lib/assets'; @@ -6,7 +6,7 @@ import { polyfillIO } from '../lib/polyfill.io'; import { isString } from '@guardian/libs'; interface Props { - sports: FELiveScoresType; + sports: FEFootballPageType; } export const renderSportsHtml = ({ diff --git a/dotcom-rendering/src/types/sports.ts b/dotcom-rendering/src/types/sports.ts index 4059debe817..f9cbaf0d4de 100644 --- a/dotcom-rendering/src/types/sports.ts +++ b/dotcom-rendering/src/types/sports.ts @@ -20,6 +20,11 @@ type MatchDayTeam = { scorers?: string; }; +type Competition = { + id: string; + name: string; +}; + type FootballMatch = { id: string; date: Date; @@ -47,6 +52,7 @@ type MatchDay = FootballMatch & { matchStatus: string; attendance?: string; referee?: string; + competition?: Competition; }; type Result = FootballMatch & { @@ -87,7 +93,7 @@ type LeagueTeam = { type LeagueTableEntry = { stageNumber: string; round: Round; team: LeagueTeam }; -type Competition = { +type CompetitionSummary = { id: string; url: string; fullName: string; @@ -102,17 +108,17 @@ type Competition = { }; type CompetitionMatch = { - competition: Competition; + competitionSummary: CompetitionSummary; matches: FootballMatchType[]; }; export type DateCompetitionMatch = { date: string; - competitions: CompetitionMatch[]; + competitionMatches: CompetitionMatch[]; }; -export type FELiveScoresType = { +export type FEFootballPageType = { pageTitle: string; - type: string; - matchesGroupedByDateAndCompetition: DateCompetitionMatch[]; + pageType: string; + matchesList: DateCompetitionMatch[]; };