Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions dotcom-rendering/src/components/DecideContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Props = {
frontId?: string;
collectionId: number;
containerLevel?: DCRContainerLevel;
isInNoBoostsAbTestVariant?: boolean;
};

export const DecideContainer = ({
Expand All @@ -63,6 +64,7 @@ export const DecideContainer = ({
frontId,
collectionId,
containerLevel,
isInNoBoostsAbTestVariant,
}: Props) => {
switch (containerType) {
case 'dynamic/fast':
Expand Down Expand Up @@ -268,6 +270,7 @@ export const DecideContainer = ({
aspectRatio={aspectRatio}
containerLevel={containerLevel}
collectionId={collectionId}
isInNoBoostsAbTestVariant={isInNoBoostsAbTestVariant}
/>
);
case 'scrollable/small':
Expand Down
49 changes: 47 additions & 2 deletions dotcom-rendering/src/components/FlexibleGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { ResponsiveFontSize } from './CardHeadline';
import type { Loading } from './CardPicture';
import { FeatureCard } from './FeatureCard';
import { FrontCard } from './FrontCard';
import { Hide } from './Hide';
import type { Alignment } from './SupportingContent';

type Props = {
Expand All @@ -32,6 +33,7 @@ type Props = {
aspectRatio: AspectRatio;
containerLevel?: DCRContainerLevel;
collectionId: number;
isInNoBoostsAbTestVariant?: boolean;
};

type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard';
Expand Down Expand Up @@ -580,17 +582,20 @@ export const FlexibleGeneral = ({
aspectRatio,
containerLevel = 'Primary',
collectionId,
isInNoBoostsAbTestVariant,
}: Props) => {
const splash = [...groupedTrails.splash].slice(0, 1).map((snap) => ({
...snap,
uniqueId: `collection-${collectionId}-splash-0`,
}));

const cards = [...groupedTrails.standard]
.slice(0, 19)
.map((standard, i) => ({
...standard,
uniqueId: `collection-${collectionId}-standard-${i}`,
}));

const groupedCards = decideCardPositions(cards);

return (
Expand All @@ -608,11 +613,51 @@ export const FlexibleGeneral = ({
collectionId={collectionId}
/>
)}

{groupedCards.map((row, i) => {
switch (row.layout) {
case 'oneCardFullWidth':
return (
return isInNoBoostsAbTestVariant ? (
<>
<Hide when="above" breakpoint="tablet">
<HalfWidthCardLayout
key={row.cards[0]?.uniqueId}
cards={row.cards}
containerPalette={containerPalette}
showAge={showAge}
absoluteServerTimes={
absoluteServerTimes
}
imageLoading={imageLoading}
isFirstRow={!splash.length && i === 0}
isFirstStandardRow={i === 0}
aspectRatio={aspectRatio}
isLastRow={
i === groupedCards.length - 1
}
containerLevel={containerLevel}
/>
</Hide>
<Hide when="below" breakpoint="tablet">
<FullWidthCardLayout
key={row.cards[0]?.uniqueId}
cards={row.cards}
containerPalette={containerPalette}
showAge={showAge}
absoluteServerTimes={
absoluteServerTimes
}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isFirstRow={!splash.length && i === 0}
isLastRow={
i === groupedCards.length - 1
}
containerLevel={containerLevel}
collectionId={collectionId}
/>
</Hide>
</>
) : (
<FullWidthCardLayout
key={row.cards[0]?.uniqueId}
cards={row.cards}
Expand Down
14 changes: 12 additions & 2 deletions dotcom-rendering/src/layouts/FrontLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ const decideLeftContent = (front: Front, collection: DCRCollectionType) => {

export const FrontLayout = ({ front, NAV }: Props) => {
const {
config: { isPaidContent, hasPageSkin: hasPageSkinConfig, pageId },
config: {
isPaidContent,
hasPageSkin: hasPageSkinConfig,
pageId,
abTests,
},
editionId,
} = front;

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

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

const isInNoBoostsVariant = abTests.noBoostsVariant === 'variant';

const fallbackAspectRatio = (collectionType: DCRContainerType) => {
switch (collectionType) {
case 'scrollable/feature':
Expand Down Expand Up @@ -199,7 +206,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
'--article-section-background',
)}
>
<HeaderAdSlot abTests={front.config.abTests} />
<HeaderAdSlot abTests={abTests} />
</Section>
</Stuck>
)}
Expand Down Expand Up @@ -743,6 +750,9 @@ export const FrontLayout = ({ front, NAV }: Props) => {
sectionId={ophanName}
collectionId={index + 1}
containerLevel={collection.containerLevel}
isInNoBoostsAbTestVariant={
pageId === 'uk' && isInNoBoostsVariant
}
/>
</FrontSection>

Expand Down