Files
web/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx
Chuma Mcphoy (We Ahead) ac53f128af Merged in feat/LOY-423-Nights-Stayed-Progress-for-L6-Members (pull request #3360)
feat(LOY-423): Add progress bar for L6 members showing nights stayed

* feat(LOY-423): Add progress bar for L6 members showing nights stayed

* chore(LOY-423): shorten css selector


Approved-by: Matilda Landström
2025-12-17 10:45:30 +00:00

45 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 { INITIAL_STAYS_FETCH_LIMIT } from "./data"
import { L6Progress } from "./L6Progress"
import { ClientPreviousStays } from "./OldClient"
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>
<L6Progress />
<StaysComponent initialPreviousStays={initialPreviousStays} />
<SectionLink link={link} variant="mobile" />
</Section>
)
}