feat: add SoonestStays
This commit is contained in:
35
components/MyPages/Blocks/Stays/Soonest/index.tsx
Normal file
35
components/MyPages/Blocks/Stays/Soonest/index.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Header from "../Header"
|
||||
import StayList from "../StayList"
|
||||
import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays"
|
||||
|
||||
import styles from "./soonest.module.css"
|
||||
|
||||
type UpcomingStaysProps = {
|
||||
lang: Lang
|
||||
title: string
|
||||
subtitle?: string
|
||||
link: { text: string; href: string } | null
|
||||
}
|
||||
|
||||
export default async function UpcomingStays({
|
||||
lang,
|
||||
title,
|
||||
subtitle,
|
||||
link,
|
||||
}: UpcomingStaysProps) {
|
||||
const stays = await serverClient().user.stays.soonestUpcoming()
|
||||
|
||||
return (
|
||||
<section className={styles.container}>
|
||||
<Header title={title} subtitle={subtitle} link={link}></Header>
|
||||
{stays.length ? (
|
||||
<StayList lang={lang} stays={stays} />
|
||||
) : (
|
||||
<EmptyUpcomingStaysBlock />
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user