Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate how we incorporate onward journeys into the navigation #12254

Draft
wants to merge 21 commits into
base: latest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
81 changes: 56 additions & 25 deletions src/app/legacy/components/ScrollablePromo/Promo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,66 @@
color: ${({ theme }) => theme.isDarkUi && theme.palette.GREY_6};
`;

const Promo = ({ block, onClick }) => {
const Promo = ({ block, variant, onClick }) => {
const { script, service, serviceDatetimeLocale } = useContext(ServiceContext);
const textBlock = filterForBlockType(
pathOr({}, ['model', 'blocks'], block),
'text',
);
const aresLinkBlock = filterForBlockType(
pathOr({}, ['model', 'blocks'], block),
'aresLink',
);
const href = pathOr(
'',
['model', 'blocks', '0', 'model', 'blocks', '0', 'model', 'locator'],
textBlock,
);
const title = pathOr(
'',
['model', 'blocks', '0', 'model', 'blocks', '0', 'model', 'text'],
textBlock,
);
const timestamp = path(
['model', 'blocks', '0', 'model', 'timestamp'],
aresLinkBlock,
);
let title;
let href;
let textBlock;
let aresLinkBlock;
let timestamp;
switch (variant) {
case 'A':
title = pathOr(
block.headline || '',
[
'headlines',
'promoHeadline',
'blocks',
'0',
'model',
'blocks',
'0',
'model',
'text',
],
block,
);
href = pathOr('', ['locators', 'canonicalUrl'], block);
break;
case 'B':
title = block.title;
href = block.href;
break;
default:
textBlock = filterForBlockType(
pathOr({}, ['model', 'blocks'], block),
'text',
);
aresLinkBlock = filterForBlockType(
pathOr({}, ['model', 'blocks'], block),
'aresLink',
);
timestamp = path(
['model', 'blocks', '0', 'model', 'timestamp'],
aresLinkBlock,
);
href = pathOr(
'',
['model', 'blocks', '0', 'model', 'blocks', '0', 'model', 'locator'],
textBlock,
);
title = pathOr(
'',
['model', 'blocks', '0', 'model', 'blocks', '0', 'model', 'text'],
textBlock,
);
break;
}
console.log('title', title, 'href', href, 'timestamp', timestamp);

Check warning on line 139 in src/app/legacy/components/ScrollablePromo/Promo/index.jsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected console statement

const isOperaMini = useOperaMiniDetection();

const WrapperPromoBox = isOperaMini ? OperaPromoBox : PromoBox;

return (
<WrapperPromoBox>
<StyledLink
Expand All @@ -120,7 +151,7 @@
>
{title}
</StyledLink>
{timestamp && (
{timestamp && !variant && (
<TimeStamp serviceDatetimeLocale={serviceDatetimeLocale}>
{timestamp}
</TimeStamp>
Expand Down
7 changes: 4 additions & 3 deletions src/app/legacy/components/ScrollablePromo/PromoList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@
margin-${dir === 'ltr' ? `left` : `right`}: 0;}`}
`;

const PromoList = ({ blocks, viewTracker, onClick }) => {
const PromoList = ({ blocks, variant, viewTracker, onClick }) => {
console.log('in promo list', blocks, variant);

Check warning on line 83 in src/app/legacy/components/ScrollablePromo/PromoList/index.jsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected console statement
const { dir } = useContext(ServiceContext);
const isOperaMini = useOperaMiniDetection();
const listBlocks = blocks.slice(0, 3);
const listBlocks = variant === 'B' ? blocks.slice(0, 5) : blocks.slice(0, 3);

const ScrollPromo = isOperaMini ? OperaScrollPromo : StandardScrollPromo;
const List = isOperaMini ? OperaStyledList : StyledList;
Expand All @@ -97,7 +98,7 @@
return (
// eslint-disable-next-line react/no-array-index-key
<List key={index} dir={dir}>
<Promo block={block} onClick={onClick} />
<Promo block={block} variant={variant} onClick={onClick} />
</List>
);
})}
Expand Down
252 changes: 252 additions & 0 deletions src/app/legacy/components/ScrollablePromo/helpers/fixtureData.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,3 +1334,255 @@ export const PromoSingleBlock = {
},
position: [5, 3],
};

export const MostReadBlocks = [
{
id: 'urn:bbc:optimo:asset:cg4z0d2xgq3o',
rank: 1,
title:
'Putin apologise for Azerbaijan Airlines crash but no accept blame for di crash',
href: 'https://www.bbc.com/pidgin/articles/cg4z0d2xgq3o',
timestamp: '2024-12-28T14:30:33.956Z',
},
{
id: 'urn:bbc:optimo:asset:cj30vyvmn3xo',
rank: 2,
title: 'Court remand Queen Naomi and Oriyomi Hamzat for prison',
href: 'https://www.bbc.com/pidgin/articles/cj30vyvmn3xo',
timestamp: '2024-12-24T14:31:03.815Z',
},
{
id: 'urn:bbc:optimo:asset:c3rq3lzr3gpo',
rank: 3,
title:
"'Make everybody help me beg make dem release my pikin' - Ex-Queen Naomi mama speak after deadly Ibadan stampede",
href: 'https://www.bbc.com/pidgin/articles/c3rq3lzr3gpo',
timestamp: '2024-12-27T12:00:17.653Z',
},
{
id: 'urn:bbc:optimo:asset:clyvjjxn0pmo',
rank: 4,
title:
'Life and Times of Romeo and Juliet star Olivia Hussey wey die at 73',
href: 'https://www.bbc.com/pidgin/articles/clyvjjxn0pmo',
timestamp: '2024-12-28T09:40:51.463Z',
},
{
id: 'urn:bbc:optimo:asset:c7veqd6vr7lo',
rank: 5,
title:
"Nigerian military say na 'secondary explosion' kill 10 pipo for Sokoto State",
href: 'https://www.bbc.com/pidgin/articles/c7veqd6vr7lo',
timestamp: '2024-12-27T14:25:38.267Z',
},
{
id: 'urn:bbc:optimo:asset:c5y4j20443do',
rank: 6,
title:
"'Why di next project I go dey for gatz beta pass Seven Doors' - Chioma Akpotha",
href: 'https://www.bbc.com/pidgin/articles/c5y4j20443do',
timestamp: '2024-12-28T06:33:30.811Z',
},
{
id: 'urn:bbc:optimo:asset:cn9g805eqpno',
rank: 7,
title:
'IPMAN, MRS and NNPC new fuel price rate – price of fuel go kontinu to go down?',
href: 'https://www.bbc.com/pidgin/articles/cn9g805eqpno',
timestamp: '2024-12-23T17:00:30.378Z',
},
{
id: 'urn:bbc:optimo:asset:cly2x6pv5zqo',
rank: 8,
title: "'Phone and technology don take di only job wey I know'",
href: 'https://www.bbc.com/pidgin/articles/cly2x6pv5zqo',
timestamp: '2024-12-27T09:12:40.775Z',
},
{
id: 'urn:bbc:optimo:asset:cpqd5yy8p4xo',
rank: 9,
title:
'Wetin pipo see na Baltasar Engonga sex videos but wetin dey happun for Equatorial Guinea pass like dat ',
href: 'https://www.bbc.com/pidgin/articles/cpqd5yy8p4xo',
timestamp: '2024-11-10T07:44:00.348Z',
},
{
id: 'urn:bbc:optimo:asset:c33dl4388p4o',
rank: 10,
title: 'Nasa make history wit closest-ever approach to di Sun',
href: 'https://www.bbc.com/pidgin/articles/c33dl4388p4o',
timestamp: '2024-12-27T14:38:29.323Z',
},
];

export const TopStoriesBlocks = [
{
locators: {
optimoUrn: 'urn:bbc:optimo:asset:cg4z0d2xgq3o',
canonicalUrl: 'https://www.bbc.com/pidgin/articles/cg4z0d2xgq3o',
},
timestamp: 1735396233956,
suitableForSyndication: true,
language: 'pcm',
headlines: {
seoHeadline:
'Azerbaijan Airlines: Putin tok sorry for airline crash but no take blame for am',
promoHeadline: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'Putin apologise for Azerbaijan Airlines crash but no accept blame for di crash',
blocks: [
{
type: 'fragment',
model: {
text: 'Putin apologise for Azerbaijan Airlines crash but no accept blame for di crash',
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
images: { defaultPromoImage: [Object] },
summary: { blocks: [Array] },
passport: {
language: 'pcm',
home: 'http://www.bbc.co.uk/ontologies/passport/home/Pidgin',
locator: 'urn:bbc:optimo:asset:cg4z0d2xgq3o',
availability: 'AVAILABLE',
taggings: [Array],
schemaVersion: '1.4.0',
publishedState: 'PUBLISHED',
predicates: [Object],
},
serviceIdentifier: 'Pidgin',
breakingNews: { isBreaking: false },
consumableAsSFV: false,
id: 'urn:bbc:ares::article:cg4z0d2xgq3o',
type: 'optimo',
},
{
locators: {
optimoUrn: 'urn:bbc:optimo:asset:c7veqd6vr7lo',
canonicalUrl: 'https://www.bbc.com/pidgin/articles/c7veqd6vr7lo',
},
timestamp: 1735309538267,
suitableForSyndication: true,
language: 'pcm',
headlines: {
seoHeadline:
"Sokoto airstrikes: Nigerian military say na 'secondary explosion' kill 10 pipo",
promoHeadline: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: "Nigerian military say na 'secondary explosion' kill 10 pipo for Sokoto State",
blocks: [
{
type: 'fragment',
model: {
text: "Nigerian military say na 'secondary explosion' kill 10 pipo for Sokoto State",
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
images: { defaultPromoImage: [Object] },
summary: { blocks: [Array] },
passport: {
language: 'pcm',
home: 'http://www.bbc.co.uk/ontologies/passport/home/Pidgin',
locator: 'urn:bbc:optimo:asset:c7veqd6vr7lo',
availability: 'AVAILABLE',
taggings: [Array],
schemaVersion: '1.4.0',
publishedState: 'PUBLISHED',
predicates: [Object],
},
serviceIdentifier: 'Pidgin',
breakingNews: { isBreaking: false },
consumableAsSFV: false,
id: 'urn:bbc:ares::article:c7veqd6vr7lo',
type: 'optimo',
},
{
locators: {
optimoUrn: 'urn:bbc:optimo:asset:c33dl4388p4o',
canonicalUrl: 'https://www.bbc.com/pidgin/articles/c33dl4388p4o',
},
timestamp: 1735310309323,
suitableForSyndication: true,
language: 'pcm',
headlines: {
seoHeadline:
'Nasa Parker Solar Probe survive closest-ever approach to Sun',
promoHeadline: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'Nasa make history wit closest-ever approach to di Sun',
blocks: [
{
type: 'fragment',
model: {
text: 'Nasa make history wit closest-ever approach to di Sun',
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
images: { defaultPromoImage: [Object] },
summary: { blocks: [Array] },
passport: {
language: 'pcm',
home: 'http://www.bbc.co.uk/ontologies/passport/home/Pidgin',
locator: 'urn:bbc:optimo:asset:c33dl4388p4o',
availability: 'AVAILABLE',
taggings: [Array],
schemaVersion: '1.4.0',
publishedState: 'PUBLISHED',
predicates: [Object],
},
byline: { blocks: [Array] },
serviceIdentifier: 'Pidgin',
breakingNews: { isBreaking: false },
consumableAsSFV: false,
id: 'urn:bbc:ares::article:c33dl4388p4o',
type: 'optimo',
},
];
Loading
Loading