chore: remove destructuring of intl.formatMessage
This commit is contained in:
@@ -6,18 +6,18 @@ import Link from "@/components/TempDesignSystem/Link"
|
|||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import styles from "./amenitiesList.module.css"
|
import styles from "./amenitiesList.module.css"
|
||||||
|
|
||||||
import { HotelData } from "@/types/hotel"
|
import { HotelData } from "@/types/hotel"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
|
||||||
|
|
||||||
export default async function AmenitiesList({
|
export default async function AmenitiesList({
|
||||||
detailedFacilities,
|
detailedFacilities,
|
||||||
}: {
|
}: {
|
||||||
detailedFacilities: HotelData["data"]["attributes"]["detailedFacilities"]
|
detailedFacilities: HotelData["data"]["attributes"]["detailedFacilities"]
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = await getIntl()
|
const intl = await getIntl()
|
||||||
const sortedAmenities = detailedFacilities
|
const sortedAmenities = detailedFacilities
|
||||||
.sort((a, b) => b.sortOrder - a.sortOrder)
|
.sort((a, b) => b.sortOrder - a.sortOrder)
|
||||||
.slice(0, 5)
|
.slice(0, 5)
|
||||||
@@ -25,7 +25,7 @@ export default async function AmenitiesList({
|
|||||||
return (
|
return (
|
||||||
<section className={styles.amenitiesContainer}>
|
<section className={styles.amenitiesContainer}>
|
||||||
<Subtitle type="two" color="black">
|
<Subtitle type="two" color="black">
|
||||||
{formatMessage({ id: "At the hotel" })}
|
{intl.formatMessage({ id: "At the hotel" })}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<div className={styles.amenityItemList}>
|
<div className={styles.amenityItemList}>
|
||||||
{sortedAmenities.map((facility) => {
|
{sortedAmenities.map((facility) => {
|
||||||
@@ -44,7 +44,7 @@ export default async function AmenitiesList({
|
|||||||
color="burgundy"
|
color="burgundy"
|
||||||
variant="icon"
|
variant="icon"
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Show all amenities" })}
|
{intl.formatMessage({ id: "Show all amenities" })}
|
||||||
<ChevronRightIcon />
|
<ChevronRightIcon />
|
||||||
</Link>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Preamble from "@/components/TempDesignSystem/Text/Preamble"
|
|||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import { IntroSectionProps } from "./types"
|
import { IntroSectionProps } from "./types"
|
||||||
|
|
||||||
import styles from "./introSection.module.css"
|
import styles from "./introSection.module.css"
|
||||||
@@ -21,16 +22,15 @@ export default async function IntroSection({
|
|||||||
tripAdvisor,
|
tripAdvisor,
|
||||||
}: IntroSectionProps) {
|
}: IntroSectionProps) {
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
const { formatMessage } = intl
|
|
||||||
const { streetAddress, city } = address
|
const { streetAddress, city } = address
|
||||||
const { distanceToCentre } = location
|
const { distanceToCentre } = location
|
||||||
const formattedDistanceText = formatMessage(
|
const formattedDistanceText = intl.formatMessage(
|
||||||
{ id: "Distance to city centre" },
|
{ id: "Distance to city centre" },
|
||||||
{ number: distanceToCentre }
|
{ number: distanceToCentre }
|
||||||
)
|
)
|
||||||
const lang = getLang()
|
const lang = getLang()
|
||||||
const formattedLocationText = `${streetAddress}, ${city} (${formattedDistanceText})`
|
const formattedLocationText = `${streetAddress}, ${city} (${formattedDistanceText})`
|
||||||
const formattedTripAdvisorText = formatMessage(
|
const formattedTripAdvisorText = intl.formatMessage(
|
||||||
{ id: "Tripadvisor reviews" },
|
{ id: "Tripadvisor reviews" },
|
||||||
{ rating: tripAdvisor.rating, count: tripAdvisor.numberOfReviews }
|
{ rating: tripAdvisor.rating, count: tripAdvisor.numberOfReviews }
|
||||||
)
|
)
|
||||||
@@ -40,7 +40,7 @@ export default async function IntroSection({
|
|||||||
<div className={styles.mainContent}>
|
<div className={styles.mainContent}>
|
||||||
<div className={styles.titleContainer}>
|
<div className={styles.titleContainer}>
|
||||||
<BiroScript tilted="medium" color="red">
|
<BiroScript tilted="medium" color="red">
|
||||||
{formatMessage({ id: "Welcome to" })}:
|
{intl.formatMessage({ id: "Welcome to" })}:
|
||||||
</BiroScript>
|
</BiroScript>
|
||||||
<Title level="h2">{hotelName}</Title>
|
<Title level="h2">{hotelName}</Title>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,7 +66,7 @@ export default async function IntroSection({
|
|||||||
variant="icon"
|
variant="icon"
|
||||||
href={`?s=${about[lang]}`}
|
href={`?s=${about[lang]}`}
|
||||||
>
|
>
|
||||||
{formatMessage({ id: "Read more about the hotel" })}
|
{intl.formatMessage({ id: "Read more about the hotel" })}
|
||||||
<ArrowRight color="peach80" />
|
<ArrowRight color="peach80" />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ function SidePeekContainer() {
|
|||||||
return sidePeekParam || null
|
return sidePeekParam || null
|
||||||
})
|
})
|
||||||
|
|
||||||
const { formatMessage } = useIntl()
|
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const intl = useIntl()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const sidePeekParam = searchParams.get("s") as SidePeekContentKey | null
|
const sidePeekParam = searchParams.get("s") as SidePeekContentKey | null
|
||||||
if (sidePeekParam !== activeSidePeek) {
|
if (sidePeekParam !== activeSidePeek) {
|
||||||
@@ -45,14 +46,14 @@ function SidePeekContainer() {
|
|||||||
<SidePeek handleClose={handleClose} activeSidePeek={activeSidePeek}>
|
<SidePeek handleClose={handleClose} activeSidePeek={activeSidePeek}>
|
||||||
<SidePeekItem
|
<SidePeekItem
|
||||||
contentKey={amenities[lang]}
|
contentKey={amenities[lang]}
|
||||||
title={formatMessage({ id: "Amenities" })}
|
title={intl.formatMessage({ id: "Amenities" })}
|
||||||
>
|
>
|
||||||
{/* TODO: Render amenities as per the design. */}
|
{/* TODO: Render amenities as per the design. */}
|
||||||
Read more about the amenities here
|
Read more about the amenities here
|
||||||
</SidePeekItem>
|
</SidePeekItem>
|
||||||
<SidePeekItem
|
<SidePeekItem
|
||||||
contentKey={about[lang]}
|
contentKey={about[lang]}
|
||||||
title={formatMessage({ id: "Read more about the hotel" })}
|
title={intl.formatMessage({ id: "Read more about the hotel" })}
|
||||||
>
|
>
|
||||||
Some additional information about the hotel
|
Some additional information about the hotel
|
||||||
</SidePeekItem>
|
</SidePeekItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user