From 8ad18cf7eb90fa096e474f7364d0bab2eaaca5dc Mon Sep 17 00:00:00 2001 From: aryabenade Date: Wed, 15 Apr 2026 19:25:29 +0530 Subject: [PATCH] show logo image and city on the basis of city selected --- src/components/CitySelectionDialog.tsx | 2 +- src/components/MelbourneCardComparison.tsx | 16 +++++------ src/components/Navbar.tsx | 33 +++++++++++----------- src/pages/AttractionsPage.tsx | 2 +- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/components/CitySelectionDialog.tsx b/src/components/CitySelectionDialog.tsx index e087e4e..d478f84 100644 --- a/src/components/CitySelectionDialog.tsx +++ b/src/components/CitySelectionDialog.tsx @@ -48,7 +48,7 @@ export function CitySelectionDialog({ // onCitySelect(String(city.cityName)); // navigate(`/${city.cityName}/${city.id}`) - navigate(`/${slugify(city.cityName)}/${city.id}`); + navigate(`/${slugify(city.cityName)}`); localStorage.setItem("cityId", String(city.id)) localStorage.setItem("cityName", String(city.cityName)) } else { diff --git a/src/components/MelbourneCardComparison.tsx b/src/components/MelbourneCardComparison.tsx index 5258954..5f5c6eb 100644 --- a/src/components/MelbourneCardComparison.tsx +++ b/src/components/MelbourneCardComparison.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Check, X, Star, Users, MapPin, Calendar, Clock, Zap, Eye } from 'lucide-react'; import { Button } from './ui/button'; import { motion } from 'motion/react'; @@ -74,7 +74,7 @@ interface MelbourneCardComparisonProps { cards: any[] } -export function MelbourneCardComparison({ onCheckoutClick,cards }: MelbourneCardComparisonProps) { +export function MelbourneCardComparison({ onCheckoutClick, cards }: MelbourneCardComparisonProps) { const [selectedCard, setSelectedCard] = useState('unlimited'); const cardOptions = [ @@ -199,8 +199,8 @@ export function MelbourneCardComparison({ onCheckoutClick,cards }: MelbourneCard
Features
- {cardOptions.map((card) => ( -
+ {cardOptions.map((card,index) => ( +
{card.name}
@@ -228,8 +228,8 @@ export function MelbourneCardComparison({ onCheckoutClick,cards }: MelbourneCard {feature.label}
- {cardOptions.map((card) => ( -
+ {cardOptions.map((card, index) => ( +
{renderFeatureValue(card.features[feature.key as keyof typeof card.features], card.id)}
))} @@ -245,8 +245,8 @@ export function MelbourneCardComparison({ onCheckoutClick,cards }: MelbourneCard
Compare features above
- {cardOptions.map((card) => ( - + {cardOptions.map((card,index) => ( +
{card.priceRange}
{card.duration}
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 9190dfc..5568776 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -89,9 +89,13 @@ export default function Navbar({ const [lastKnownCity, setLastKnownCity] = useState<'landing' | 'melbourne'>('landing'); const [isLoginOpen, setLoginOpen] = useState(false); - const { user, login, logout } = useAuth(); // from AuthContext + const { user, logout } = useAuth(); // from AuthContext - const cityLogo = sessionStorage.getItem("cityLogo") || "" + const cityLogo = sessionStorage.getItem("cityLogo") + const cityId = localStorage.getItem("cityId") + const cityName = localStorage.getItem("cityName") + + const citySelected = location.pathname.includes(slugify(cityName) || "") const baseUrl = import.meta.env.VITE_BASE_URL; @@ -108,8 +112,6 @@ export default function Navbar({ } }; - const cityId = localStorage.getItem("cityId") - const cityName = localStorage.getItem("cityName") // More flexible navigation configuration const navigationConfig = { @@ -160,25 +162,25 @@ export default function Navbar({ // Position 1 { label: 'Attractions', - path: `/${slugify(cityName)}/${cityId}/attractions`, + path: `/${slugify(cityName)}/attractions`, isShared: false }, // Position 2 { label: 'Magic Itinerary', - path: '/magic-itinerary', + path: `/${slugify(cityName)}/magic-itinerary`, isShared: false }, // Position 3 { label: 'Super Savings', - path: '/super-savings', + path: `/${slugify(cityName)}/super-savings`, isShared: false }, // Position 4 - Shared item { label: 'How It Works', - path: '/how-it-works', + path: `/${slugify(cityName)}/how-it-works`, isShared: true, landingLabel: 'Discover', melbourneLabel: 'How It Works' @@ -186,14 +188,14 @@ export default function Navbar({ // Position 5 - Shared item { label: 'Your Card', - path: '/passes', + path: `/${slugify(cityName)}/passes`, isShared: true, landingLabel: 'Your Card', melbourneLabel: 'Your Card' }, { label: 'Your Postcard', - path: '/postcards', + path: `/${slugify(cityName)}/postcards`, isShared: true, landingLabel: 'Your Postcard', melbourneLabel: 'Your Postcard' @@ -201,9 +203,6 @@ export default function Navbar({ ] }; - // Check if we're on landing page - const isLandingPage = location.pathname === '/'; - // Restore from session on mount useEffect(() => { const savedCity = sessionStorage.getItem('lastKnownCity'); @@ -565,9 +564,9 @@ export default function Navbar({ whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }} > - + @@ -691,7 +690,7 @@ export default function Navbar({ label: 'My Profile', icon: , action: () => { - navigate('/profile'); + navigate(citySelected?`/${slugify(cityName)}/profile`:'/profile'); setActiveUserDropdown(false); } }, diff --git a/src/pages/AttractionsPage.tsx b/src/pages/AttractionsPage.tsx index 4cf6cc6..b8d3d8c 100644 --- a/src/pages/AttractionsPage.tsx +++ b/src/pages/AttractionsPage.tsx @@ -49,7 +49,7 @@ export function AttractionsPage({ const [selectedCategory, setSelectedCategory] = useState(null); const [selectedPassType, setSelectedPassType] = useState(null); - const { cityId } = useParams() + const cityId = localStorage.getItem("cityId") const cityName = localStorage.getItem("cityName") console.log(cityName)