Skip to content

Commit f85084c

Browse files
authored
Merge pull request #14944 from guardian/add-status-to-match-data
Add match status to the football data
2 parents dc0426b + 7804563 commit f85084c

File tree

9 files changed

+16
-6
lines changed

9 files changed

+16
-6
lines changed

dotcom-rendering/fixtures/generated/match-report.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,4 +563,5 @@ export const matchReport: MatchReportType = {
563563
'https://www.theguardian.com/football/live/2025/jul/08/germany-v-denmark-euro-2025-live',
564564
reportUrl:
565565
'https://www.theguardian.com/football/2025/jul/08/germany-denmark-women-euro-2025-group-c-match-report',
566+
status: 'FT',
566567
};

dotcom-rendering/src/components/FootballMatchSummary.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const FootballMatchSummary = {
2424
homeTeam: matchReport.homeTeam,
2525
awayTeam: matchReport.awayTeam,
2626
comments: matchReport.comments,
27+
status: matchReport.status,
2728
},
2829
},
2930
} satisfies Story;

dotcom-rendering/src/components/GetMatchNav.importable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Props = {
2020
type MatchData = {
2121
homeTeam: Pick<TeamType, 'name' | 'score' | 'scorers' | 'crest'>;
2222
awayTeam: Pick<TeamType, 'name' | 'score' | 'scorers' | 'crest'>;
23+
status: string;
2324
comments?: string;
2425
minByMinUrl?: string;
2526
venue?: string;
@@ -35,6 +36,7 @@ const fallbackTeam = {
3536
const fallbackData = {
3637
homeTeam: fallbackTeam,
3738
awayTeam: fallbackTeam,
39+
status: '',
3840
} satisfies MatchData;
3941

4042
const validateMatchData = (data: unknown): data is MatchData => {

dotcom-rendering/src/footballMatch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isOneOf } from '@guardian/libs';
2-
import { listParse } from './footballMatches';
2+
import { listParse, replaceLiveMatchStatus } from './footballMatches';
33
import type {
44
FEFootballMatch,
55
FEFootballPlayer,
@@ -48,6 +48,7 @@ export type FootballPlayer = {
4848
export type FootballMatch = {
4949
homeTeam: FootballTeam;
5050
awayTeam: FootballTeam;
51+
status: string;
5152
comments?: string;
5253
};
5354

@@ -142,6 +143,7 @@ export const parse = (
142143
return ok({
143144
homeTeam: parsedHomeTeam.value,
144145
awayTeam: parsedAwayTeam.value,
146+
status: replaceLiveMatchStatus(feFootballMatch.status),
145147
comments: feFootballMatch.comments,
146148
});
147149
};

dotcom-rendering/src/footballMatches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,6 @@ const paStatusToMatchStatus: Record<string, string> = {
411411
Cancelled: 'C', // A Match has been Cancelled.
412412
};
413413

414-
const replaceLiveMatchStatus = (status: string): string => {
414+
export const replaceLiveMatchStatus = (status: string): string => {
415415
return paStatusToMatchStatus[status] ?? status.slice(0, 2);
416416
};

dotcom-rendering/src/frontend/feFootballMatchPage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type FEFootballMatch = {
3636
id: string;
3737
homeTeam: FEFootballTeam;
3838
awayTeam: FEFootballTeam;
39+
status: string;
3940
comments?: string;
4041
};
4142

dotcom-rendering/src/frontend/schemas/feFootballMatchPage.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,18 @@
281281
"shotsOn"
282282
]
283283
},
284+
"status": {
285+
"type": "string"
286+
},
284287
"comments": {
285288
"type": "string"
286289
}
287290
},
288291
"required": [
289292
"awayTeam",
290293
"homeTeam",
291-
"id"
294+
"id",
295+
"status"
292296
]
293297
}
294298
},

dotcom-rendering/src/layouts/LiveLayout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,7 @@ export const LiveLayout = (props: WebProps | AppsProps) => {
360360
{footballMatchUrl ? (
361361
<Section
362362
showTopBorder={false}
363-
backgroundColour={themePalette(
364-
'--match-nav-background',
365-
)}
363+
backgroundColour={'red'}
366364
borderColour={themePalette('--headline-border')}
367365
leftContent={
368366
<ArticleTitle

dotcom-rendering/src/types/matchReport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export type MatchReportType = {
1313
comments: string;
1414
minByMinUrl: string;
1515
reportUrl: string;
16+
status: string;
1617
};

0 commit comments

Comments
 (0)