From df38a718b50fd2a1987df1b4e57e27512ff6bb19 Mon Sep 17 00:00:00 2001 From: Christel Westerberg Date: Thu, 5 Sep 2024 08:02:48 +0200 Subject: [PATCH] fix(SW-366): add nights to next level --- .../Overview/Stats/Points/PointsColumn/index.tsx | 5 +++-- .../MyPages/Blocks/Overview/Stats/Points/index.tsx | 13 ++++++++++++- server/routers/user/output.ts | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/MyPages/Blocks/Overview/Stats/Points/PointsColumn/index.tsx b/components/MyPages/Blocks/Overview/Stats/Points/PointsColumn/index.tsx index 6ae2d39cd..528ec9ee2 100644 --- a/components/MyPages/Blocks/Overview/Stats/Points/PointsColumn/index.tsx +++ b/components/MyPages/Blocks/Overview/Stats/Points/PointsColumn/index.tsx @@ -39,12 +39,13 @@ export const StayOnLevelColumn = ({ points, subtitleParam }: PointsColumn) => export const NextLevelNightsColumn = ({ nights, subtitleParam, + subtitle = "by", }: NightsColumn) => PointsColumn({ nights, title: "Nights needed to level up", subtitleParam, - subtitle: "by", + subtitle, }) async function PointsColumn({ @@ -72,7 +73,7 @@ async function PointsColumn({ {points ?? nights ?? "N/A"} - {formatMessage({ id: subtitle })} {subtitleParam} + {subtitle ? formatMessage({ id: subtitle }) : ""} {subtitleParam} ) diff --git a/components/MyPages/Blocks/Overview/Stats/Points/index.tsx b/components/MyPages/Blocks/Overview/Stats/Points/index.tsx index d25a77ef1..88b8db06c 100644 --- a/components/MyPages/Blocks/Overview/Stats/Points/index.tsx +++ b/components/MyPages/Blocks/Overview/Stats/Points/index.tsx @@ -5,7 +5,11 @@ import { getMembershipLevelObject } from "@/utils/membershipLevel" import { getMembership } from "@/utils/user" import PointsContainer from "./Container" -import { NextLevelPointsColumn, YourPointsColumn } from "./PointsColumn" +import { + NextLevelNightsColumn, + NextLevelPointsColumn, + YourPointsColumn, +} from "./PointsColumn" import { UserProps } from "@/types/components/myPages/user" @@ -25,6 +29,13 @@ export default async function Points({ user }: UserProps) { subtitleParam={nextLevel.name} /> )} + {membership?.nightsToTopTier && ( + + )} ) } diff --git a/server/routers/user/output.ts b/server/routers/user/output.ts index 6b5c2925c..1ffa16743 100644 --- a/server/routers/user/output.ts +++ b/server/routers/user/output.ts @@ -24,9 +24,11 @@ export const getUserSchema = z.object({ memberSince: z.string(), membershipType: z.string(), nextLevel: z.string().optional(), + nightsToTopTier: z.number().optional(), pointsExpiryDate: z.string().optional(), pointsRequiredToNextlevel: z.number().optional(), pointsToExpire: z.number().optional(), + tierExpirationDate: z.string().optional(), }) ), phoneNumber: z.string().optional(),