Skip to content

Commit

Permalink
Fix: conditionally render Map component based on pickupLocation coord…
Browse files Browse the repository at this point in the history
…inates
  • Loading branch information
aelassas committed Dec 31, 2024
1 parent 55dac7c commit 96f3665
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/pages/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,15 @@ const Checkout = () => {
<form onSubmit={handleSubmit}>
<div>

<Map
position={[pickupLocation.latitude || 34.0268755, pickupLocation.longitude || 1.6528399999999976]}
initialZoom={pickupLocation.latitude && pickupLocation.longitude ? 10 : 2.5}
parkingSpots={pickupLocation.parkingSpots}
locations={[pickupLocation]}
className="map"
/>
{pickupLocation.latitude && pickupLocation.longitude && (
<Map
position={[pickupLocation.latitude || 34.0268755, pickupLocation.longitude || 1.6528399999999976]}
initialZoom={pickupLocation.latitude && pickupLocation.longitude ? 10 : 2.5}
parkingSpots={pickupLocation.parkingSpots}
locations={[pickupLocation]}
className="map"
/>
)}

<CarList
cars={[car]}
Expand Down

0 comments on commit 96f3665

Please sign in to comment.