Skip to content

Commit 122c990

Browse files
authored
Merge pull request #14305 from guardian/doml/no-boosts
Create "No Boosts" AB test
2 parents 3fbb586 + 7d0e830 commit 122c990

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

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/layouts/FrontLayout.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ const decideLeftContent = (front: Front, collection: DCRCollectionType) => {
105105

106106
export const FrontLayout = ({ front, NAV }: Props) => {
107107
const {
108-
config: { isPaidContent, hasPageSkin: hasPageSkinConfig, pageId },
108+
config: {
109+
isPaidContent,
110+
hasPageSkin: hasPageSkinConfig,
111+
pageId,
112+
abTests,
113+
},
109114
editionId,
110115
} = front;
111116

@@ -136,6 +141,8 @@ export const FrontLayout = ({ front, NAV }: Props) => {
136141

137142
const { absoluteServerTimes = false } = front.config.switches;
138143

144+
const isInNoBoostsVariant = abTests.noBoostsVariant === 'variant';
145+
139146
const fallbackAspectRatio = (collectionType: DCRContainerType) => {
140147
switch (collectionType) {
141148
case 'scrollable/feature':
@@ -199,7 +206,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
199206
'--article-section-background',
200207
)}
201208
>
202-
<HeaderAdSlot abTests={front.config.abTests} />
209+
<HeaderAdSlot abTests={abTests} />
203210
</Section>
204211
</Stuck>
205212
)}
@@ -743,6 +750,9 @@ export const FrontLayout = ({ front, NAV }: Props) => {
743750
sectionId={ophanName}
744751
collectionId={index + 1}
745752
containerLevel={collection.containerLevel}
753+
isInNoBoostsAbTestVariant={
754+
pageId === 'uk' && isInNoBoostsVariant
755+
}
746756
/>
747757
</FrontSection>
748758

0 commit comments

Comments
 (0)