Skip to content

Commit

Permalink
Merge branch 'latest' into revert-11261-revert-11122-remove-nodefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
amoore108 committed Jun 19, 2024
2 parents 9ba5269 + 145fcea commit bb31d44
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 61 deletions.
1 change: 0 additions & 1 deletion src/app/components/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const Image = ({
}: PropsWithChildren<Props>) => {
const { pageType, isLite } = useContext(RequestContext);
const [isLoaded, setIsLoaded] = useState(false);

if (isLite) return null;

const showPlaceholder = placeholder && !isLoaded;
Expand Down
14 changes: 8 additions & 6 deletions src/app/legacy/components/Promo/image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const ChildWrapper = styled.div`
// promos with images via Programmes (which can be of type audio and possibly others) use a different iChef recipe requiring a second set of resolutions
// https://github.com/bbc/programme-images/tree/master/webapp/ichef/recipes
const createSrcSet = (imageUrl, suffix = '', isProgrammeImage) => {
const imageResolutions = [85, 120, 170, 232, 325, 450, 660];
const imageResolutionsProgrammes = [96, 128, 176, 240, 352, 464, 672];
const imageResolutions = [85, 120, 170, 232, 325, 450, 660, 800];
const imageResolutionsProgrammes = [96, 128, 176, 240, 352, 464, 672, 800];

const resolutions = isProgrammeImage
? imageResolutionsProgrammes
Expand All @@ -35,18 +35,20 @@ const createSrcSet = (imageUrl, suffix = '', isProgrammeImage) => {
const createSizes = (useLargeImages, isProgrammeImage) => {
// 4 columns of fixed width
const DESKTOP_SIZE = useLargeImages
? `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 660px`
? `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 800px`
: `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 232px`;

const DESKTOP_SIZE_PROGRAMMES = useLargeImages
? `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 672px`
? `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 800px`
: `(min-width: ${GEL_GROUP_4_SCREEN_WIDTH_MIN}) 240px`;

// 2 columns of 50% screen width - images are 100% of the column
const TABLET_SIZE = `(min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) 50vw`;
const TABLET_SIZE = useLargeImages
? `(min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) 66vw`
: `(min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) 50vw`;

// 1 column of 100% screen width - images are 33% of the column
const MOBILE_SIZE = `33vw`;
const MOBILE_SIZE = useLargeImages ? `100vw` : `33vw`;

return [
isProgrammeImage ? DESKTOP_SIZE_PROGRAMMES : DESKTOP_SIZE,
Expand Down
8 changes: 4 additions & 4 deletions src/app/legacy/components/Promo/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ describe('Promo component - Image', () => {
`(min-width: 63rem) 232px, (min-width: 37.5rem) 50vw, 33vw`,
);
});
it('should use large image resolution and width when large image is true', () => {
it('should use large image resolution and width when large image is true on desktop', () => {
render(<Fixture useLargeImages />);
const imageEl = screen.getByAltText('Test image alt text');
expect(imageEl).toHaveAttribute(
'sizes',
`(min-width: 63rem) 660px, (min-width: 37.5rem) 50vw, 33vw`,
`(min-width: 63rem) 800px, (min-width: 37.5rem) 66vw, 100vw`,
);
});

Expand All @@ -60,7 +60,7 @@ describe('Promo component - Image', () => {
const image = screen.getByAltText('Test image alt text');
const srcSet = image.getAttribute('srcSet');

const expectedResolutions = [96, 128, 176, 240, 352, 464, 672];
const expectedResolutions = [96, 128, 176, 240, 352, 464, 672, 800];
expectedResolutions.forEach(resolution => {
expect(srcSet).toContain(`${resolution}w`);
});
Expand All @@ -72,7 +72,7 @@ describe('Promo component - Image', () => {
const image = screen.getByAltText('Test image alt text');
const srcSet = image.getAttribute('srcSet');

const expectedResolutions = [85, 120, 170, 232, 325, 450, 660];
const expectedResolutions = [85, 120, 170, 232, 325, 450, 660, 800];
expectedResolutions.forEach(resolution => {
expect(srcSet).toContain(`${resolution}w`);
});
Expand Down
4 changes: 0 additions & 4 deletions src/app/lib/config/services/gujarati.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ export const service: DefaultServiceConfig = {
title: 'સમાચાર',
url: '/gujarati',
},
{
title: 'લોકસભા ચૂંટણી 2024',
url: '/gujarati/topics/cg843q7vgq3t',
},
{
title: 'ગુજરાત',
url: '/gujarati/topics/cz74kjn4j5wt',
Expand Down
4 changes: 0 additions & 4 deletions src/app/lib/config/services/hindi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ export const service: DefaultServiceConfig = {
title: 'होम पेज',
url: '/hindi',
},
{
title: 'लोकसभा चुनाव 2024',
url: '/hindi/topics/cm5m26q8qxpt',
},
{
title: 'भारत',
url: '/hindi/topics/ckdxnkz7607t',
Expand Down
4 changes: 0 additions & 4 deletions src/app/lib/config/services/marathi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ export const service: DefaultServiceConfig = {
title: 'बातम्या',
url: '/marathi',
},
{
title: 'लोकसभा निवडणूक 2024',
url: '/marathi/topics/c1wmk63rjkvt',
},
{
title: 'महाराष्ट्र',
url: '/marathi/topics/c5qvpxvv7y3t',
Expand Down
4 changes: 0 additions & 4 deletions src/app/lib/config/services/punjabi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ export const service: DefaultServiceConfig = {
title: 'ਖ਼ਬਰਾਂ',
url: '/punjabi',
},
{
title: 'ਲੋਕ ਸਭਾ ਚੋਣਾਂ 2024',
url: '/punjabi/topics/cz4xp0dw200t',
},
{
title: 'ਵੀਡੀਓ',
url: '/punjabi/topics/cx12qmz6jm4t',
Expand Down
4 changes: 2 additions & 2 deletions src/app/lib/config/services/tamil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ export const service: DefaultServiceConfig = {
url: '/tamil',
},
{
title: 'மக்களவைத் தேர்தல் 2024',
url: '/tamil/topics/cpw2q7jk0kwt',
title: 'டி20 உலகக் கோப்பை',
url: '/tamil/topics/c1nqez19x01t',
},
{
title: 'உலகம்',
Expand Down
4 changes: 0 additions & 4 deletions src/app/lib/config/services/telugu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,6 @@ export const service: DefaultServiceConfig = {
title: 'వార్తలు',
url: '/telugu',
},
{
title: 'ఆంధ్ర ప్రదేశ్ అసెంబ్లీ ఎన్నికలు 2024',
url: '/telugu/topics/c442kv3851yt',
},
{
title: 'వీడియో',
url: '/telugu/topics/cl29j0e3e2dt',
Expand Down
4 changes: 4 additions & 0 deletions src/app/lib/config/services/ukrainian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ const baseServiceConfig = {
title: 'Подкасти',
url: '/ukrainian/podcasts/p09jsy3h',
},
{
title: 'Євро – 2024',
url: '/ukrainian/topics/ckvv0w1kqnzt',
},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,62 +206,55 @@ exports[`AMP Home Page Header Navigation link should match text and url 1`] = `
`;

exports[`AMP Home Page Header Navigation link should match text and url 2`] = `
{
"text": "लोकसभा चुनाव 2024",
"url": "/hindi/topics/cm5m26q8qxpt",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 3`] = `
{
"text": "भारत",
"url": "/hindi/topics/ckdxnkz7607t",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 4`] = `
exports[`AMP Home Page Header Navigation link should match text and url 3`] = `
{
"text": "विदेश",
"url": "/hindi/topics/c9wpm0en87xt",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 5`] = `
exports[`AMP Home Page Header Navigation link should match text and url 4`] = `
{
"text": "मनोरंजन",
"url": "/hindi/topics/c06gq3n0pp7t",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 6`] = `
exports[`AMP Home Page Header Navigation link should match text and url 5`] = `
{
"text": "खेल",
"url": "/hindi/topics/cwr9j8g1kj9t",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 7`] = `
exports[`AMP Home Page Header Navigation link should match text and url 6`] = `
{
"text": "विज्ञान-टेक्नॉलॉजी",
"url": "/hindi/topics/c2lej0594knt",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 8`] = `
exports[`AMP Home Page Header Navigation link should match text and url 7`] = `
{
"text": "सोशल",
"url": "/hindi/topics/c2e4q0z9qznt",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 9`] = `
exports[`AMP Home Page Header Navigation link should match text and url 8`] = `
{
"text": "वीडियो",
"url": "/hindi/topics/cw9kv0kpxydt",
}
`;

exports[`AMP Home Page Header Navigation link should match text and url 10`] = `
exports[`AMP Home Page Header Navigation link should match text and url 9`] = `
{
"text": "पॉडकास्ट",
"url": "/hindi/institutional-61824775",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,62 +74,55 @@ exports[`Canonical Home Page Header Navigation link should match text and url 1`
`;

exports[`Canonical Home Page Header Navigation link should match text and url 2`] = `
{
"text": "लोकसभा चुनाव 2024",
"url": "/hindi/topics/cm5m26q8qxpt",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 3`] = `
{
"text": "भारत",
"url": "/hindi/topics/ckdxnkz7607t",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 4`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 3`] = `
{
"text": "विदेश",
"url": "/hindi/topics/c9wpm0en87xt",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 5`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 4`] = `
{
"text": "मनोरंजन",
"url": "/hindi/topics/c06gq3n0pp7t",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 6`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 5`] = `
{
"text": "खेल",
"url": "/hindi/topics/cwr9j8g1kj9t",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 7`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 6`] = `
{
"text": "विज्ञान-टेक्नॉलॉजी",
"url": "/hindi/topics/c2lej0594knt",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 8`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 7`] = `
{
"text": "सोशल",
"url": "/hindi/topics/c2e4q0z9qznt",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 9`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 8`] = `
{
"text": "वीडियो",
"url": "/hindi/topics/cw9kv0kpxydt",
}
`;

exports[`Canonical Home Page Header Navigation link should match text and url 10`] = `
exports[`Canonical Home Page Header Navigation link should match text and url 9`] = `
{
"text": "पॉडकास्ट",
"url": "/hindi/institutional-61824775",
Expand Down

0 comments on commit bb31d44

Please sign in to comment.