Feat(LOY-421): Next Stay * feat(LOY-421): Next stay WIP * fix(LOY-421): clean upp css and jsx * chore(LOY-421): css cleanup * fix(LOY-421): fix test * only show button if isWebAppOrigin is true * chore(LOY-421): update section header component * chore(LOY-421): remove redundant test case Approved-by: Matilda Landström
29 lines
796 B
TypeScript
29 lines
796 B
TypeScript
import { serverClient } from "@/lib/trpc/server"
|
|
|
|
import { Section } from "@/components/Section"
|
|
import { SectionHeader } from "@/components/Section/Header"
|
|
import SectionLink from "@/components/Section/Link"
|
|
|
|
import NextStayContent from "./NextStayContent"
|
|
|
|
import styles from "./nextStay.module.css"
|
|
|
|
import type { NextStayProps } from "./types"
|
|
|
|
export default async function NextStay({ title, link }: NextStayProps) {
|
|
const caller = await serverClient()
|
|
const nextStay = await caller.user.stays.next()
|
|
|
|
if (!nextStay) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Section className={styles.container}>
|
|
{title && <SectionHeader heading={title} link={link} />}
|
|
<NextStayContent nextStay={nextStay} />
|
|
{link && <SectionLink link={link} variant="mobile" />}
|
|
</Section>
|
|
)
|
|
}
|