feat: add SoonestStays

This commit is contained in:
Arvid Norlin
2024-04-22 13:34:57 +02:00
parent fc28e09df5
commit dff21b33cd
21 changed files with 235 additions and 107 deletions

View File

@@ -1,5 +1,6 @@
"use client"
import { Lang } from "@/constants/languages"
import { _ } from "@/lib/translation"
import { trpc } from "@/lib/trpc/client"
@@ -11,9 +12,20 @@ import StayList from "../StayList"
import EmptyPreviousStaysBlock from "./EmptyPreviousStays"
import type { Page } from "@/types/components/myPages/myStays/page"
import type { LangParams } from "@/types/params"
export default function PreviousStays({ lang }: LangParams) {
type PreviousStaysProps = {
lang: Lang
title: string
subtitle?: string
link: { href: string; text: string } | null
}
export default function PreviousStays({
lang,
title,
subtitle,
link,
}: PreviousStaysProps) {
const { data, isFetching, fetchNextPage, hasNextPage } =
trpc.user.stays.previous.useInfiniteQuery(
{},
@@ -28,12 +40,8 @@ export default function PreviousStays({ lang }: LangParams) {
return (
<Container>
<Header
title={_("Previous stays")}
subtitle={_(
"Revisit your stays and rekindle those our moments together, with ease."
)}
/>
<Header title={title} subtitle={subtitle} link={link} />
{data?.pages.length ? (
<ListContainer>
<StayList