Skip to content

Create "OpinionNoAvatar" AB test #14369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 4 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;
isInOpinionNoAvatarVariant?: boolean;
};

export const DecideContainer = ({
Expand All @@ -63,6 +64,7 @@ export const DecideContainer = ({
frontId,
collectionId,
containerLevel,
isInOpinionNoAvatarVariant,
}: Props) => {
switch (containerType) {
case 'dynamic/fast':
Expand Down Expand Up @@ -268,6 +270,7 @@ export const DecideContainer = ({
aspectRatio={aspectRatio}
containerLevel={containerLevel}
collectionId={collectionId}
isInOpinionNoAvatarVariant={isInOpinionNoAvatarVariant}
/>
);
case 'scrollable/small':
Expand Down Expand Up @@ -297,6 +300,7 @@ export const DecideContainer = ({
absoluteServerTimes={absoluteServerTimes}
aspectRatio={aspectRatio}
sectionId={sectionId}
isInOpinionNoAvatarVariant={isInOpinionNoAvatarVariant}
/>
</Island>
);
Expand Down
5 changes: 5 additions & 0 deletions dotcom-rendering/src/components/FlexibleGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Props = {
aspectRatio: AspectRatio;
containerLevel?: DCRContainerLevel;
collectionId: number;
isInOpinionNoAvatarVariant?: boolean;
};

type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard';
Expand Down Expand Up @@ -580,6 +581,7 @@ export const FlexibleGeneral = ({
aspectRatio,
containerLevel = 'Primary',
collectionId,
isInOpinionNoAvatarVariant,
}: Props) => {
const splash = [...groupedTrails.splash].slice(0, 1).map((snap) => ({
...snap,
Expand All @@ -591,6 +593,9 @@ export const FlexibleGeneral = ({
.map((standard, i) => ({
...standard,
uniqueId: `collection-${collectionId}-standard-${i}`,
avatarUrl: isInOpinionNoAvatarVariant
? undefined
: standard.avatarUrl,
}));

const groupedCards = decideCardPositions(cards);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Props = {
containerType: DCRContainerType;
aspectRatio: AspectRatio;
sectionId: string;
isInOpinionNoAvatarVariant?: boolean;
};

/**
Expand All @@ -35,6 +36,7 @@ export const ScrollableMedium = ({
showAge,
aspectRatio,
sectionId,
isInOpinionNoAvatarVariant,
}: Props) => {
return (
<ScrollableCarousel
Expand All @@ -51,7 +53,12 @@ export const ScrollableMedium = ({
return (
<ScrollableCarousel.Item key={trail.url}>
<FrontCard
trail={trail}
trail={{
...trail,
avatarUrl: isInOpinionNoAvatarVariant
? undefined
: trail.avatarUrl,
}}
imageLoading={imageLoading}
absoluteServerTimes={!!absoluteServerTimes}
containerPalette={containerPalette}
Expand Down
12 changes: 12 additions & 0 deletions dotcom-rendering/src/layouts/FrontLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ export const FrontLayout = ({ front, NAV }: Props) => {

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

/**
* We are running an AB test which replaces the avatar for the card image
* in the Opinion and More opinion collections on network fronts.
*/
const isInOpinionNoAvatarVariant = (collectionName: string) =>
abTests.opinionNoAvatarVariant === 'variant' &&
front.isNetworkFront &&
(collectionName === 'Opinion' || collectionName === 'More opinion');

const fallbackAspectRatio = (collectionType: DCRContainerType) => {
switch (collectionType) {
case 'scrollable/feature':
Expand Down Expand Up @@ -634,6 +643,9 @@ export const FrontLayout = ({ front, NAV }: Props) => {
sectionId={ophanName}
collectionId={index + 1}
containerLevel={collection.containerLevel}
isInOpinionNoAvatarVariant={isInOpinionNoAvatarVariant(
collection.displayName,
)}
/>
</FrontSection>

Expand Down