chore: replace function expression with inline statement
replace destructuring for better static analysis remove unused variables
This commit is contained in:
@@ -18,7 +18,7 @@ export default async function MyPages({
|
|||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
const accountPageRes = await serverClient().contentstack.accountPage.get()
|
const accountPageRes = await serverClient().contentstack.accountPage.get()
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|
||||||
if (!accountPageRes) {
|
if (!accountPageRes) {
|
||||||
return null
|
return null
|
||||||
@@ -33,7 +33,7 @@ export default async function MyPages({
|
|||||||
{accountPage.content?.length ? (
|
{accountPage.content?.length ? (
|
||||||
<Blocks blocks={accountPage.content} />
|
<Blocks blocks={accountPage.content} />
|
||||||
) : (
|
) : (
|
||||||
<p>{formatMessage({ id: "No content published" })}</p>
|
<p>{intl.formatMessage({ id: "No content published" })}</p>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
<TrackingSDK pageData={tracking} />
|
<TrackingSDK pageData={tracking} />
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ export default async function CommunicationSlot({
|
|||||||
}: PageArgs<LangParams>) {
|
}: PageArgs<LangParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<article className={styles.content}>
|
<article className={styles.content}>
|
||||||
<Subtitle type="two" color="black">
|
<Subtitle type="two" color="black">
|
||||||
{formatMessage({ id: "My communication preferences" })}
|
{intl.formatMessage({ id: "My communication preferences" })}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Body color="black">
|
<Body color="black">
|
||||||
{formatMessage({
|
{intl.formatMessage({
|
||||||
id: "Tell us what information and updates you'd like to receive, and how, by clicking the link below.",
|
id: "Tell us what information and updates you'd like to receive, and how, by clicking the link below.",
|
||||||
})}
|
})}
|
||||||
</Body>
|
</Body>
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ import { LangParams, PageArgs } from "@/types/params"
|
|||||||
|
|
||||||
export default async function CreditCardSlot({ params }: PageArgs<LangParams>) {
|
export default async function CreditCardSlot({ params }: PageArgs<LangParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const creditCards = await serverClient().user.creditCards()
|
const creditCards = await serverClient().user.creditCards()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<article className={styles.content}>
|
<article className={styles.content}>
|
||||||
<Subtitle type="two" color="black">
|
<Subtitle type="two" color="black">
|
||||||
{formatMessage({ id: "My payment cards" })}
|
{intl.formatMessage({ id: "My payment cards" })}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Body color="black">
|
<Body color="black">
|
||||||
{formatMessage({
|
{intl.formatMessage({
|
||||||
id: "Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.",
|
id: "Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.",
|
||||||
})}
|
})}
|
||||||
</Body>
|
</Body>
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ export default async function MembershipCardSlot({
|
|||||||
params,
|
params,
|
||||||
}: PageArgs<LangParams>) {
|
}: PageArgs<LangParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const membershipCards = await getMembershipCards()
|
const membershipCards = await getMembershipCards()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<article className={styles.content}>
|
<article className={styles.content}>
|
||||||
<Subtitle color="black">
|
<Subtitle color="black">
|
||||||
{formatMessage({ id: "My membership cards" })}
|
{intl.formatMessage({ id: "My membership cards" })}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
</article>
|
</article>
|
||||||
{membershipCards &&
|
{membershipCards &&
|
||||||
@@ -41,7 +41,7 @@ export default async function MembershipCardSlot({
|
|||||||
<Link href="#" variant="icon">
|
<Link href="#" variant="icon">
|
||||||
<PlusCircleIcon color="burgundy" />
|
<PlusCircleIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="underlined">
|
<Body color="burgundy" textTransform="underlined">
|
||||||
{formatMessage({ id: "Add new card" })}
|
{intl.formatMessage({ id: "Add new card" })}
|
||||||
</Body>
|
</Body>
|
||||||
</Link>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { LangParams, PageArgs } from "@/types/params"
|
|||||||
|
|
||||||
export default async function Profile({ params }: PageArgs<LangParams>) {
|
export default async function Profile({ params }: PageArgs<LangParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const user = await getProfile()
|
const user = await getProfile()
|
||||||
if (!user || "error" in user) {
|
if (!user || "error" in user) {
|
||||||
return null
|
return null
|
||||||
@@ -37,7 +37,7 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
|||||||
<Header>
|
<Header>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<Title as="h4" color="red" level="h1" textTransform="capitalize">
|
<Title as="h4" color="red" level="h1" textTransform="capitalize">
|
||||||
{formatMessage({ id: "Welcome" })}
|
{intl.formatMessage({ id: "Welcome" })}
|
||||||
</Title>
|
</Title>
|
||||||
<Title as="h4" color="burgundy" level="h2" textTransform="capitalize">
|
<Title as="h4" color="burgundy" level="h2" textTransform="capitalize">
|
||||||
{user.name}
|
{user.name}
|
||||||
@@ -45,7 +45,7 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
|||||||
</hgroup>
|
</hgroup>
|
||||||
<Button asChild intent="primary" size="small" theme="base">
|
<Button asChild intent="primary" size="small" theme="base">
|
||||||
<Link prefetch={false} color="none" href={profileEdit[params.lang]}>
|
<Link prefetch={false} color="none" href={profileEdit[params.lang]}>
|
||||||
{formatMessage({ id: "Edit profile" })}
|
{intl.formatMessage({ id: "Edit profile" })}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</Header>
|
</Header>
|
||||||
@@ -54,35 +54,35 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
|||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<CalendarIcon color="burgundy" />
|
<CalendarIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Date of Birth" })}
|
{intl.formatMessage({ id: "Date of Birth" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">{user.dateOfBirth}</Body>
|
<Body color="burgundy">{user.dateOfBirth}</Body>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<PhoneIcon color="burgundy" />
|
<PhoneIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Phone number" })}
|
{intl.formatMessage({ id: "Phone number" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">{user.phoneNumber}</Body>
|
<Body color="burgundy">{user.phoneNumber}</Body>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<GlobeIcon color="burgundy" />
|
<GlobeIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Language" })}
|
{intl.formatMessage({ id: "Language" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">{language?.label ?? defaultLanguage}</Body>
|
<Body color="burgundy">{language?.label ?? defaultLanguage}</Body>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<EmailIcon color="burgundy" />
|
<EmailIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Email" })}
|
{intl.formatMessage({ id: "Email" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">{user.email}</Body>
|
<Body color="burgundy">{user.email}</Body>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<LocationIcon color="burgundy" />
|
<LocationIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Address" })}
|
{intl.formatMessage({ id: "Address" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">
|
<Body color="burgundy">
|
||||||
{user.address.streetAddress
|
{user.address.streetAddress
|
||||||
@@ -100,7 +100,7 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
|||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<LockIcon color="burgundy" />
|
<LockIcon color="burgundy" />
|
||||||
<Body color="burgundy" textTransform="bold">
|
<Body color="burgundy" textTransform="bold">
|
||||||
{formatMessage({ id: "Password" })}
|
{intl.formatMessage({ id: "Password" })}
|
||||||
</Body>
|
</Body>
|
||||||
<Body color="burgundy">**********</Body>
|
<Body color="burgundy">**********</Body>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ export default async function MembershipNumber({
|
|||||||
color,
|
color,
|
||||||
membership,
|
membership,
|
||||||
}: MembershipNumberProps) {
|
}: MembershipNumberProps) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const classNames = membershipNumberVariants({ className, color })
|
const classNames = membershipNumberVariants({ className, color })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames}>
|
<div className={classNames}>
|
||||||
<Caption color="pale">
|
<Caption color="pale">
|
||||||
{formatMessage({ id: "Membership ID" })}
|
{intl.formatMessage({ id: "Membership ID" })}
|
||||||
{": "}
|
{": "}
|
||||||
</Caption>
|
</Caption>
|
||||||
<span className={styles.icon}>
|
<span className={styles.icon}>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default async function Friend({
|
|||||||
membership,
|
membership,
|
||||||
name,
|
name,
|
||||||
}: FriendProps) {
|
}: FriendProps) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
if (!membership?.membershipLevel) {
|
if (!membership?.membershipLevel) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ export default async function Friend({
|
|||||||
<section className={styles.friend}>
|
<section className={styles.friend}>
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<Body color="white" textTransform="bold" textAlign="center">
|
<Body color="white" textTransform="bold" textAlign="center">
|
||||||
{formatMessage(
|
{intl.formatMessage(
|
||||||
isHighestLevel
|
isHighestLevel
|
||||||
? { id: "Highest level" }
|
? { id: "Highest level" }
|
||||||
: { id: `Level ${membershipLevels[membership.membershipLevel]}` }
|
: { id: `Level ${membershipLevels[membership.membershipLevel]}` }
|
||||||
|
|||||||
@@ -44,15 +44,13 @@ async function PointsColumn({
|
|||||||
title,
|
title,
|
||||||
subtitle,
|
subtitle,
|
||||||
}: PointsColumnProps) {
|
}: PointsColumnProps) {
|
||||||
const { formatMessage, formatNumber } = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|
||||||
function number() {
|
let number = "N/A"
|
||||||
if (typeof points === "number") {
|
if (typeof points === "number") {
|
||||||
return formatNumber(points)
|
number = intl.formatNumber(points)
|
||||||
} else if (typeof nights === "number") {
|
} else if (typeof nights === "number") {
|
||||||
return formatNumber(nights)
|
number = intl.formatNumber(nights)
|
||||||
}
|
|
||||||
return "N/A"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -63,16 +61,16 @@ async function PointsColumn({
|
|||||||
textAlign="center"
|
textAlign="center"
|
||||||
className={styles.firstRow}
|
className={styles.firstRow}
|
||||||
>
|
>
|
||||||
{formatMessage({
|
{intl.formatMessage({
|
||||||
id: title,
|
id: title,
|
||||||
})}
|
})}
|
||||||
</Body>
|
</Body>
|
||||||
<Title color="white" level="h2" textAlign="center">
|
<Title color="white" level="h2" textAlign="center">
|
||||||
{number()}
|
{number}
|
||||||
</Title>
|
</Title>
|
||||||
{subtitle ? (
|
{subtitle ? (
|
||||||
<Body color="white" textAlign="center">
|
<Body color="white" textAlign="center">
|
||||||
{formatMessage({ id: subtitle })}
|
{intl.formatMessage({ id: subtitle })}
|
||||||
</Body>
|
</Body>
|
||||||
) : null}
|
) : null}
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { NextLevelPointsColumn, YourPointsColumn } from "./PointsColumn"
|
|||||||
import { UserProps } from "@/types/components/myPages/user"
|
import { UserProps } from "@/types/components/myPages/user"
|
||||||
|
|
||||||
export default async function Points({ user }: UserProps) {
|
export default async function Points({ user }: UserProps) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|
||||||
const membership = getMembership(user.memberships)
|
const membership = getMembership(user.memberships)
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export default async function Points({ user }: UserProps) {
|
|||||||
{nextLevel && (
|
{nextLevel && (
|
||||||
<NextLevelPointsColumn
|
<NextLevelPointsColumn
|
||||||
points={membership?.pointsRequiredToNextlevel}
|
points={membership?.pointsRequiredToNextlevel}
|
||||||
subtitle={`${formatMessage({ id: "next level:" })} ${nextLevel.name}`}
|
subtitle={`${intl.formatMessage({ id: "next level:" })} ${nextLevel.name}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* TODO: Show NextLevelNightsColumn when nightsToTopTier data is correct from Antavo */}
|
{/* TODO: Show NextLevelNightsColumn when nightsToTopTier data is correct from Antavo */}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { LangParams } from "@/types/params"
|
|||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
export default async function Points({ user, lang }: UserProps & LangParams) {
|
export default async function Points({ user, lang }: UserProps & LangParams) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|
||||||
const membership = getMembership(user.memberships)
|
const membership = getMembership(user.memberships)
|
||||||
if (!membership?.nextLevel || !MembershipLevelEnum[membership.nextLevel]) {
|
if (!membership?.nextLevel || !MembershipLevelEnum[membership.nextLevel]) {
|
||||||
@@ -34,13 +34,13 @@ export default async function Points({ user, lang }: UserProps & LangParams) {
|
|||||||
{membership?.currentPoints ? (
|
{membership?.currentPoints ? (
|
||||||
<StayOnLevelColumn
|
<StayOnLevelColumn
|
||||||
points={membership?.currentPoints} //TODO
|
points={membership?.currentPoints} //TODO
|
||||||
subtitle={`${formatMessage({ id: "by" })} ${membership?.expirationDate}`}
|
subtitle={`${intl.formatMessage({ id: "by" })} ${membership?.expirationDate}`}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<NextLevelPointsColumn
|
<NextLevelPointsColumn
|
||||||
points={membership?.pointsRequiredToNextlevel}
|
points={membership?.pointsRequiredToNextlevel}
|
||||||
subtitle={`${formatMessage({ id: "next level:" })} ${nextLevel.name}`}
|
subtitle={`${intl.formatMessage({ id: "next level:" })} ${nextLevel.name}`}
|
||||||
/>
|
/>
|
||||||
{membership?.nightsToTopTier && (
|
{membership?.nightsToTopTier && (
|
||||||
<NextLevelNightsColumn
|
<NextLevelNightsColumn
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { getIntl } from "@/i18n"
|
|||||||
import styles from "./emptyPreviousStays.module.css"
|
import styles from "./emptyPreviousStays.module.css"
|
||||||
|
|
||||||
export default async function EmptyPreviousStaysBlock() {
|
export default async function EmptyPreviousStaysBlock() {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<Title as="h4" level="h3" color="red" textAlign="center">
|
<Title as="h4" level="h3" color="red" textAlign="center">
|
||||||
{formatMessage({
|
{intl.formatMessage({
|
||||||
id: "You have no previous stays.",
|
id: "You have no previous stays.",
|
||||||
})}
|
})}
|
||||||
</Title>
|
</Title>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default function ShowMoreButton({
|
|||||||
disabled,
|
disabled,
|
||||||
loadMoreData,
|
loadMoreData,
|
||||||
}: ShowMoreButtonParams) {
|
}: ShowMoreButtonParams) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Button
|
<Button
|
||||||
@@ -25,7 +25,7 @@ export default function ShowMoreButton({
|
|||||||
intent="text"
|
intent="text"
|
||||||
>
|
>
|
||||||
<ChevronDownIcon />
|
<ChevronDownIcon />
|
||||||
{formatMessage({ id: "Show more" })}
|
{intl.formatMessage({ id: "Show more" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import { getLang } from "@/i18n/serverContext"
|
|||||||
import styles from "./emptyUpcomingStays.module.css"
|
import styles from "./emptyUpcomingStays.module.css"
|
||||||
|
|
||||||
export default async function EmptyUpcomingStaysBlock() {
|
export default async function EmptyUpcomingStaysBlock() {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<div className={styles.titleContainer}>
|
<div className={styles.titleContainer}>
|
||||||
<Title as="h4" level="h3" color="red" className={styles.title}>
|
<Title as="h4" level="h3" color="red" className={styles.title}>
|
||||||
{formatMessage({ id: "You have no upcoming stays." })}
|
{intl.formatMessage({ id: "You have no upcoming stays." })}
|
||||||
<span className={styles.burgundyTitle}>
|
<span className={styles.burgundyTitle}>
|
||||||
{formatMessage({ id: "Where should you go next?" })}
|
{intl.formatMessage({ id: "Where should you go next?" })}
|
||||||
</span>
|
</span>
|
||||||
</Title>
|
</Title>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +26,7 @@ export default async function EmptyUpcomingStaysBlock() {
|
|||||||
className={styles.link}
|
className={styles.link}
|
||||||
color="peach80"
|
color="peach80"
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Get inspired" })}
|
{intl.formatMessage({ id: "Get inspired" })}
|
||||||
<ArrowRightIcon color="peach80" />
|
<ArrowRightIcon color="peach80" />
|
||||||
</Link>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import { getLang } from "@/i18n/serverContext"
|
|||||||
import styles from "./emptyUpcomingStays.module.css"
|
import styles from "./emptyUpcomingStays.module.css"
|
||||||
|
|
||||||
export default async function EmptyUpcomingStaysBlock() {
|
export default async function EmptyUpcomingStaysBlock() {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<div className={styles.titleContainer}>
|
<div className={styles.titleContainer}>
|
||||||
<Title as="h4" level="h3" color="red" className={styles.title}>
|
<Title as="h4" level="h3" color="red" className={styles.title}>
|
||||||
{formatMessage({ id: "You have no upcoming stays." })}
|
{intl.formatMessage({ id: "You have no upcoming stays." })}
|
||||||
<span className={styles.burgundyTitle}>
|
<span className={styles.burgundyTitle}>
|
||||||
{formatMessage({ id: "Where should you go next?" })}
|
{intl.formatMessage({ id: "Where should you go next?" })}
|
||||||
</span>
|
</span>
|
||||||
</Title>
|
</Title>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +26,7 @@ export default async function EmptyUpcomingStaysBlock() {
|
|||||||
className={styles.link}
|
className={styles.link}
|
||||||
color="peach80"
|
color="peach80"
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Get inspired" })}
|
{intl.formatMessage({ id: "Get inspired" })}
|
||||||
<ArrowRightIcon color="peach80" />
|
<ArrowRightIcon color="peach80" />
|
||||||
</Link>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import { useIntl } from "react-intl"
|
|||||||
import styles from "./bookingButton.module.css"
|
import styles from "./bookingButton.module.css"
|
||||||
|
|
||||||
export default function BookingButton({ href }: { href: string }) {
|
export default function BookingButton({ href }: { href: string }) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
return (
|
return (
|
||||||
<a className={styles.button} href={href}>
|
<a className={styles.button} href={href}>
|
||||||
{formatMessage({ id: "Book" })}
|
{intl.formatMessage({ id: "Book" })}
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function MyPagesMobileDropdown({
|
|||||||
}: {
|
}: {
|
||||||
navigation: Navigation
|
navigation: Navigation
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
const { toggleDropdown, isMyPagesMobileMenuOpen } = useDropdownStore()
|
const { toggleDropdown, isMyPagesMobileMenuOpen } = useDropdownStore()
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ export default function MyPagesMobileDropdown({
|
|||||||
color="burgundy"
|
color="burgundy"
|
||||||
variant="myPageMobileDropdown"
|
variant="myPageMobileDropdown"
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Log out" })}
|
{intl.formatMessage({ id: "Log out" })}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default async function TopMenu({
|
|||||||
links,
|
links,
|
||||||
languageSwitcher,
|
languageSwitcher,
|
||||||
}: TopMenuProps) {
|
}: TopMenuProps) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const user = await getName()
|
const user = await getName()
|
||||||
return (
|
return (
|
||||||
<div className={styles.topMenu}>
|
<div className={styles.topMenu}>
|
||||||
@@ -60,7 +60,7 @@ export default async function TopMenu({
|
|||||||
className={styles.sessionLink}
|
className={styles.sessionLink}
|
||||||
prefetch={false}
|
prefetch={false}
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Log out" })}
|
{intl.formatMessage({ id: "Log out" })}
|
||||||
</Link>
|
</Link>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -69,7 +69,7 @@ export default async function TopMenu({
|
|||||||
trackingId="loginStartTopMenu"
|
trackingId="loginStartTopMenu"
|
||||||
className={`${styles.sessionLink} ${styles.loginLink}`}
|
className={`${styles.sessionLink} ${styles.loginLink}`}
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Log in" })}
|
{intl.formatMessage({ id: "Log in" })}
|
||||||
</LoginButton>
|
</LoginButton>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function SocialIcon({ iconName }: SocialIconsProps) {
|
|||||||
|
|
||||||
export default async function FooterDetails() {
|
export default async function FooterDetails() {
|
||||||
const lang = getLang()
|
const lang = getLang()
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
// preloaded
|
// preloaded
|
||||||
const footer = await getFooter()
|
const footer = await getFooter()
|
||||||
const languages = await getLanguageSwitcher()
|
const languages = await getLanguageSwitcher()
|
||||||
@@ -58,7 +58,7 @@ export default async function FooterDetails() {
|
|||||||
<div className={styles.copyrightContainer}>
|
<div className={styles.copyrightContainer}>
|
||||||
<Footnote textTransform="uppercase">
|
<Footnote textTransform="uppercase">
|
||||||
© {currentYear}{" "}
|
© {currentYear}{" "}
|
||||||
{formatMessage({ id: "Copyright all rights reserved" })}
|
{intl.formatMessage({ id: "Copyright all rights reserved" })}
|
||||||
</Footnote>
|
</Footnote>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.navigationContainer}>
|
<div className={styles.navigationContainer}>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { serverClient } from "@/lib/trpc/server"
|
|||||||
|
|
||||||
import LoginButton from "@/components/LoginButton"
|
import LoginButton from "@/components/LoginButton"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
|
||||||
|
|
||||||
import Avatar from "../Avatar"
|
import Avatar from "../Avatar"
|
||||||
import MyPagesMenu from "../MyPagesMenu"
|
import MyPagesMenu from "../MyPagesMenu"
|
||||||
@@ -17,7 +16,6 @@ import MyPagesMobileMenu from "../MyPagesMobileMenu"
|
|||||||
import styles from "./myPagesMenuWrapper.module.css"
|
import styles from "./myPagesMenuWrapper.module.css"
|
||||||
|
|
||||||
export default async function MyPagesMenuWrapper() {
|
export default async function MyPagesMenuWrapper() {
|
||||||
const lang = getLang()
|
|
||||||
const [intl, myPagesNavigation, user, membership] = await Promise.all([
|
const [intl, myPagesNavigation, user, membership] = await Promise.all([
|
||||||
getIntl(),
|
getIntl(),
|
||||||
getMyPagesNavigation(),
|
getMyPagesNavigation(),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import styles from "./sidebar.module.css"
|
|||||||
|
|
||||||
export default async function SidebarMyPages() {
|
export default async function SidebarMyPages() {
|
||||||
const navigation = await getMyPagesNavigation()
|
const navigation = await getMyPagesNavigation()
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className={styles.sidebar}>
|
<aside className={styles.sidebar}>
|
||||||
@@ -46,7 +46,7 @@ export default async function SidebarMyPages() {
|
|||||||
size="small"
|
size="small"
|
||||||
variant="sidebar"
|
variant="sidebar"
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Log out" })}
|
{intl.formatMessage({ id: "Log out" })}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -12,17 +12,19 @@ export default function DeleteCreditCardButton({
|
|||||||
}: {
|
}: {
|
||||||
creditCardId: string
|
creditCardId: string
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
const trpcUtils = trpc.useUtils()
|
const trpcUtils = trpc.useUtils()
|
||||||
|
|
||||||
const deleteCreditCardMutation = trpc.user.creditCard.delete.useMutation({
|
const deleteCreditCardMutation = trpc.user.creditCard.delete.useMutation({
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
trpcUtils.user.creditCards.invalidate()
|
trpcUtils.user.creditCards.invalidate()
|
||||||
toast.success(formatMessage({ id: "Credit card deleted successfully" }))
|
toast.success(
|
||||||
|
intl.formatMessage({ id: "Credit card deleted successfully" })
|
||||||
|
)
|
||||||
},
|
},
|
||||||
onError() {
|
onError() {
|
||||||
toast.error(
|
toast.error(
|
||||||
formatMessage({
|
intl.formatMessage({
|
||||||
id: "Failed to delete credit card, please try again later.",
|
id: "Failed to delete credit card, please try again later.",
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
export default async function SkipToMainContent() {
|
export default async function SkipToMainContent() {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<div className="navigation--skip-to-content">
|
<div className="navigation--skip-to-content">
|
||||||
<a data-js="skip-to-content" href="#maincontent">
|
<a data-js="skip-to-content" href="#maincontent">
|
||||||
{formatMessage({ id: "Skip to main content" })}
|
{intl.formatMessage({ id: "Skip to main content" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default function CountrySelect({
|
|||||||
readOnly = false,
|
readOnly = false,
|
||||||
registerOptions = {},
|
registerOptions = {},
|
||||||
}: CountryProps) {
|
}: CountryProps) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
const [rootDiv, setRootDiv] = useState<CountryPortalContainer>(undefined)
|
const [rootDiv, setRootDiv] = useState<CountryPortalContainer>(undefined)
|
||||||
|
|
||||||
function setRef(node: CountryPortalContainerArgs) {
|
function setRef(node: CountryPortalContainerArgs) {
|
||||||
@@ -53,13 +53,12 @@ export default function CountrySelect({
|
|||||||
setValue(name, country)
|
setValue(name, country)
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectCountryLabel = formatMessage({ id: "Select a country" })
|
const selectCountryLabel = intl.formatMessage({ id: "Select a country" })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.container} ${className}`} ref={setRef}>
|
<div className={`${styles.container} ${className}`} ref={setRef}>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
aria-label={formatMessage({ id: "Select country of residence" })}
|
aria-label={intl.formatMessage({ id: "Select country of residence" })}
|
||||||
className={styles.select}
|
|
||||||
isInvalid={fieldState.invalid}
|
isInvalid={fieldState.invalid}
|
||||||
isReadOnly={readOnly}
|
isReadOnly={readOnly}
|
||||||
isRequired={!!registerOptions?.required}
|
isRequired={!!registerOptions?.required}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function Phone({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
}: PhoneProps) {
|
}: PhoneProps) {
|
||||||
const { formatMessage } = useIntl()
|
const intl = useIntl()
|
||||||
const { control, setValue, trigger } = useFormContext()
|
const { control, setValue, trigger } = useFormContext()
|
||||||
const phone = useWatch({ name })
|
const phone = useWatch({ name })
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export default function Phone({
|
|||||||
data-testid="country-selector"
|
data-testid="country-selector"
|
||||||
>
|
>
|
||||||
<Label required={!!registerOptions.required} size="small">
|
<Label required={!!registerOptions.required} size="small">
|
||||||
{formatMessage({ id: "Country code" })}
|
{intl.formatMessage({ id: "Country code" })}
|
||||||
</Label>
|
</Label>
|
||||||
<span className={styles.selectContainer}>
|
<span className={styles.selectContainer}>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import { webviewSearchParams } from "@/utils/webviews"
|
|||||||
import styles from "./linkToOverview.module.css"
|
import styles from "./linkToOverview.module.css"
|
||||||
|
|
||||||
export default async function LinkToOverview() {
|
export default async function LinkToOverview() {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const searchParams = webviewSearchParams()
|
const searchParams = webviewSearchParams()
|
||||||
|
|
||||||
const overviewHref = `${overview[getLang()]}?${searchParams.toString()}`
|
const overviewHref = `${overview[getLang()]}?${searchParams.toString()}`
|
||||||
return (
|
return (
|
||||||
<Link className={styles.overviewLink} href={overviewHref}>
|
<Link className={styles.overviewLink} href={overviewHref}>
|
||||||
<ArrowLeft height={20} width={20} />{" "}
|
<ArrowLeft height={20} width={20} />{" "}
|
||||||
{formatMessage({ id: "Go back to overview" })}
|
{intl.formatMessage({ id: "Go back to overview" })}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user