Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,151 changes: 0 additions & 2,151 deletions dotcom-rendering/fixtures/generated/cricket-match.ts

This file was deleted.

2 changes: 1 addition & 1 deletion dotcom-rendering/fixtures/manual/cricketMatch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FECricketMatch } from '../../src/frontend/feCricketMatchPage';
import type { FECricketMatch } from '../../src/frontend/feCricketMatchData';

export const liveMatch: FECricketMatch = {
teams: [
Expand Down
5 changes: 0 additions & 5 deletions dotcom-rendering/scripts/jsonSchema/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const program = TJS.getProgramFromFiles(
path.resolve(`${root}/src/frontend/feTagPage.ts`),
path.resolve(`${root}/src/types/newslettersPage.ts`),
path.resolve(`${root}/src/types/editionsCrossword.ts`),
path.resolve(`${root}/src/frontend/feCricketMatchPage.ts`),
path.resolve(`${root}/src/frontend/feFootballMatchListPage.ts`),
path.resolve(`${root}/src/frontend/feFootballTablesPage.ts`),
path.resolve(`${root}/src/frontend/feFootballMatchInfoPage.ts`),
Expand Down Expand Up @@ -69,10 +68,6 @@ const schemas = [
typeName: 'FEFootballTablesPage',
file: `${root}/src/frontend/schemas/feFootballTablesPage.json`,
},
{
typeName: 'FECricketMatchPage',
file: `${root}/src/frontend/schemas/feCricketMatchPage.json`,
},
{
typeName: 'FEFootballMatchInfoPage',
file: `${root}/src/frontend/schemas/feFootballMatchInfoPage.json`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react-webpack5';
import type { ComponentProps } from 'react';
import { expect, waitFor, within } from 'storybook/test';
import type { FECricketMatchHeader } from '../../frontend/feCricketMatchHeader';
import type {
FECricketInnings,
FECricketMatch,
} from '../../frontend/feCricketMatchPage';
} from '../../frontend/feCricketMatchData';
import type { FECricketMatchHeader } from '../../frontend/feCricketMatchHeader';
import type { ArticleFormat } from '../../lib/articleFormat';
import type { ArticleDeprecated } from '../../types/article';
import { CricketMatchHeader } from './CricketMatchHeader';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {
CricketMatch,
CricketResult,
CricketTeam,
} from '../../cricketMatchV2';
} from '../../cricketMatch';
import { grid } from '../../grid';
import { ArticleDesign, type ArticleFormat } from '../../lib/articleFormat';
import { getCommercialClient } from '../../lib/bridgetApi';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { safeParse } from 'valibot';
import { type CricketMatch, parseCricketMatchV2 } from '../../cricketMatchV2';
import { type CricketMatch, parseCricketMatch } from '../../cricketMatch';
import type { FECricketMatchHeader } from '../../frontend/feCricketMatchHeader';
import { feCricketMatchHeaderSchema } from '../../frontend/feCricketMatchHeader';
import { safeParseURL } from '../../lib/parse';
Expand All @@ -22,7 +22,7 @@ export const parse =
return error('Failed to validate match header json');
}

const parsedMatch = parseCricketMatchV2(feData.value.cricketMatch);
const parsedMatch = parseCricketMatch(feData.value.cricketMatch);

if (!parsedMatch.ok) {
return error('Failed to parse the match from the header json');
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/CricketMatchStat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
textSansBold15,
visuallyHidden,
} from '@guardian/source/foundations';
import type { Batter } from '../cricketMatchV2';
import type { Batter } from '../cricketMatch';
import { palette } from '../palette';

const containerCss = css`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from '@emotion/react';
import { breakpoints, from } from '@guardian/source/foundations';
import preview from '../../.storybook/preview';
import type { FECricketMatchStatsSummary } from '../frontend/feCricketMatchPage';
import type { FECricketMatchStatsSummary } from '../frontend/feCricketMatchData';
import { palette } from '../palette';
import { CricketMiniMatchStats as CricketMiniMatchStatsComponent } from './CricketMiniMatchStats';

Expand Down
6 changes: 3 additions & 3 deletions dotcom-rendering/src/components/CricketMiniMatchStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
import type { SWRConfiguration } from 'swr';
import useSWR from 'swr';
import { safeParse } from 'valibot';
import type { CricketMatchStatsSummary } from '../cricketMatchV2';
import { parseMatchStatsSummary } from '../cricketMatchV2';
import { feCricketMatchStatsSummarySchema } from '../frontend/feCricketMatchPage';
import type { CricketMatchStatsSummary } from '../cricketMatch';
import { parseMatchStatsSummary } from '../cricketMatch';
import { feCricketMatchStatsSummarySchema } from '../frontend/feCricketMatchData';
import type { Result } from '../lib/result';
import { error, fromValibot, ok } from '../lib/result';
import { palette } from '../palette';
Expand Down
122 changes: 95 additions & 27 deletions dotcom-rendering/src/components/CricketScorecard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
import { breakpoints } from '@guardian/source/foundations';
import { centreColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { allModes } from '../../.storybook/modes';
import preview from '../../.storybook/preview';
import { CricketScorecard as CricketScorecardComponent } from './CricketScorecard';
import { CricketScorecardNew as CricketScorecardNewComponent } from './CricketScorecard';

const meta = preview.meta({
component: CricketScorecardComponent,
title: 'Components/CricketScorecard',
decorators: [
// To make the story not shoved in the corner.
(Story) => (
<>
<div css={{ padding: 16 }}>
<Story />
</div>
</>
),
],
component: CricketScorecardNewComponent,
title: 'Components/CricketScorecardNew',
decorators: [centreColumnDecorator],
parameters: {
chromatic: {
viewports: [breakpoints.mobileLandscape],
modes: {
'light leftCol': allModes['light leftCol'],
},
},
},
});

export const CricketScorecard = meta.story({
name: 'Cricket Scorecard',
export const CricketScorecardNew = meta.story({
name: 'Cricket Scorecard (New)',
args: {
allInnings: [
{
description: 'India first innings',
battingTeam: 'India',
order: 1,
declared: false,
forfeited: false,
inningsTotals: {
runs: 254,
overs: '49.0',
Expand All @@ -52,7 +49,7 @@ export const CricketScorecard = meta.story({
howOut: 'st Latham b Ravindra',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Shubman Gill',
Expand All @@ -63,7 +60,7 @@ export const CricketScorecard = meta.story({
howOut: 'c Phillips b Santner',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Virat Kohli',
Expand All @@ -74,7 +71,7 @@ export const CricketScorecard = meta.story({
howOut: 'lbw b Bracewell',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Shreyas Iyer',
Expand All @@ -85,7 +82,40 @@ export const CricketScorecard = meta.story({
howOut: 'c Ravindra b Santner',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Lokesh Rahul',
ballsFaced: 45,
runs: 39,
fours: 3,
sixes: 0,
howOut: 'run out (Williamson)',
out: true,
onStrike: false,
nonStrike: true,
},
{
name: 'Hardik Pandya',
ballsFaced: 18,
runs: 22,
fours: 2,
sixes: 1,
howOut: 'c Bracewell b Smith',
out: true,
nonStrike: true,
onStrike: false,
},
{
name: 'Ravindra Jadeja',
ballsFaced: 24,
runs: 30,
fours: 1,
sixes: 0,
howOut: 'not out',
out: false,
onStrike: true,
nonStrike: true,
},
],
bowlers: [
Expand Down Expand Up @@ -157,6 +187,11 @@ export const CricketScorecard = meta.story({
],
},
{
description: 'New Zealand first innings',
battingTeam: 'New Zealand',
order: 2,
declared: false,
forfeited: false,
inningsTotals: {
runs: 254,
overs: '49.0',
Expand All @@ -170,8 +205,6 @@ export const CricketScorecard = meta.story({
penalties: 0,
wides: 13,
},
description: 'New Zealand first innings',
battingTeam: 'New Zealand',
batters: [
{
name: 'Will Young',
Expand All @@ -182,7 +215,7 @@ export const CricketScorecard = meta.story({
howOut: 'lbw b Vinod',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Rachin Ravindra',
Expand All @@ -193,7 +226,7 @@ export const CricketScorecard = meta.story({
howOut: 'b Yadav',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Kane Williamson',
Expand All @@ -204,7 +237,7 @@ export const CricketScorecard = meta.story({
howOut: 'c & b Yadav',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Daryl Mitchell',
Expand All @@ -215,7 +248,40 @@ export const CricketScorecard = meta.story({
howOut: 'c Sharma b Ahmed',
out: true,
onStrike: false,
nonStrike: false,
nonStrike: true,
},
{
name: 'Tom Latham',
ballsFaced: 56,
runs: 44,
fours: 4,
sixes: 0,
howOut: 'c Kohli b Shami',
out: true,
onStrike: false,
nonStrike: true,
},
{
name: 'Glenn Phillips',
ballsFaced: 34,
runs: 55,
fours: 3,
sixes: 3,
howOut: 'not out',
out: false,
onStrike: true,
nonStrike: true,
},
{
name: 'Michael Bracewell',
ballsFaced: 8,
runs: 5,
fours: 0,
sixes: 0,
howOut: 'not out',
out: false,
onStrike: false,
nonStrike: true,
},
],
bowlers: [
Expand Down Expand Up @@ -274,6 +340,7 @@ export const CricketScorecard = meta.story({
'R S Madugalle',
],
homeTeam: {
paID: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
name: 'India',
lineup: [
'Rohit Sharma',
Expand All @@ -290,6 +357,7 @@ export const CricketScorecard = meta.story({
],
},
awayTeam: {
paID: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
name: 'New Zealand',
lineup: [
'Rachin Ravindra',
Expand Down
Loading
Loading