Files
web/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx

39 lines
1.1 KiB
TypeScript

import { serverClient } from "@/lib/trpc/server"
import ClaimPoints from "@/components/Blocks/DynamicContent/Points/ClaimPoints"
import SectionContainer from "@/components/Section/Container"
import SectionHeader from "@/components/Section/Header"
import SectionLink from "@/components/Section/Link"
import ClientPreviousStays from "./Client"
import styles from "./previous.module.css"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function PreviousStays({
title,
link,
}: AccountPageComponentProps) {
const caller = await serverClient()
const initialPreviousStays = await caller.user.stays.previous({
limit: 6,
})
if (!initialPreviousStays?.data.length) {
return null
}
return (
<SectionContainer>
<div className={styles.header}>
<SectionHeader title={title} link={link} />
<ClaimPoints />
</div>
<ClientPreviousStays initialPreviousStays={initialPreviousStays} />
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}