Files
web/components/MyPages/Blocks/Stays/Soonest/index.tsx
Niclas Edenvin e67212bd94 Merged in feature/refactor-lang (pull request #387)
feat: SW-238 Avoid prop drilling of lang

Approved-by: Michael Zetterberg
2024-08-14 11:00:20 +00:00

39 lines
1.1 KiB
TypeScript

import { serverClient } from "@/lib/trpc/server"
import SectionContainer from "@/components/Section/Container"
import SectionHeader from "@/components/Section/Header"
import SectionLink from "@/components/Section/Link"
import Grids from "@/components/TempDesignSystem/Grids"
import StayCard from "../StayCard"
import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function SoonestStays({
title,
subtitle,
link,
}: AccountPageComponentProps) {
const response = await serverClient().user.stays.upcoming({ limit: 3 })
if (!response?.data) {
return null
}
return (
<SectionContainer>
<SectionHeader title={title} subtitle={subtitle} link={link} />
{response.data.length ? (
<Grids.Stackable>
{response.data.map((stay) => (
<StayCard key={stay.attributes.confirmationNumber} stay={stay} />
))}
</Grids.Stackable>
) : (
<EmptyUpcomingStaysBlock />
)}
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}