Merged in LOY-493/Sidepeek-upcoming-stays (pull request #3315)
LOY-493/Sidepeek upcoming stays * chore(LOY-493): Add icon to next stay card cta * chore(LOY-493): better folder org for stays * chore(LOY-494): more folder reorg * feat(LOY-493): Implement Sidepeek for Upcoming Stays Approved-by: Matilda Landström
This commit is contained in:
@@ -14,6 +14,7 @@ export const staysInput = z
|
||||
.transform((num) => (num ? String(num) : undefined)),
|
||||
limit: z.number().min(0).default(6),
|
||||
lang: z.nativeEnum(Lang).optional(),
|
||||
includeFirstStay: z.boolean().optional(),
|
||||
})
|
||||
.default({})
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ export const userQueryRouter = router({
|
||||
upcoming: languageProtectedProcedure
|
||||
.input(staysInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { limit, cursor, lang } = input
|
||||
const { limit, cursor, lang, includeFirstStay } = input
|
||||
const language = lang || ctx.lang
|
||||
|
||||
const data = await getUpcomingStays(
|
||||
@@ -186,6 +186,14 @@ export const userQueryRouter = router({
|
||||
)
|
||||
|
||||
if (env.NEW_STAYS_ON_MY_PAGES) {
|
||||
// When includeFirstStay is true (used by SidePeek), return all stays
|
||||
if (includeFirstStay) {
|
||||
return {
|
||||
data: updatedData,
|
||||
nextCursor,
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedData.length <= 1) {
|
||||
// If there are 1 or fewer stays, return null since NextStay handles this
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user