Merged in LOY-493/Sidepeek-upcoming-stays (pull request #3315)
LOY-493/Sidepeek upcoming stays * chore(LOY-493): Add icon to next stay card cta * chore(LOY-493): better folder org for stays * chore(LOY-494): more folder reorg * feat(LOY-493): Implement Sidepeek for Upcoming Stays Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { env } from "@/env/server"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { Section } from "@/components/Section"
|
||||
import { SectionHeader } from "@/components/Section/Header"
|
||||
import SectionLink from "@/components/Section/Link"
|
||||
|
||||
import UpcomingStaysCarousel from "./Carousel"
|
||||
import EmptyUpcomingStays from "./EmptyUpcomingStays"
|
||||
import ClientUpcomingStays from "./OldClient"
|
||||
|
||||
import styles from "./upcoming.module.css"
|
||||
|
||||
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
|
||||
|
||||
export default async function UpcomingStays({
|
||||
title,
|
||||
link,
|
||||
}: AccountPageComponentProps) {
|
||||
const caller = await serverClient()
|
||||
const initialUpcomingStays = await caller.user.stays.upcoming({
|
||||
limit: 6,
|
||||
})
|
||||
|
||||
const hasStays =
|
||||
initialUpcomingStays?.data && initialUpcomingStays.data.length > 0
|
||||
|
||||
if (env.NEW_STAYS_ON_MY_PAGES) {
|
||||
if (!hasStays) return null
|
||||
|
||||
return (
|
||||
<Section className={styles.container}>
|
||||
{title && <SectionHeader heading={title} link={link} />}
|
||||
<UpcomingStaysCarousel initialUpcomingStays={initialUpcomingStays} />
|
||||
<SectionLink link={link} variant="mobile" />
|
||||
</Section>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Section className={styles.container}>
|
||||
{title && <SectionHeader heading={title} link={link} />}
|
||||
{hasStays ? (
|
||||
<ClientUpcomingStays initialUpcomingStays={initialUpcomingStays} />
|
||||
) : (
|
||||
<EmptyUpcomingStays />
|
||||
)}
|
||||
<SectionLink link={link} variant="mobile" />
|
||||
</Section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user