Skip to content

Commit 5a04f03

Browse files
Merge branch 'main' into mob/inline-product-card
2 parents 4c16d3c + 0c56b8a commit 5a04f03

File tree

106 files changed

+660
-777
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+660
-777
lines changed

ab-testing/frontend/src/routes/+page.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import AudienceBreakdown from '$lib/components/AudienceBreakdown.svelte';
55
</script>
66

7-
<h1 class="headline">A/B Tests</h1>
7+
<h1 class="headline">A/B Tests (Beta)</h1>
88
<section>
99
<p>
1010
This page provides an overview of currently running A/B tests on
@@ -31,8 +31,14 @@
3131
</p>
3232
</section>
3333
<section>
34-
<AudienceBreakdown tests={activeABtests} />
35-
<Table tests={allABTests} />
34+
{#if activeABtests.length > 0}
35+
<AudienceBreakdown tests={activeABtests} />
36+
{/if}
37+
{#if allABTests.length > 0}
38+
<Table tests={allABTests} />
39+
{:else}
40+
<p>There are <b>ZERO</b> A/B tests currently configured!</p>
41+
{/if}
3642
</section>
3743

3844
<style>

apps-rendering/src/client/article.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,28 @@ function followToggle(
8585
if (isFollowing) {
8686
void bridgetClient.unfollow(topic).then((unfollow) => {
8787
// unfollow will be true if the update was successful
88-
unfollow &&
88+
if (unfollow) {
8989
ReactDOM.render(
9090
h(followStatusComponent, {
9191
isFollowing: false,
9292
contributorName: topic.displayName,
9393
}),
9494
followStatus,
9595
);
96+
}
9697
});
9798
} else {
9899
void bridgetClient.follow(topic).then((follow) => {
99100
// follow will be true if the update was successful
100-
follow &&
101+
if (follow) {
101102
ReactDOM.render(
102103
h(followStatusComponent, {
103104
isFollowing: true,
104105
contributorName: topic.displayName,
105106
}),
106107
followStatus,
107108
);
109+
}
108110
});
109111
}
110112
});
@@ -167,16 +169,19 @@ function conditionallyRenderFollowTagComponent(
167169
isMyGuardianEnabled,
168170
tagIsFollowingState,
169171
]) => {
170-
isBridgetCompatible &&
172+
if (
173+
isBridgetCompatible &&
171174
isMyGuardianEnabled &&
172-
followTagStatus &&
175+
followTagStatus
176+
) {
173177
ReactDOM.render(
174178
h(FollowTagStatus, {
175179
isFollowing: tagIsFollowingState,
176180
contributorName: topic.displayName,
177181
}),
178182
followTagStatus,
179183
);
184+
}
180185

181186
followTag?.addEventListener('click', followTagClick);
182187
followTag?.setAttribute('aria-hidden', 'false');

apps-rendering/src/components/editions/galleryImage/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ const getCaptionDetails = (oDoc: Option<DocumentFragment>): CaptionDetails => {
9494
): CaptionDetails => {
9595
const detailsSection = details[section];
9696

97-
node.textContent &&
98-
detailsSection.kind === OptionKind.Some &&
97+
if (node.textContent && detailsSection.kind === OptionKind.Some) {
9998
detailsSection.value.push(node.textContent);
99+
}
100100

101101
return details;
102102
};

dotcom-rendering/fixtures/manual/trails.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,49 @@ export const videoTrails: [DCRFrontCard, DCRFrontCard] = [
605605
},
606606
];
607607

608+
export const newsletterTrails: [DCRFrontCard, DCRFrontCard] = [
609+
{
610+
format: { design: 0, display: 0, theme: 0 },
611+
dataLinkName: 'news | group-0 | card-@4',
612+
url: '/global/2022/sep/20/sign-up-for-the-guide-newsletter-our-free-pop-culture-email',
613+
headline: 'Sign up for a weekly dose of pop culture',
614+
trailText:
615+
'The best new music, film, TV, podcasts and more direct to your inbox, plus hidden gems and reader recommendations',
616+
webPublicationDate: '2022-09-20T10:57:04.000Z',
617+
kickerText: 'The Guide',
618+
isNewsletter: true,
619+
image: {
620+
src: 'https://media.guim.co.uk/ce2e59cfa2ab7db34cba24adbf20910976e55604/0_55_501_401/master/501.jpg',
621+
altText: 'The Guide Newsletter Design',
622+
},
623+
showQuotedHeadline: false,
624+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
625+
isExternalLink: false,
626+
showLivePlayable: false,
627+
isImmersive: false,
628+
},
629+
{
630+
format: { design: 0, display: 0, theme: 0 },
631+
dataLinkName: 'news | group-0 | card-@2',
632+
url: '/info/2024/oct/10/sign-up-for-the-filter-newsletter-our-free-weekly-buying-advice',
633+
headline: 'Sign up our free weekly buying advice newsletter',
634+
trailText:
635+
'Get smart, sustainable shopping advice from the Filter team straight to your inbox, every Sunday<br><br>The Guardian’s journalism is independent. We will earn a commission if you buy something through an affiliate link.',
636+
webPublicationDate: '2024-10-10T10:30:16.000Z',
637+
kickerText: 'The Filter',
638+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
639+
isNewsletter: true,
640+
image: {
641+
src: 'https://media.guim.co.uk/e5269c957a8e19da44d76b53f349b8d5a3b6a98f/0_0_5000_3000/master/5000.jpg',
642+
altText: 'The Filter',
643+
},
644+
showQuotedHeadline: false,
645+
isExternalLink: false,
646+
showLivePlayable: false,
647+
isImmersive: false,
648+
},
649+
];
650+
608651
export const loopVideoCard: DCRFrontCard = {
609652
...defaultCardProps,
610653
dataLinkName: 'news | group-0 | card-@2',

dotcom-rendering/src/components/ArticleBody.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Props = {
5454
lang?: string;
5555
isRightToLeftLang?: boolean;
5656
shouldHideAds: boolean;
57+
serverTime?: number;
5758
};
5859

5960
const globalOlStyles = () => css`
@@ -137,6 +138,7 @@ export const ArticleBody = ({
137138
isRightToLeftLang = false,
138139
editionId,
139140
shouldHideAds,
141+
serverTime,
140142
}: Props) => {
141143
const isInteractiveContent =
142144
format.design === ArticleDesign.Interactive ||
@@ -205,6 +207,7 @@ export const ArticleBody = ({
205207
keywordIds={keywordIds}
206208
editionId={editionId}
207209
shouldHideAds={shouldHideAds}
210+
serverTime={serverTime}
208211
/>
209212
</div>
210213
);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const basicCardProps: CardProps = {
4747
imageLoading: 'eager',
4848
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api/',
4949
showVideo: true,
50-
absoluteServerTimes: true,
5150
headlinePosition: 'inner',
5251
};
5352

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export type Position = 'inner' | 'outer' | 'none';
7979
export type Props = {
8080
linkTo: string;
8181
format: ArticleFormat;
82-
absoluteServerTimes: boolean;
82+
serverTime?: number;
8383
headlineText: string;
8484
headlineSizes?: ResponsiveFontSize;
8585
showQuotedHeadline?: boolean;
@@ -388,7 +388,7 @@ export const Card = ({
388388
liveUpdatesPosition = 'inner',
389389
onwardsSource,
390390
showVideo = true,
391-
absoluteServerTimes,
391+
serverTime,
392392
isTagPage = false,
393393
aspectRatio,
394394
index = 0,
@@ -450,7 +450,7 @@ export const Card = ({
450450
isWithinTwelveHours: withinTwelveHours,
451451
}}
452452
showClock={showClock}
453-
absoluteServerTimes={absoluteServerTimes}
453+
serverTime={serverTime}
454454
isTagPage={isTagPage}
455455
/>
456456
);
@@ -1261,9 +1261,7 @@ export const Card = ({
12611261
: supportingContentAlignment
12621262
}
12631263
containerPalette={containerPalette}
1264-
absoluteServerTimes={
1265-
absoluteServerTimes
1266-
}
1264+
serverTime={serverTime}
12671265
displayHeader={isFlexibleContainer}
12681266
directionOnMobile={
12691267
isFlexibleContainer
@@ -1318,7 +1316,7 @@ export const Card = ({
13181316
: supportingContentAlignment
13191317
}
13201318
containerPalette={containerPalette}
1321-
absoluteServerTimes={absoluteServerTimes}
1319+
serverTime={serverTime}
13221320
displayHeader={isFlexibleContainer}
13231321
directionOnMobile={'horizontal'}
13241322
></LatestLinks>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ageStyles = (colour: string) => {
2222
};
2323

2424
type Props = {
25-
absoluteServerTimes: boolean;
25+
serverTime?: number;
2626
webPublication: {
2727
date: string;
2828
isWithinTwelveHours: boolean;
@@ -33,7 +33,7 @@ type Props = {
3333
};
3434

3535
export const CardAge = ({
36-
absoluteServerTimes,
36+
serverTime,
3737
webPublication,
3838
isTagPage,
3939
showClock,
@@ -58,7 +58,7 @@ export const CardAge = ({
5858
<DateTime
5959
date={new Date(webPublication.date)}
6060
display={'relative'}
61-
absoluteServerTimes={absoluteServerTimes}
61+
serverTime={serverTime}
6262
showWeekday={false}
6363
showDate={true}
6464
showTime={false}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Props = {
4343
onwardsSource: OnwardsSource;
4444
leftColSize: LeftColSize;
4545
discussionApiUrl: string;
46-
absoluteServerTimes: boolean;
46+
serverTime?: number;
4747
renderingTarget: RenderingTarget;
4848
};
4949

@@ -449,7 +449,7 @@ type CarouselCardProps = {
449449
linkTo: string;
450450
headlineText: string;
451451
webPublicationDate: string;
452-
absoluteServerTimes: boolean;
452+
serverTime?: number;
453453
imageLoading: Loading;
454454
kickerText?: string;
455455
image?: DCRFrontImage;
@@ -483,7 +483,7 @@ const CarouselCard = ({
483483
imageLoading,
484484
discussionApiUrl,
485485
isOnwardContent,
486-
absoluteServerTimes,
486+
serverTime,
487487
starRating,
488488
index,
489489
}: CarouselCardProps) => {
@@ -527,7 +527,7 @@ const CarouselCard = ({
527527
isOnwardContent={isOnwardContent}
528528
mediaPositionOnDesktop={cardImagePosition}
529529
mediaPositionOnMobile={cardImagePosition}
530-
absoluteServerTimes={absoluteServerTimes}
530+
serverTime={serverTime}
531531
starRating={starRating}
532532
index={index}
533533
showTopBarDesktop={!isOnwardContent}
@@ -751,7 +751,7 @@ export const Carousel = ({
751751
leftColSize,
752752
discussionApiUrl,
753753
isOnwardContent = true,
754-
absoluteServerTimes,
754+
serverTime,
755755
renderingTarget,
756756
...props
757757
}: ArticleProps | FrontProps) => {
@@ -973,7 +973,7 @@ export const Carousel = ({
973973
linkTo={linkTo}
974974
headlineText={headlineText}
975975
webPublicationDate={webPublicationDate}
976-
absoluteServerTimes={absoluteServerTimes}
976+
serverTime={serverTime}
977977
image={image}
978978
kickerText={kickerText}
979979
dataLinkName={`carousel-small-card-position-${i}`}

dotcom-rendering/src/components/Carousel.stories.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ export const Headlines: StoryObj = ({ format }: StoryProps) => {
269269
format={format}
270270
leftColSize="compact"
271271
discussionApiUrl={discussionApiUrl}
272-
absoluteServerTimes={true}
273272
renderingTarget="Web"
274273
/>
275274
</Section>
@@ -295,7 +294,6 @@ export const SingleItemCarousel = () => {
295294
format={defaultFormat}
296295
leftColSize="compact"
297296
discussionApiUrl={discussionApiUrl}
298-
absoluteServerTimes={true}
299297
renderingTarget="Web"
300298
/>
301299
</Section>
@@ -350,7 +348,6 @@ export const SingleOpinionCarousel = () => {
350348
}}
351349
leftColSize="compact"
352350
discussionApiUrl={discussionApiUrl}
353-
absoluteServerTimes={true}
354351
renderingTarget="Web"
355352
/>
356353
</Section>
@@ -381,7 +378,6 @@ export const Immersive = () => {
381378
}}
382379
leftColSize="compact"
383380
discussionApiUrl={discussionApiUrl}
384-
absoluteServerTimes={true}
385381
renderingTarget="Web"
386382
/>
387383
</Section>
@@ -427,7 +423,6 @@ export const SpecialReportAlt = () => {
427423
format={specialReportAltFormat}
428424
leftColSize="compact"
429425
discussionApiUrl={discussionApiUrl}
430-
absoluteServerTimes={true}
431426
renderingTarget="Web"
432427
/>
433428
</Section>
@@ -643,7 +638,6 @@ export const AllCards = () => {
643638
leftColSize="compact"
644639
discussionApiUrl={discussionApiUrl}
645640
format={defaultFormat}
646-
absoluteServerTimes={true}
647641
renderingTarget="Web"
648642
/>
649643
</Section>

0 commit comments

Comments
 (0)