From ecd2fb2719e3ee430a5e918a95e348d05e729d09 Mon Sep 17 00:00:00 2001 From: aryabenade Date: Fri, 24 Apr 2026 13:52:56 +0530 Subject: [PATCH] add optional operators to prevent crashing when no cards for a city --- src/pages/PassesPage.tsx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/pages/PassesPage.tsx b/src/pages/PassesPage.tsx index 171ca2e..17a978c 100644 --- a/src/pages/PassesPage.tsx +++ b/src/pages/PassesPage.tsx @@ -227,10 +227,10 @@ export function PassesPage({ - {cards[0].title} + {cards[0]?.title} - {cards[0].description} + {cards[0]?.description} @@ -238,23 +238,23 @@ export function PassesPage({
- ${cards[0].adultPrice} + ${cards[0]?.adultPrice} / {passTypes[0].period}
- {cards[0].adultPrice && ( + {cards[0]?.adultPrice && (
{/* Strikethrough price = originalPrice + $5 */} - ${parseFloat(cards[0].adultPrice) + 5} + ${parseFloat(cards[0]?.adultPrice) + 5} Save{" "} {Math.round( - ((5) / (parseFloat(cards[0].adultPrice) + 5)) * 100 + ((5) / (parseFloat(cards[0]?.adultPrice) + 5)) * 100 )} % @@ -299,14 +299,14 @@ export function PassesPage({ {/* Unlimited Pass Card */}
setSelectedPass(passTypes[1].id)} + onClick={() => setSelectedPass(passTypes[1]?.id)} > - {passTypes[1].popular && ( + {passTypes[1]?.popular && (
Most Popular @@ -320,30 +320,30 @@ export function PassesPage({ - {cards[1].title} + {cards[1]?.title} - {cards[1].description} + {cards[1]?.description} {/* Pricing */}
- ${cards[1].adultPrice} - / {passTypes[1].period} + ${cards[1]?.adultPrice} + / {passTypes[1]?.period}
- {cards[1].adultPrice && ( + {cards[1]?.adultPrice && (
{/* Strikethrough price = originalPrice + $5 */} - ${parseFloat(cards[1].adultPrice) + 5} + ${parseFloat(cards[1]?.adultPrice) + 5} Save{" "} {Math.round( - ((5) / (parseFloat(cards[1].adultPrice) + 5)) * 100 + ((5) / (parseFloat(cards[1]?.adultPrice) + 5)) * 100 )} % @@ -355,7 +355,7 @@ export function PassesPage({
- {passTypes[1].features.map((feature, index) => ( + {passTypes[1]?.features.map((feature, index) => (
{feature}