Files
web/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/index.tsx
Matilda Landström 22b0f71c16 Merged in chore(LOY-531)-cleanup-old-stays (pull request #3498)
chore(LOY-531): cleanup old stays

* chore(LOY-531): cleanup old stays


Approved-by: Emma Zettervall
Approved-by: Anton Gunnarsson
2026-01-28 07:45:05 +00:00

35 lines
1003 B
TypeScript

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 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 (!hasStays) return null
return (
<Section className={styles.container}>
{title && <SectionHeader heading={title} link={link} />}
<UpcomingStaysCarousel initialUpcomingStays={initialUpcomingStays} />
<SectionLink link={link} variant="mobile" />
</Section>
)
}