Files
web/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx
Matilda Landström 22b0f71c16 Merged in chore(LOY-531)-cleanup-old-stays (pull request #3498)
chore(LOY-531): cleanup old stays

* chore(LOY-531): cleanup old stays


Approved-by: Emma Zettervall
Approved-by: Anton Gunnarsson
2026-01-28 07:45:05 +00:00

41 lines
1.2 KiB
TypeScript

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 { INITIAL_STAYS_FETCH_LIMIT } from "./data"
import { L6Progress } from "./L6Progress"
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
}
return (
<Section>
<div className={styles.header}>
<SectionHeader heading={title ?? undefined} link={link} />
<ClaimPoints />
</div>
<L6Progress />
<Cards initialPreviousStays={initialPreviousStays} />
<SectionLink link={link} variant="mobile" />
</Section>
)
}