Skip to content

Commit 32fac7f

Browse files
authored
Merge branch 'main' into jm/feat-tiny-banner-close-button
2 parents b879bee + be7a2e9 commit 32fac7f

File tree

9 files changed

+42
-32
lines changed

9 files changed

+42
-32
lines changed

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@guardian/bridget": "8.7.0",
3333
"@guardian/browserslist-config": "6.1.0",
3434
"@guardian/cdk": "62.0.1",
35-
"@guardian/commercial-core": "28.0.0",
35+
"@guardian/commercial-core": "29.0.0",
3636
"@guardian/core-web-vitals": "7.0.0",
3737
"@guardian/eslint-config-typescript": "11.0.0",
3838
"@guardian/identity-auth": "6.0.1",

dotcom-rendering/playwright/tests/commercial.e2e.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ test.describe('Commercial E2E tests', () => {
1313
await cmpAcceptAll(page);
1414

1515
const fixedSlots = [
16-
'carrot', // Not used often, likely to be unfilled
1716
'right',
1817
'merchandising-high',
1918
'mostpop',
2019
'merchandising',
2120
];
2221

23-
const totalSlotsExpected = 16; // All slots, even if unfilled ie. `display: none`
22+
const totalSlotsExpected = 15; // All slots, even if unfilled ie. `display: none`
2423
const inlineSlots = totalSlotsExpected - fixedSlots.length;
2524

2625
// We are excluding survey slot as they can be switched off

dotcom-rendering/src/components/AdSlot.web.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type SlotNamesWithPageSkin = SlotName | 'pageskin';
3131

3232
type ServerRenderedSlot = Exclude<
3333
SlotNamesWithPageSkin,
34-
| 'carrot'
3534
| 'comments-expanded'
3635
| 'crossword-banner'
3736
| 'exclusion'

dotcom-rendering/src/components/MainMediaGallery.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { LightboxLink } from './LightboxLink';
1212
import { Picture } from './Picture';
1313

1414
type Props = {
15-
mainMedia: ImageBlockElement;
15+
mainMedia?: ImageBlockElement;
1616
format: ArticleFormat;
1717
renderingTarget: RenderingTarget;
1818
};
@@ -32,6 +32,10 @@ export const MainMediaGallery = ({
3232
format,
3333
renderingTarget,
3434
}: Props) => {
35+
// This is to support some galleries created in 2007 where mainMedia is missing
36+
if (isUndefined(mainMedia)) {
37+
return <div css={styles}></div>;
38+
}
3539
const asset = getImage(mainMedia.media.allImages);
3640

3741
if (asset === undefined) {

dotcom-rendering/src/layouts/GalleryLayout.stories.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,26 @@ export const Web = {
105105
],
106106
},
107107
} satisfies Story;
108+
109+
export const WebWithoutMainMedia = {
110+
args: {
111+
renderingTarget: 'Web',
112+
NAV: {
113+
...extractNAV(webArticle.frontendData.nav),
114+
selectedPillar: getCurrentPillar(webArticle.frontendData),
115+
},
116+
gallery: {
117+
...addBrandingAndAffiliateDisclaimer(webArticle),
118+
mainMedia: undefined,
119+
},
120+
},
121+
parameters: {
122+
formats: [
123+
{
124+
design: webArticle.design,
125+
display: webArticle.display,
126+
theme: webArticle.theme,
127+
},
128+
],
129+
},
130+
} satisfies Story;

dotcom-rendering/src/lib/adStyles.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from '@emotion/react';
22
import { adSizes, constants } from '@guardian/commercial-core';
3-
import { from, space, textSans12, until } from '@guardian/source/foundations';
3+
import { from, textSans12, until } from '@guardian/source/foundations';
44
import { palette } from '../palette';
55

66
const labelHeight = constants.AD_LABEL_HEIGHT;
@@ -217,23 +217,6 @@ const spacefinderAdSlotStyles = css`
217217
}
218218
}
219219
220-
.ad-slot--carrot {
221-
float: left;
222-
clear: both;
223-
width: 140px;
224-
margin-right: 20px;
225-
margin-bottom: ${space[1]}px;
226-
${from.leftCol} {
227-
position: relative;
228-
margin-left: -160px;
229-
width: 140px;
230-
}
231-
${from.wide} {
232-
margin-left: -240px;
233-
width: 220px;
234-
}
235-
}
236-
237220
/* Scroll for more label on interscrollers */
238221
.ad-slot__scroll {
239222
position: fixed;

dotcom-rendering/src/server/render.front.web.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export const renderFront = ({
135135
abTests: front.config.abTests,
136136
serverSideABTests: front.config.serverSideABTests,
137137
brazeApiKey: front.config.brazeApiKey,
138+
contentType: front.config.contentType,
138139
googleRecaptchaSiteKey: front.config.googleRecaptchaSiteKey,
139140
// Until we understand exactly what config we need to make available client-side,
140141
// add everything we haven't explicitly typed as unknown config

dotcom-rendering/src/types/article.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
type TableOfContentsItem,
1919
} from '../model/enhanceTableOfContents';
2020
import { enhancePinnedPost } from '../model/pinnedPost';
21+
import { logger } from '../server/lib/logging';
2122
import { parse as parseStoryPackage, type StoryPackage } from '../storyPackage';
2223
import type {
2324
AdPlaceholderBlockElement,
@@ -48,7 +49,7 @@ export type ArticleFields = {
4849
export type Gallery = ArticleFields & {
4950
design: ArticleDesign.Gallery;
5051
bodyElements: (ImageBlockElement | AdPlaceholderBlockElement)[];
51-
mainMedia: ImageBlockElement;
52+
mainMedia?: ImageBlockElement;
5253
};
5354

5455
export type OtherArticles = ArticleFields & {
@@ -60,12 +61,12 @@ export type Article = Gallery | OtherArticles;
6061
export const getGalleryMainMedia = (
6162
mainMediaElements: FEElement[],
6263
trailImage?: ImageBlockElement,
63-
): ImageBlockElement => {
64+
): ImageBlockElement | undefined => {
6465
const mainMedia = mainMediaElements[0];
6566

6667
if (isUndefined(mainMedia)) {
6768
if (isUndefined(trailImage)) {
68-
throw new Error('No main media or trail picture found');
69+
logger.warn('No main media or trail picture found');
6970
}
7071
return trailImage;
7172
}

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)