Files
web/components/MyPages/Blocks/Stays/Soonest/index.tsx
2024-06-14 08:29:36 +02:00

40 lines
1.0 KiB
TypeScript

import { serverClient } from "@/lib/trpc/server"
import Header from "@/components/SectionHeader"
import Grids from "@/components/TempDesignSystem/Grids"
import StayCard from "../StayCard"
import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays"
import styles from "./soonest.module.css"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function SoonestStays({
lang,
title,
subtitle,
link,
}: AccountPageComponentProps) {
const { data: stays } = await serverClient().user.stays.upcoming({ limit: 3 })
return (
<section className={styles.container}>
<Header title={title} subtitle={subtitle} link={link} />
{stays.length ? (
<Grids.Stackable>
{stays.map((stay) => (
<StayCard
key={stay.attributes.confirmationNumber}
lang={lang}
stay={stay}
/>
))}
</Grids.Stackable>
) : (
<EmptyUpcomingStaysBlock />
)}
</section>
)
}