feat(SW-706): make eslint rule 'formatjs/no-literal-string-in-jsx' pass

This commit is contained in:
Michael Zetterberg
2025-02-07 06:51:36 +01:00
parent e22fc1f3c8
commit 440e1f92df
393 changed files with 4839 additions and 1554 deletions

View File

@@ -16,7 +16,9 @@ export default function Card({ title, children }: CardProps) {
src="/_static/img/rewards/loyalty-award.png"
width={113}
height={125}
alt={intl.formatMessage({ id: "Surprise!" })}
alt={intl.formatMessage({
defaultMessage: "Surprise!",
})}
/>
<header>
<Title textAlign="center" level="h4">

View File

@@ -76,13 +76,16 @@ export default function SurprisesNotification({
<>
{intl.formatMessage(
{
id: "{amount, plural, one {Gift} other {Gifts}} added to your benefits",
defaultMessage:
"{amount, plural, one {Gift} other {Gifts}} added to your benefits",
},
{ amount: surprises.length }
)}
<br />
<Link href={benefitPageUrl} variant="underscored" color="burgundy">
{intl.formatMessage({ id: "Go to My Benefits" })}
{intl.formatMessage({
defaultMessage: "Go to My Benefits",
})}
</Link>
</>
)
@@ -93,7 +96,8 @@ export default function SurprisesNotification({
<>
{intl.formatMessage(
{
id: "Oops! Something went wrong while showing your surprise. Please refresh the page or try again later. If the issue persists, <link>contact the support.</link>",
defaultMessage:
"Oops! Something went wrong while showing your surprise. Please refresh the page or try again later. If the issue persists, <link>contact the support.</link>",
},
{
link: (str) => (
@@ -168,7 +172,9 @@ export default function SurprisesNotification({
onAnimationComplete={confetti}
>
<Dialog
aria-label={intl.formatMessage({ id: "Surprises" })}
aria-label={intl.formatMessage({
defaultMessage: "Surprises",
})}
className={styles.dialog}
>
{({ close }) => {
@@ -183,7 +189,9 @@ export default function SurprisesNotification({
{showSurprises && totalSurprises > 1 && (
<Caption type="label" uppercase>
{intl.formatMessage(
{ id: "{amount} out of {total}" },
{
defaultMessage: "{amount} out of {total}",
},
{
amount: selectedSurprise + 1,
total: totalSurprises,

View File

@@ -12,13 +12,18 @@ export default function Initial({ totalSurprises, onOpen }: InitialProps) {
const intl = useIntl()
return (
<Card title={intl.formatMessage({ id: "Surprise!" })}>
<Card
title={intl.formatMessage({
defaultMessage: "Surprise!",
})}
>
<Body textAlign="center">
{totalSurprises > 1 ? (
<>
{intl.formatMessage(
{
id: "You have <b>{amount}</b> gifts waiting for you!",
defaultMessage:
"You have <b>{amount}</b> gifts waiting for you!",
},
{
amount: totalSurprises,
@@ -27,18 +32,18 @@ export default function Initial({ totalSurprises, onOpen }: InitialProps) {
)}
<br />
{intl.formatMessage({
id: "Hurry up and use them before they expire!",
defaultMessage: "Hurry up and use them before they expire!",
})}
</>
) : (
intl.formatMessage({
id: "We have a special gift waiting for you!",
defaultMessage: "We have a special gift waiting for you!",
})
)}
</Body>
<Caption>
{intl.formatMessage({
id: "You'll find all your gifts in 'My benefits'",
defaultMessage: "You'll find all your gifts in 'My benefits'",
})}
</Caption>
@@ -52,7 +57,7 @@ export default function Initial({ totalSurprises, onOpen }: InitialProps) {
>
{intl.formatMessage(
{
id: "Open {amount, plural, one {gift} other {gifts}}",
defaultMessage: "Open {amount, plural, one {gift} other {gifts}}",
},
{ amount: totalSurprises }
)}

View File

@@ -30,7 +30,9 @@ export default function Navigation({
size={20}
className={styles.chevron}
/>
{intl.formatMessage({ id: "Previous" })}
{intl.formatMessage({
defaultMessage: "Previous",
})}
</Button>
<Button
variant="icon"
@@ -39,7 +41,9 @@ export default function Navigation({
onPress={() => showSurprise(1)}
size="small"
>
{intl.formatMessage({ id: "Next" })}
{intl.formatMessage({
defaultMessage: "Next",
})}
<MaterialIcon icon="chevron_right" size={20} color="CurrentColor" />
</Button>
</nav>