mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 18:51:13 -05:00
Refactor park detail address display
Implement the plan to refactor the address display in the park detail page. This includes updating the sidebar address to show the street address on its own line, followed by city, state, and postal code on the next line, and the country on a separate line. This change aims to create a more compact and natural address format.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Star, TrendingUp, Award, Castle, FerrisWheel, Waves, Tent, LucideIcon } from 'lucide-react';
|
||||
import { formatLocationShort } from '@/lib/locationFormatter';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -82,7 +83,7 @@ export function FeaturedParks() {
|
||||
|
||||
{park.location && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{park.location.city}, {park.location.country}
|
||||
{formatLocationShort(park.location)}
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
||||
@@ -109,9 +109,11 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
<span className="text-sm font-semibold text-foreground">Location</span>
|
||||
</div>
|
||||
<div className="text-sm space-y-1 ml-6">
|
||||
{location.street_address && <div><span className="text-muted-foreground">Street:</span> <span className="font-medium">{location.street_address}</span></div>}
|
||||
{location.city && <div><span className="text-muted-foreground">City:</span> <span className="font-medium">{location.city}</span></div>}
|
||||
{location.state_province && <div><span className="text-muted-foreground">State/Province:</span> <span className="font-medium">{location.state_province}</span></div>}
|
||||
{location.country && <div><span className="text-muted-foreground">Country:</span> <span className="font-medium">{location.country}</span></div>}
|
||||
{location.postal_code && <div><span className="text-muted-foreground">Postal Code:</span> <span className="font-medium">{location.postal_code}</span></div>}
|
||||
{location.formatted_address && (
|
||||
<div className="text-xs text-muted-foreground mt-2">{location.formatted_address}</div>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { MapPin, Star, Users, Clock, Castle, FerrisWheel, Waves, Tent } from 'lucide-react';
|
||||
import { formatLocationShort } from '@/lib/locationFormatter';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -102,7 +103,7 @@ export function ParkCard({ park }: ParkCardProps) {
|
||||
<div className="flex items-center gap-1 text-sm text-muted-foreground min-w-0">
|
||||
<MapPin className="w-3 h-3 flex-shrink-0" />
|
||||
<span className="truncate">
|
||||
{park.location.city && `${park.location.city}, `}{park.location.country}
|
||||
{formatLocationShort(park.location)}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useDebouncedValue } from '@/hooks/useDebouncedValue';
|
||||
import { useGlobalSearch } from '@/hooks/search/useGlobalSearch';
|
||||
import { formatLocationShort } from '@/lib/locationFormatter';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -87,7 +88,7 @@ export function SearchResults({ query, onClose }: SearchResultsProps) {
|
||||
switch (result.type) {
|
||||
case 'park':
|
||||
const park = result.data as Park;
|
||||
return park.location ? `${park.location.city}, ${park.location.country}` : 'Theme Park';
|
||||
return park.location ? formatLocationShort(park.location) : 'Theme Park';
|
||||
case 'ride':
|
||||
const ride = result.data as Ride;
|
||||
return ride.park && typeof ride.park === 'object' && 'name' in ride.park
|
||||
|
||||
Reference in New Issue
Block a user