Skip to content

Commit 1a62843

Browse files
committed
Merge branch 'main' into add-gallery-affiliate-link-disclaimer
2 parents 956fa82 + 9db6ade commit 1a62843

File tree

12 files changed

+202
-120
lines changed

12 files changed

+202
-120
lines changed

dotcom-rendering/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ $ cd dotcom-rendering
3030

3131
### Install Node.js
3232

33-
To install and manage Node versions, we highly recommend installing a Node version manager such as [fnm](https://github.com/Schniz/fnm) (preferred), [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://asdf-vm.com/guide/getting-started.html).
33+
We highly recommend installing a Node version manager such as [fnm](https://github.com/Schniz/fnm) (preferred), [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://asdf-vm.com/guide/getting-started.html).
3434

35-
Ensure you're at the root directory of this project, then follow the instructions for your version manager to install Node.
35+
Install the Node version manager of your choice.
36+
37+
Ensure you're at the root directory of the project:
38+
39+
```
40+
cd ~/code/dotcom-rendering
41+
```
42+
43+
Run the command for your version manager to use the Node version as specified in [.nvmrc](../.nvmrc).
3644

3745
For `fnm` this will be:
3846

@@ -94,22 +102,20 @@ $ make install
94102

95103
If you get an Node version error then check the setup for your version manager.
96104

97-
### Running locally
105+
### Run
98106

99107
```sh
100108
$ make dev
101109
```
102110

103-
The development server will start on [http://localhost:3030](http://localhost:3030).
111+
The development server will start on [http://localhost:3030](http://localhost:3030)
104112

105-
A list of content types with example URLs are available on the [root path](http://localhost:3030).
113+
The development server home page lists examples of the various page and content types.
106114

107115
You can render a specific article by appending the production URL to the `Article` endpoint, for example:
108-
109116
http://localhost:3030/Article/https://www.theguardian.com/sport/2019/jul/28/tour-de-france-key-moments-egan-bernal-yellow-jersey
110117

111-
You can view the JSON representation of an article as sent to DCR by [Frontend](https://github.com/guardian/frontend), by appending `.json?dcr=true` to the production URL, for example:
112-
118+
You can view the JSON data model of a page as sent by [Frontend](https://github.com/guardian/frontend) to DCR by appending `.json?dcr=true` to the production URL, for example:
113119
https://www.theguardian.com/sport/2019/jul/28/tour-de-france-key-moments-egan-bernal-yellow-jersey.json?dcr=true
114120

115121
### Detailed setup

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const topAboveNavContainerStyles = css`
115115
display: block;
116116
`;
117117

118-
const topAboveNavContainerVaraintStyles = css`
118+
const topAboveNavContainerVariantStyles = css`
119119
padding-bottom: ${space[5]}px;
120120
position: relative;
121121
margin: 0 auto;
@@ -128,6 +128,20 @@ const topAboveNavContainerVaraintStyles = css`
128128
&[top-above-nav-ad-rendered='true'] {
129129
min-height: auto;
130130
}
131+
132+
/* Ad placeholder grey box rendered while loading the ad */
133+
&:not([top-above-nav-ad-rendered='true']) {
134+
::before {
135+
content: '';
136+
position: absolute;
137+
height: 250px;
138+
width: 970px;
139+
top: ${labelHeight}px;
140+
left: 50%;
141+
transform: translateX(-50%);
142+
background-color: ${palette.neutral[93]};
143+
}
144+
}
131145
`;
132146

133147
/**
@@ -600,7 +614,7 @@ export const AdSlot = ({
600614
<AdSlotWrapper
601615
css={
602616
isIn250ReservationVariant
603-
? topAboveNavContainerVaraintStyles
617+
? topAboveNavContainerVariantStyles
604618
: topAboveNavContainerStyles
605619
}
606620
>

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ export const Card = ({
708708
(imagePositionOnMobile === 'bottom' ||
709709
isMediaCard(format)))
710710
}
711-
fillBackgroundOnDesktop={isBetaContainer && isMediaCard(format)}
711+
fillBackgroundOnDesktop={
712+
isBetaContainer && isMediaCardOrNewsletter
713+
}
712714
/>
713715
);
714716

dotcom-rendering/src/components/DecideContainer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Props = {
4848
frontId?: string;
4949
collectionId: number;
5050
containerLevel?: DCRContainerLevel;
51+
isInNoBoostsAbTestVariant?: boolean;
5152
};
5253

5354
export const DecideContainer = ({
@@ -63,6 +64,7 @@ export const DecideContainer = ({
6364
frontId,
6465
collectionId,
6566
containerLevel,
67+
isInNoBoostsAbTestVariant,
6668
}: Props) => {
6769
switch (containerType) {
6870
case 'dynamic/fast':
@@ -268,6 +270,7 @@ export const DecideContainer = ({
268270
aspectRatio={aspectRatio}
269271
containerLevel={containerLevel}
270272
collectionId={collectionId}
273+
isInNoBoostsAbTestVariant={isInNoBoostsAbTestVariant}
271274
/>
272275
);
273276
case 'scrollable/small':

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type { ResponsiveFontSize } from './CardHeadline';
2121
import type { Loading } from './CardPicture';
2222
import { FeatureCard } from './FeatureCard';
2323
import { FrontCard } from './FrontCard';
24+
import { Hide } from './Hide';
2425
import type { Alignment } from './SupportingContent';
2526

2627
type Props = {
@@ -32,6 +33,7 @@ type Props = {
3233
aspectRatio: AspectRatio;
3334
containerLevel?: DCRContainerLevel;
3435
collectionId: number;
36+
isInNoBoostsAbTestVariant?: boolean;
3537
};
3638

3739
type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard';
@@ -580,17 +582,20 @@ export const FlexibleGeneral = ({
580582
aspectRatio,
581583
containerLevel = 'Primary',
582584
collectionId,
585+
isInNoBoostsAbTestVariant,
583586
}: Props) => {
584587
const splash = [...groupedTrails.splash].slice(0, 1).map((snap) => ({
585588
...snap,
586589
uniqueId: `collection-${collectionId}-splash-0`,
587590
}));
591+
588592
const cards = [...groupedTrails.standard]
589593
.slice(0, 19)
590594
.map((standard, i) => ({
591595
...standard,
592596
uniqueId: `collection-${collectionId}-standard-${i}`,
593597
}));
598+
594599
const groupedCards = decideCardPositions(cards);
595600

596601
return (
@@ -608,11 +613,51 @@ export const FlexibleGeneral = ({
608613
collectionId={collectionId}
609614
/>
610615
)}
611-
612616
{groupedCards.map((row, i) => {
613617
switch (row.layout) {
614618
case 'oneCardFullWidth':
615-
return (
619+
return isInNoBoostsAbTestVariant ? (
620+
<>
621+
<Hide when="above" breakpoint="tablet">
622+
<HalfWidthCardLayout
623+
key={row.cards[0]?.uniqueId}
624+
cards={row.cards}
625+
containerPalette={containerPalette}
626+
showAge={showAge}
627+
absoluteServerTimes={
628+
absoluteServerTimes
629+
}
630+
imageLoading={imageLoading}
631+
isFirstRow={!splash.length && i === 0}
632+
isFirstStandardRow={i === 0}
633+
aspectRatio={aspectRatio}
634+
isLastRow={
635+
i === groupedCards.length - 1
636+
}
637+
containerLevel={containerLevel}
638+
/>
639+
</Hide>
640+
<Hide when="below" breakpoint="tablet">
641+
<FullWidthCardLayout
642+
key={row.cards[0]?.uniqueId}
643+
cards={row.cards}
644+
containerPalette={containerPalette}
645+
showAge={showAge}
646+
absoluteServerTimes={
647+
absoluteServerTimes
648+
}
649+
imageLoading={imageLoading}
650+
aspectRatio={aspectRatio}
651+
isFirstRow={!splash.length && i === 0}
652+
isLastRow={
653+
i === groupedCards.length - 1
654+
}
655+
containerLevel={containerLevel}
656+
collectionId={collectionId}
657+
/>
658+
</Hide>
659+
</>
660+
) : (
616661
<FullWidthCardLayout
617662
key={row.cards[0]?.uniqueId}
618663
cards={row.cards}

dotcom-rendering/src/components/SignInGate/displayRules.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const isNPageOrHigherPageView = (n = 2): boolean => {
1414

1515
const { count = 0 } = dailyCount;
1616

17+
console.log(`counter inside isNPageOrHigherPageView: ${count}`);
18+
1719
return count >= n;
1820
};
1921

dotcom-rendering/src/components/SignInGate/gates/main-control.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,41 @@ const canShow = ({
1515
tags,
1616
isPaidContent,
1717
isPreview,
18-
}: CanShowGateProps): Promise<boolean> =>
19-
Promise.resolve(
18+
}: CanShowGateProps): Promise<boolean> => {
19+
// 31st July 2025
20+
// author: Pascal
21+
// Investigating broken behavior of this function
22+
23+
console.log('[60f7e8f7] investigation');
24+
console.log(`isSignedIn: ${isSignedIn}`);
25+
console.log(`!isSignedIn: ${!isSignedIn}`);
26+
console.log(`currentTest.variant: ${currentTest.variant}`);
27+
console.log(`currentTest.name: ${currentTest.name}`);
28+
console.log(
29+
`hasUserDismissedGate: ${hasUserDismissedGate(
30+
currentTest.variant,
31+
currentTest.name,
32+
)}`,
33+
);
34+
console.log(
35+
`!hasUserDismissedGate: ${!hasUserDismissedGate(
36+
currentTest.variant,
37+
currentTest.name,
38+
)}`,
39+
);
40+
console.log(`isNPageOrHigherPageView: ${isNPageOrHigherPageView(3)}`);
41+
console.log(`contentType: ${contentType}`);
42+
console.log(`isValidContentType: ${isValidContentType(contentType)}`);
43+
console.log(`sectionId: ${sectionId}`);
44+
console.log(`isValidSection: ${isValidSection(sectionId)}`);
45+
console.log(`tags: ${JSON.stringify(tags)}`);
46+
console.log(`isValidTag: ${isValidTag(tags)}`);
47+
console.log(`isPaidContent: ${isPaidContent}`);
48+
console.log(`!isPaidContent: ${!isPaidContent}`);
49+
console.log(`isPreview: ${isPreview}`);
50+
console.log(`!isPreview: ${!isPreview}`);
51+
52+
return Promise.resolve(
2053
!isSignedIn &&
2154
!hasUserDismissedGate(currentTest.variant, currentTest.name) &&
2255
isNPageOrHigherPageView(3) &&
@@ -28,6 +61,7 @@ const canShow = ({
2861
// hide the sign in gate on internal tools preview
2962
!isPreview,
3063
);
64+
};
3165

3266
export const signInGateComponent: SignInGateComponent = {
3367
canShow,

dotcom-rendering/src/components/SignInGateSelector.importable.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ const decideShowDefaultGate = (): ShowGateValues => {
372372
return undefined;
373373
};
374374

375+
const decideShouldEnforceLocalLogic = (): boolean => {
376+
// July 31st
377+
// SignIn gate behavior investigation
378+
379+
const params = new URLSearchParams(window.location.search);
380+
const value: string | null = params.get('localgatelogic');
381+
return value === 'true';
382+
};
383+
375384
const buildAuxiaGateDisplayData = async (
376385
contributionsServiceUrl: string,
377386
pageId: string,
@@ -388,9 +397,14 @@ const buildAuxiaGateDisplayData = async (
388397
const readerPersonalData = await decideAuxiaProxyReaderPersonalData();
389398
const tagIds = tags.map((tag) => tag.id);
390399

400+
let mvtId = readerPersonalData.mvtId;
401+
if (decideShouldEnforceLocalLogic()) {
402+
mvtId = 350001; // to be outside the Auxia share of the Audience
403+
}
404+
391405
let should_show_legacy_gate_tmp;
392406

393-
if (isAuxiaAudience) {
407+
if (!decideShouldEnforceLocalLogic() && isAuxiaAudience) {
394408
should_show_legacy_gate_tmp = false;
395409
// The actual value is irrelevant in this case, but we have the convention to set it to false here
396410
} else {
@@ -425,7 +439,7 @@ const buildAuxiaGateDisplayData = async (
425439
tagIds,
426440
gateDismissCount,
427441
readerPersonalData.countryCode,
428-
readerPersonalData.mvtId,
442+
mvtId,
429443
should_show_legacy_gate_tmp,
430444
readerPersonalData.hasConsented,
431445
shouldServeDismissible,

dotcom-rendering/src/components/marketing/banners/designableBanner/DesignableBanner.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
Image,
2424
} from '@guardian/support-dotcom-components/dist/shared/types';
2525
import type { ChoiceCard } from '@guardian/support-dotcom-components/dist/shared/types/props/choiceCards';
26-
import { useEffect, useState } from 'react';
26+
import { useEffect, useRef, useState } from 'react';
2727
import {
2828
removeMediaRulePrefix,
2929
useMatchMedia,
@@ -137,6 +137,14 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
137137
);
138138
}, []);
139139

140+
const bannerRef = useRef<HTMLDivElement>(null);
141+
142+
useEffect(() => {
143+
if (bannerRef.current) {
144+
bannerRef.current.focus();
145+
}
146+
}, []);
147+
140148
useEffect(() => {
141149
if (iosAppBannerPresent) {
142150
// send ophan event
@@ -275,6 +283,9 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
275283

276284
return (
277285
<div
286+
ref={bannerRef}
287+
role="alert"
288+
tabIndex={-1}
278289
css={styles.outerContainer(
279290
templateSettings.containerSettings.backgroundColour,
280291
iosAppBannerPresent,

dotcom-rendering/src/devServer/docs/article.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ const Format = () => (
142142
<dt>Theme</dt>
143143
<dd>
144144
Primarily influences the fonts and colours of an article. It can
145-
can be thought of as a superset of "pillar", i.e. all the
146-
pillars are considered themes, but there are some additional
147-
themes that are not pillars. The values are:{' '}
148-
{formatValues(Pillar)}, {formatValues(ArticleSpecial)}.
145+
be thought of as a superset of "pillar", i.e. all the pillars
146+
are considered themes, but there are some additional themes that
147+
are not pillars. The values are: {formatValues(Pillar)},{' '}
148+
{formatValues(ArticleSpecial)}.
149149
</dd>
150150
</dl>
151151
<p>

0 commit comments

Comments
 (0)