Skip to content

Commit 1f8d607

Browse files
authored
Merge branch 'main' into dina/add-share-button-colour-for-hosted
2 parents e046a69 + 03d09bd commit 1f8d607

File tree

17 files changed

+257
-369
lines changed

17 files changed

+257
-369
lines changed

ab-testing/config/abTests.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,6 @@ const ABTests: ABTest[] = [
8181
groups: ["true"],
8282
shouldForceMetricsCollection: false,
8383
},
84-
{
85-
name: "webex-preferred-source",
86-
description:
87-
"Testing the Preferred Source on Google button in the meta section of articles",
88-
owners: ["dotcom.platform@theguardian.com"],
89-
expirationDate: "2026-02-25",
90-
type: "server",
91-
status: "ON",
92-
audienceSize: 20 / 100,
93-
audienceSpace: "A",
94-
groups: ["control", "prefer", "add"],
95-
},
9684
{
9785
name: "commercial-mobile-inline1-halfpage",
9886
description:

dotcom-rendering/cdk/bin/cdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ new RenderingCDKStack(cdkApp, 'ArticleRendering-CODE', {
2121
stage: 'CODE',
2222
domainName: 'article-rendering.code.dev-guardianapis.com',
2323
scaling: { minimumInstances: 1, maximumInstances: 3 },
24-
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.SMALL),
24+
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MEDIUM),
2525
});
2626
new RenderingCDKStack(cdkApp, 'ArticleRendering-PROD', {
2727
guApp: 'article-rendering',

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { css } from '@emotion/react';
22
import { between, from, space, until } from '@guardian/source/foundations';
33
import { StraightLines } from '@guardian/source-development-kitchen/react-components';
44
import type { CSSProperties } from 'react';
5-
import { preferredSourceExperiment } from '../experiments/preferredSource';
65
import type { FEArticle } from '../frontend/feArticle';
76
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
87
import {
@@ -13,8 +12,8 @@ import {
1312
} from '../lib/articleFormat';
1413
import { getAudioData } from '../lib/audio-data';
1514
import { getSoleContributor } from '../lib/byline';
16-
import { useBetaAB } from '../lib/useAB';
1715
import { palette as themePalette } from '../palette';
16+
import { hasPreferredSourceButton } from '../preferredSource';
1817
import type { Branding as BrandingType } from '../types/branding';
1918
import type { FEElement } from '../types/content';
2019
import type { Podcast, TagType } from '../types/tag';
@@ -343,12 +342,10 @@ export const ArticleMeta = ({
343342
mainMediaElements,
344343
crossword,
345344
}: Props) => {
346-
const abTests = useBetaAB();
347345
const { renderingTarget } = useConfig();
348-
const preferredSource = preferredSourceExperiment(
346+
const showPreferredSource = hasPreferredSourceButton(
349347
renderingTarget,
350348
format,
351-
abTests,
352349
);
353350
const soleContributor = getSoleContributor(tags, byline);
354351
const authorName = soleContributor?.title ?? 'Author Image';
@@ -446,7 +443,7 @@ export const ArticleMeta = ({
446443
<div
447444
data-print-layout="hide"
448445
css={metaFlex}
449-
style={preferredSourceMetaFlex(preferredSource.hasButton)}
446+
style={preferredSourceMetaFlex(showPreferredSource)}
450447
>
451448
{renderingTarget === 'Web' && (
452449
<div
@@ -464,7 +461,7 @@ export const ArticleMeta = ({
464461
),
465462
]}
466463
style={preferredSourceMetaExtras(
467-
preferredSource.hasButton,
464+
showPreferredSource,
468465
)}
469466
>
470467
<Island
@@ -518,9 +515,7 @@ export const ArticleMeta = ({
518515
</div>
519516
</div>
520517
</div>
521-
{preferredSource.hasButton ? (
522-
<PreferredSourceButton kind={preferredSource.kind} />
523-
) : null}
518+
{showPreferredSource ? <PreferredSourceButton /> : null}
524519
</div>
525520
</div>
526521
);

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

Lines changed: 22 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css } from '@emotion/react';
22
import { isUndefined } from '@guardian/libs';
33
import { between, from, space, until } from '@guardian/source/foundations';
4-
import { Hide, Link, SvgCamera } from '@guardian/source/react-components';
4+
import { Hide, Link } from '@guardian/source/react-components';
55
import {
66
ArticleDesign,
77
type ArticleFormat,
@@ -337,14 +337,6 @@ const decideSublinkPosition = (
337337
return alignment === 'vertical' ? 'inner' : 'outer';
338338
};
339339

340-
const liveBulletStyles = css`
341-
width: 9px;
342-
height: 9px;
343-
border-radius: 50%;
344-
background-color: ${palette('--pill-bullet')};
345-
margin-right: ${space[1]}px;
346-
`;
347-
348340
export const Card = ({
349341
linkTo,
350342
format,
@@ -489,85 +481,6 @@ export const Card = ({
489481
</Link>
490482
);
491483

492-
const MediaOrNewsletterPill = () => (
493-
<div
494-
css={css`
495-
margin-top: auto;
496-
display: flex;
497-
${isStorylines &&
498-
`
499-
flex-direction: column;
500-
gap: ${space[1]}px;
501-
align-items: flex-start;
502-
`}
503-
`}
504-
>
505-
{/* Usually, we either display the pill or the footer,
506-
but if the card appears in the storylines section on tag pages
507-
then we do want to display the date on these cards as well as the media pill.
508-
*/}
509-
{isStorylines && (
510-
<CardFooter
511-
format={format}
512-
age={decideAge()}
513-
commentCount={<CommentCount />}
514-
cardBranding={
515-
isOnwardContent ? <LabsBranding /> : undefined
516-
}
517-
showLivePlayable={showLivePlayable}
518-
/>
519-
)}
520-
521-
{mainMedia?.type === 'YoutubeVideo' && isVideoArticle && (
522-
<>
523-
{mainMedia.isLive ? (
524-
<Pill
525-
content="Live"
526-
icon={<div css={liveBulletStyles} />}
527-
/>
528-
) : (
529-
<Pill
530-
content={secondsToDuration(mainMedia.duration)}
531-
icon={<SvgMediaControlsPlay width={18} />}
532-
prefix="Video"
533-
/>
534-
)}
535-
</>
536-
)}
537-
{mainMedia?.type === 'Audio' && (
538-
<Pill
539-
content={mainMedia.duration}
540-
icon={<SvgMediaControlsPlay width={18} />}
541-
prefix="Podcast"
542-
/>
543-
)}
544-
{mainMedia?.type === 'Gallery' && (
545-
<Pill
546-
content={mainMedia.count}
547-
icon={<SvgCamera />}
548-
prefix="Gallery"
549-
/>
550-
)}
551-
{mainMedia?.type === 'SelfHostedVideo' &&
552-
(format.design === ArticleDesign.Video ? (
553-
<Pill
554-
content=""
555-
icon={<SvgMediaControlsPlay width={18} />}
556-
prefix="Video"
557-
/>
558-
) : format.design === ArticleDesign.Audio ? (
559-
<Pill
560-
content=""
561-
icon={<SvgMediaControlsPlay width={18} />}
562-
prefix="Podcast"
563-
/>
564-
) : format.design === ArticleDesign.Gallery ? (
565-
<Pill content="" icon={<SvgCamera />} prefix="Gallery" />
566-
) : null)}
567-
{isNewsletter && <Pill content="Newsletter" />}
568-
</div>
569-
);
570-
571484
if (snapData?.embedHtml) {
572485
return (
573486
<SnapCssSandbox snapData={snapData}>
@@ -589,13 +502,11 @@ export const Card = ({
589502
isOnwardContent && onwardsSource === 'more-galleries';
590503

591504
/**
592-
- * Media cards have contrasting background colours. We add additional
593-
* padding to these cards to keep the text readable.
594-
- */
505+
* Media cards have contrasting background colours. We add additional
506+
* padding to these cards to keep the text readable.
507+
*/
595508
const isMediaCardOrNewsletter = isMediaCard(format) || isNewsletter;
596509

597-
const showPill = isMediaCardOrNewsletter && !isGallerySecondaryOnward;
598-
599510
const media = getMedia({
600511
imageUrl: image?.src,
601512
imageAltText: image?.altText,
@@ -1300,32 +1211,23 @@ export const Card = ({
13001211
/>
13011212
)}
13021213

1303-
{!isOpinionCardWithAvatar && (
1304-
<>
1305-
{showPill ? (
1306-
<>
1307-
{!!branding &&
1308-
format.theme ===
1309-
ArticleSpecial.Labs &&
1310-
isOnwardContent && (
1311-
<LabsBranding />
1312-
)}
1313-
<MediaOrNewsletterPill />
1314-
</>
1315-
) : (
1316-
<CardFooter
1317-
format={format}
1318-
age={decideAge()}
1319-
commentCount={<CommentCount />}
1320-
cardBranding={
1321-
isOnwardContent ? (
1322-
<LabsBranding />
1323-
) : undefined
1324-
}
1325-
showLivePlayable={showLivePlayable}
1326-
/>
1327-
)}
1328-
</>
1214+
{!isOpinionCardWithAvatar && !showLivePlayable && (
1215+
<CardFooter
1216+
format={format}
1217+
age={decideAge()}
1218+
commentCount={<CommentCount />}
1219+
cardBranding={
1220+
isOnwardContent ? (
1221+
<LabsBranding />
1222+
) : undefined
1223+
}
1224+
mainMedia={
1225+
!isGallerySecondaryOnward
1226+
? mainMedia
1227+
: undefined
1228+
}
1229+
isNewsletter={isNewsletter}
1230+
/>
13291231
)}
13301232
{showLivePlayable &&
13311233
liveUpdatesPosition === 'inner' && (
@@ -1410,12 +1312,11 @@ export const Card = ({
14101312

14111313
{decideOuterSublinks()}
14121314

1413-
{isOpinionCardWithAvatar && (
1315+
{isOpinionCardWithAvatar && !showLivePlayable && (
14141316
<CardFooter
14151317
format={format}
14161318
age={decideAge()}
14171319
commentCount={<CommentCount />}
1418-
showLivePlayable={showLivePlayable}
14191320
shouldReserveSpace={{
14201321
mobile: avatarPosition.mobile === 'bottom',
14211322
desktop: avatarPosition.desktop === 'bottom',

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const WithAge = {
2323
design: ArticleDesign.Comment,
2424
theme: Pillar.Opinion,
2525
},
26-
showLivePlayable: false,
2726
age: <p>19h ago</p>,
2827
},
2928
} satisfies Story;
@@ -56,7 +55,15 @@ export const WithVideo = {
5655
...WithAge.args,
5756
mainMedia: {
5857
type: 'YoutubeVideo',
58+
id: 'abcdef',
59+
videoId: 'abcd',
60+
title: 'some title',
5961
duration: 972,
62+
width: 480,
63+
height: 288,
64+
origin: 'The Guardian',
65+
expired: false,
66+
image: 'https://i.guim.co.uk/img/media/e060e9b7c92433b3dfeccc98b9206778cda8b8e8/0_180_6680_4009/master/6680.jpg?width=600&quality=45&dpr=2&s=none',
6067
},
6168
},
6269
} satisfies Story;

0 commit comments

Comments
 (0)