Skip to content

Commit 1c582c4

Browse files
authored
Merge pull request #1429 from guardian/canada-strike-message
Canada strike message
2 parents 195c083 + 7d1f67d commit 1c582c4

File tree

3 files changed

+77
-19
lines changed

3 files changed

+77
-19
lines changed

client/components/mma/accountoverview/AccountOverview.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type { IsFromAppProps } from '../shared/IsFromAppProps';
5151
import { NewspaperArchiveCta } from '../shared/NewspaperArchiveCta';
5252
import { nonServiceableCountries } from '../shared/NonServiceableCountries';
5353
import { PaymentFailureAlertIfApplicable } from '../shared/PaymentFailureAlertIfApplicable';
54+
import { CanadaStrike } from './CanadaStrike';
5455
import { CancelledProductCard } from './CancelledProductCard';
5556
import { EmptyAccountOverview } from './EmptyAccountOverview';
5657
import { InAppPurchaseCard } from './InAppPurchaseCard';
@@ -197,6 +198,18 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
197198
return specificProductType.groupedProductType;
198199
};
199200

201+
const possiblyAffectedByCanadaPostStrike = allActiveProductDetails.some(
202+
(product) => {
203+
const deliveryCountry =
204+
product.subscription.deliveryAddress?.country.toUpperCase();
205+
return (
206+
(product.tier === 'Tier Three' ||
207+
product.tier === 'Guardian Weekly - ROW') &&
208+
(deliveryCountry === 'CANADA' || deliveryCountry === 'CA')
209+
);
210+
},
211+
);
212+
200213
return (
201214
<>
202215
<PersonalisedHeader
@@ -208,6 +221,7 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
208221
productDetails={allActiveProductDetails}
209222
isFromApp={isFromApp}
210223
/>
224+
{possiblyAffectedByCanadaPostStrike && <CanadaStrike />}
211225
{uniqueProductCategories.map((category) => {
212226
const groupedProductType = GROUPED_PRODUCT_TYPES[category];
213227
const activeProductsInCategory = allActiveProductDetails.filter(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { css } from '@emotion/react';
2+
import { Link } from '@guardian/source/react-components';
3+
import { ProblemAlert } from '../shared/ProblemAlert';
4+
5+
export const CanadaStrike = () => (
6+
<ProblemAlert
7+
message={
8+
<div>
9+
<p>
10+
Due to industrial action by Canada Post, it is not possible
11+
to deliver your copies of the Guardian Weekly. You are
12+
welcome to pause your subscription during the period of
13+
industrial action, details on how to do so can be found{' '}
14+
<Link
15+
href="https://manage.theguardian.com/help-centre/article/i-need-to-pause-my-delivery"
16+
priority="primary"
17+
>
18+
here
19+
</Link>
20+
.
21+
</p>
22+
<p>
23+
If you have reached your allowance limit please contact{' '}
24+
<Link
25+
href="mailto:[email protected]"
26+
priority="primary"
27+
>
28+
29+
</Link>
30+
</p>
31+
</div>
32+
}
33+
additionalcss={css`
34+
margin-top: 30px;
35+
`}
36+
/>
37+
);

client/components/mma/shared/ProblemAlert.tsx

+26-19
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ interface AlertButtonProps {
2323
}
2424

2525
interface ProblemAlertProps {
26-
title: string;
27-
message: string;
26+
title?: string;
27+
message: string | React.ReactElement;
2828
button?: AlertButtonProps;
2929
additionalcss?: SerializedStyles;
3030
}
@@ -48,23 +48,30 @@ export const ProblemAlert = (props: ProblemAlertProps) => (
4848
>
4949
<ErrorIcon />
5050
</i>
51-
<h4
52-
css={css`
53-
${textSansBold17};
54-
margin: 0;
55-
`}
56-
>
57-
{props.title}
58-
</h4>
59-
<p
60-
css={css`
61-
margin: ${space[2]}px 0 ${props.button ? `${space[3]}px` : '0'}
62-
0;
63-
${textSans17};
64-
`}
65-
>
66-
{props.message}
67-
</p>
51+
{props.title && (
52+
<h4
53+
css={css`
54+
${textSansBold17};
55+
margin: 0;
56+
`}
57+
>
58+
{props.title}
59+
</h4>
60+
)}
61+
{typeof props.message === 'string' ? (
62+
<p
63+
css={css`
64+
margin: ${space[2]}px 0
65+
${props.button ? `${space[3]}px` : '0'} 0;
66+
${textSans17};
67+
`}
68+
>
69+
{props.message}
70+
</p>
71+
) : (
72+
props.message
73+
)}
74+
6875
{props.button && (
6976
<LinkButton
7077
to={props.button.link}

0 commit comments

Comments
 (0)