Files
web/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx
Chuma Mcphoy (We Ahead) 30b9d14fb0 Merged in feat/LOY-424-Sidepeek-Past-Stays (pull request #3270)
feat(LOY-424): Load More Past Stays via Sidepeek

* feat(LOY-424): Load More Past Stays via Sidepeek

* chore(LOY-424): use new section header

* fix(LOY-424): remove uneeded nextCursor check


Approved-by: Emma Zettervall
2025-12-03 15:19:25 +00:00

43 lines
1.3 KiB
TypeScript

import { env } from "@/env/server"
import { serverClient } from "@/lib/trpc/server"
import ClaimPoints from "@/components/Blocks/DynamicContent/Points/ClaimPoints"
import { Section } from "@/components/Section"
import { SectionHeader } from "@/components/Section/Header"
import SectionLink from "@/components/Section/Link"
import { Cards } from "./Cards"
import { ClientPreviousStays } from "./Client"
import { INITIAL_STAYS_FETCH_LIMIT } from "./data"
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: INITIAL_STAYS_FETCH_LIMIT,
})
if (!initialPreviousStays?.data.length) {
return null
}
const StaysComponent = env.NEW_STAYS_ON_MY_PAGES ? Cards : ClientPreviousStays
return (
<Section>
<div className={styles.header}>
<SectionHeader heading={title ?? undefined} link={link} />
<ClaimPoints />
</div>
<StaysComponent initialPreviousStays={initialPreviousStays} />
<SectionLink link={link} variant="mobile" />
</Section>
)
}