Skip to content
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8df78dd
WS-2610: Initial commit
Isabella-Mitchell May 13, 2026
28f453a
WS-2610: Simplifies hook.
Isabella-Mitchell May 13, 2026
09d10b8
WS-2610: Demo option without comparison
Isabella-Mitchell May 13, 2026
4d0cf6a
WS-2610: Co-locate polling with sports header
Isabella-Mitchell May 14, 2026
2ef3e04
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 15, 2026
37a6c86
WS-2610: Refines: handles expected data structure
Isabella-Mitchell May 15, 2026
0a1f3d0
WS-2610: Extends makeRequest. Adds unit tests
Isabella-Mitchell May 15, 2026
f250e5f
WS-2610: Tidy
Isabella-Mitchell May 15, 2026
fbf0fdd
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 15, 2026
4fa752e
WS-2610: fix types. Delete fake fetcher
Isabella-Mitchell May 15, 2026
9386526
WS-2610: temp fix
Isabella-Mitchell May 15, 2026
7237dba
WS-2610: Fix type
Isabella-Mitchell May 15, 2026
fe85bff
Add toggles
hotinglok May 18, 2026
167f5b9
Add toggles to configs
hotinglok May 19, 2026
c3bf0ac
Update snapshots
hotinglok May 19, 2026
c00be4c
Add boolean constructor to toggle values
hotinglok May 19, 2026
16ed143
Remove unused import
hotinglok May 19, 2026
52d804a
WS-2610: Adds polling route
Isabella-Mitchell May 19, 2026
caf87ce
WS-2610: Mocks polling in unit tests
Isabella-Mitchell May 19, 2026
60d7336
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 19, 2026
e73c095
WS-2610: Updates tests. Resolves other errors
Isabella-Mitchell May 19, 2026
866bb65
WS-2610: Tidies
Isabella-Mitchell May 19, 2026
c670535
WS-2610: Fix stories
Isabella-Mitchell May 19, 2026
9c28791
WS-2610: Copilot review suggestions
Isabella-Mitchell May 19, 2026
5f881ea
WS-2610: Fix type error
Isabella-Mitchell May 19, 2026
af7e95f
WS-2610: Renames file to index
Isabella-Mitchell May 20, 2026
7ab2de0
Revert "WS-2610: Renames file to index"
Isabella-Mitchell May 20, 2026
eaa25c1
WS-2610: Renames correct file to index
Isabella-Mitchell May 20, 2026
1b94624
WS-2610: Does not reassign variable
Isabella-Mitchell May 20, 2026
3bedd23
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 20, 2026
2b812f4
WS-2610: rename sports to sport in request
Isabella-Mitchell May 20, 2026
902b8b2
WS-2610: Rename sports to sport in hook
Isabella-Mitchell May 20, 2026
01018e1
Merge branch 'WS-2610-sport-data-polling' into WS-2621-add-sport-head…
hotinglok May 20, 2026
9ac44d7
Fix tests
hotinglok May 20, 2026
9bdf137
WS-2610-extra: Update param
Isabella-Mitchell May 20, 2026
c957f9f
Fix story
hotinglok May 20, 2026
33f9ff5
Merge pull request #14032 from bbc/WS-2621-add-sport-header-toggles
hotinglok May 20, 2026
c724423
Merge branch 'WS-2610-sport-data-polling' into WS-2610-extra
hotinglok May 20, 2026
44d8573
Merge pull request #14043 from bbc/WS-2610-extra
hotinglok May 20, 2026
e70c87c
Merge branch 'latest' into WS-2610-sport-data-polling
hotinglok May 20, 2026
223841f
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 21, 2026
c8038b5
WS-2610: Amends polling fixture data based on real request
Isabella-Mitchell May 21, 2026
f90ff03
WS-2610: Updates types [copilot]
Isabella-Mitchell May 21, 2026
90b88f1
Merge branch 'latest' into WS-2610-sport-data-polling
Isabella-Mitchell May 21, 2026
462e93c
WS-2610-extra: missed commit
Isabella-Mitchell May 21, 2026
ad2bdc5
Revert "WS-2610-extra: missed commit"
Isabella-Mitchell May 21, 2026
90c333d
Revert "WS-2610: Updates types [copilot]"
Isabella-Mitchell May 21, 2026
3f67dea
WS-2610: Refactors approach
Isabella-Mitchell May 21, 2026
43ea9eb
WS-2610-extra: Fix tests
Isabella-Mitchell May 21, 2026
7e032a7
WS-2610: Simplifies test suit
Isabella-Mitchell May 21, 2026
d8c4d8d
Merge branch 'WS-2610-sport-data-polling' into WS-2610-extra-adjust-e…
Isabella-Mitchell May 21, 2026
b9b60c2
Merge pull request #14052 from bbc/WS-2610-extra-adjust-expected-data…
Isabella-Mitchell May 21, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type StoryData = HeadToHeadV2Data & {
};

interface ComponentProps {
data: StoryData;
initialSportData: StoryData;
isConciseView?: boolean;
shouldShowActions?: boolean;
maximumContainerScoreDigits?: number;
Expand All @@ -80,15 +80,15 @@ const baseData = fixtureData.data.sportDataEventContent
.sportDataEvent as unknown as StoryData;

const Component = ({
data,
initialSportData,
isConciseView = false,
shouldShowActions = true,
maximumContainerScoreDigits,
teamBadgePlaceholderFallbackType = 'badge',
}: ComponentProps) => {
return (
<HeadToHeadV2
data={data}
initialSportData={initialSportData}
isConciseView={isConciseView}
shouldShowActions={shouldShowActions}
maximumContainerScoreDigits={maximumContainerScoreDigits}
Expand All @@ -97,9 +97,13 @@ const Component = ({
);
};

export const Default = () => <Component data={baseData} />;
export const Default = () => <Component initialSportData={baseData} />;
export const ConciseView = () => (
<Component data={baseData} isConciseView shouldShowActions={false} />
<Component
initialSportData={baseData}
isConciseView
shouldShowActions={false}
/>
);

export const CancelledEvent = HeadToHeadV2Component.bind({});
Expand All @@ -115,6 +119,7 @@ export const EventWithOnwardJourneyHoverConcise =

// @ts-expect-error - PS copy and paste
CancelledEvent.args = {
urn: 'urn:bbc:sportsdata:football:event:s-3y91hnyfjh24yxjhm77a7hy50',
home: 'Fulham',
away: 'Liverpool',
baseData: cancelledEventData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import useSportDataPolling from '#app/hooks/useSportDataPolling';
import useToggle from '#app/hooks/useToggle';
import Footer from './components/footer';
import HeadToHeadHeader from './components/head-to-head-header';
import { HeadToHeadBanner } from './components/head-to-head-banner';
Expand All @@ -7,21 +9,30 @@ import { HeadToHeadV2Data } from './types';
import styles from './index.styles';

export const HeadToHeadV2 = ({
data,
initialSportData,
isConciseView,
shouldShowActions,
maximumContainerScoreDigits,
teamBadgePlaceholderFallbackType = 'badge',
isSportDataLive = false,
Comment thread
Isabella-Mitchell marked this conversation as resolved.
}: {
data: HeadToHeadV2Data;
initialSportData: HeadToHeadV2Data;
isConciseView?: boolean;
shouldShowActions?: boolean;
maximumContainerScoreDigits?: number;
teamBadgePlaceholderFallbackType?: 'badge' | 'flag';
isSportDataLive?: boolean;
}) => {
const { enabled: sportHeaderPollEnabled } = useToggle('sportDataPolling');

const { currentSportData } = useSportDataPolling(
initialSportData,
Boolean(sportHeaderPollEnabled) && isSportDataLive,
);

const hasActions =
(data?.home?.actions?.length ?? 0) > 0 ||
(data?.away?.actions?.length ?? 0) > 0;
(currentSportData?.home?.actions?.length ?? 0) > 0 ||
(currentSportData?.away?.actions?.length ?? 0) > 0;

// TODO: Re-enable badge visibility logic once we have the necessary badge mappings in place
const shouldHideBadges = true;
Expand All @@ -32,26 +43,30 @@ export const HeadToHeadV2 = ({
<div css={styles.container({ isConciseView })}>
{!isConciseView && (
<HeadToHeadHeader
date={data.date}
status={data.status}
tournamentDescriptionLabel={data.tournamentDescriptionLabel}
date={currentSportData.date}
status={currentSportData.status}
tournamentDescriptionLabel={
currentSportData.tournamentDescriptionLabel
}
/>
)}
<HeadToHeadBanner
data={data}
data={currentSportData}
isConciseView={isConciseView ?? false}
eventSummary={data.accessibleEventSummary}
eventSummary={currentSportData.accessibleEventSummary}
shouldHideBadges={shouldHideBadges}
maxScoreLength={maximumContainerScoreDigits}
teamBadgePlaceholderFallbackType={teamBadgePlaceholderFallbackType}
/>
{hasActions && shouldShowActions && <Actions data={data} />}
{!isConciseView && <Actions data={data} />}
{hasActions && shouldShowActions && (
<Actions data={currentSportData} />
)}
{!isConciseView && <Actions data={currentSportData} />}
{!isConciseView && (
<Footer
venue={data.venue?.name || 'To be confirmed'}
attendanceValue={data.attendance?.value}
attendanceInfo={data.attendance?.additionalInfo}
venue={currentSportData.venue?.name || 'To be confirmed'}
attendanceValue={currentSportData.attendance?.value}
attendanceInfo={currentSportData.attendance?.additionalInfo}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const HeadToHeadV2ConciseComponent = (args: StoryArgs) => {

return (
<HeadToHeadV2
data={updatedStoryBookControls}
initialSportData={updatedStoryBookControls}
isConciseView
shouldShowActions={false}
/>
Expand Down Expand Up @@ -153,7 +153,7 @@ export const HeadToHeadV2Component = (args: StoryArgs) => {

return (
<HeadToHeadV2
data={updatedStoryBookControls}
initialSportData={updatedStoryBookControls}
isConciseView={false}
shouldShowActions={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ import {
import HeadToHead from '../head-to-head-v2';
import type { HeadToHeadV2Data } from '../types';

jest.mock('#app/hooks/useSportDataPolling', () => ({
__esModule: true,
default: jest.fn(initialSportData => ({
currentSportData: initialSportData,
})),
}));

interface RenderOptions {
data: HeadToHeadV2Data;
isConciseView?: boolean;
Expand All @@ -42,7 +49,7 @@ const renderHeadToHead = ({
}: RenderOptions) =>
render(
<HeadToHead
data={data}
initialSportData={data}
isConciseView={isConciseView}
shouldShowActions={shouldShowActions}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export type Team = {
};

export type HeadToHeadV2Data = {
/**
* The event's unique urn.
*/
urn: string;
/**
Comment thread
Isabella-Mitchell marked this conversation as resolved.
* The event's unique id.
*/
Expand Down Expand Up @@ -206,7 +210,7 @@ export type BadgeSize =
| { small?: number; medium?: number; large?: number };

export interface HeadToHeadV2Props {
data: HeadToHeadV2Data;
initialSportData: HeadToHeadV2Data;
isConciseView: boolean;
shouldShowActions?: boolean;
/**
Expand Down
132 changes: 132 additions & 0 deletions src/app/hooks/useSportDataPolling/fixture/fixtureSportData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
export default {
urn: 'urn:bbc:sportsdata:football:event:s-3y91hnyfjh24yxjhm77a7hy50',
home: {
id: 'ej5er0oyngdw138yuumwqbyqt',
fullName: 'Bologna',
shortName: 'Bologna',
urn: 'urn:bbc:sportsdata:football:team:bologna',
runningScores: {
halftime: '0',
fulltime: '1',
aggregate: '1',
},
scoreUnconfirmed: '1',
actions: [
{
playerUrn:
'urn:bbc:sportsdata:football:player:s-2bmeynv0dhsc8sjfuaprkexre',
playerName: 'J. Rowe',
actionType: 'goal',
actions: [
{
type: 'Goal',
typeLabel: { value: 'Goal', accessible: 'Goal' },
timeLabel: {
value: "90'",
accessible: '90 minutes',
},
},
],
},
],
score: '1',
},
away: {
id: 'b496gs285it6bheuikox6z9mj',
fullName: 'Aston Villa',
shortName: 'Aston Villa',
urn: 'urn:bbc:sportsdata:football:team:aston-villa',
runningScores: {
halftime: '1',
fulltime: '3',
aggregate: '3',
},
scoreUnconfirmed: '3',
actions: [
{
playerUrn:
'urn:bbc:sportsdata:football:player:s-8qys6qtdwgsycxducl062zld5',
playerName: 'E. Konsa',
actionType: 'goal',
actions: [
{
type: 'Goal',
typeLabel: { value: 'Goal', accessible: 'Goal' },
timeLabel: {
value: "44'",
accessible: '44 minutes',
},
},
],
},
{
playerUrn:
'urn:bbc:sportsdata:football:player:s-5m0j33eoa5c8pqlr0tdf7undh',
playerName: 'O. Watkins',
actionType: 'goal',
actions: [
{
type: 'Goal',
typeLabel: { value: 'Goal', accessible: 'Goal' },
timeLabel: {
value: "51'",
accessible: '51 minutes',
},
},
{
type: 'Goal',
typeLabel: { value: 'Goal', accessible: 'Goal' },
timeLabel: {
value: "90'+4",
accessible: '90 minutes plus 4',
},
},
],
},
],
score: '3',
},
time: {
accessibleTime: '20:00',
displayTimeUK: '20:00',
timeCertainty: true,
},
date: 'Thu 9 Apr 2026',
tournament: {
id: '4c1nfi2j1m731hcay25fcgndq',
name: 'UEFA Europa League',
disambiguatedName: 'UEFA Europa League',
urn: 'urn:bbc:sportsdata:football:tournament:europa-league',
thingsGuid: '2afbdda7-71d4-544d-bcc6-d9ff50314b2a',
},
stage: {
id: '7wxuj38kqm8bz3cmi15vu4w7o',
name: 'Quarter-finals',
urn: '',
},
multiLeg: {
leg: 1,
relatedMatchId: 's-9ur6e6w5f4ahyxph7ef4rks2c',
},
period: 'ft',
venue: {
id: '2nrn0y55nz9ee7p9adzbb7fta',
urn: 'urn:bbc:sportsdata:football:venue:s-2nrn0y55nz9ee7p9adzbb7fta',
name: "Stadio Renato Dall'Ara",
shortName: "Stadio Renato Dall'Ara",
},
attendance: { value: 31142 },
status: 'PostEvent',
periodLabel: { value: 'FT', accessible: 'Full time' },
winner: 'away',
tournamentDescriptionLabel: 'UEFA Europa League - Quarter-finals',
groupedActions: [
{
groupName: { fullName: 'Assists', shortName: 'Assists' },
homeTeamActions: ["J. Lucumí (90')"],
awayTeamActions: ["Y. Tielemans (44', 90'+4)", "E. Buendía (51')"],
},
],
accessibleEventSummary: 'Bologna 1 , Aston Villa 3 at Full time',
sportDiscipline: 'football',
};
Loading
Loading