mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 10:51:13 -05:00
Fix: Resolve internal server error
This commit is contained in:
@@ -62,7 +62,7 @@ export function ParkCard({ park }: ParkCardProps) {
|
||||
<div className="aspect-[3/2] bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 flex items-center justify-center relative">
|
||||
{(park.card_image_url || park.card_image_id) ? (
|
||||
<img
|
||||
src={park.card_image_url || getCloudflareImageUrl(park.card_image_id, 'card')}
|
||||
src={park.card_image_url || getCloudflareImageUrl(park.card_image_id || '', 'card')}
|
||||
srcSet={park.card_image_id ? `
|
||||
${getCloudflareImageUrl(park.card_image_id, 'cardthumb')} 600w,
|
||||
${getCloudflareImageUrl(park.card_image_id, 'card')} 1200w
|
||||
@@ -111,7 +111,7 @@ export function ParkCard({ park }: ParkCardProps) {
|
||||
{/* Stats & Rating */}
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<div className="flex items-center gap-3">
|
||||
{park.ride_count > 0 && (
|
||||
{(park.ride_count != null && park.ride_count > 0) && (
|
||||
<div className="flex items-center gap-1">
|
||||
<FerrisWheel className="w-4 h-4 text-primary/70 flex-shrink-0" />
|
||||
<span className="font-medium">{park.ride_count}</span>
|
||||
@@ -120,11 +120,11 @@ export function ParkCard({ park }: ParkCardProps) {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{park.average_rating > 0 && (
|
||||
{(park.average_rating != null && park.average_rating > 0) && (
|
||||
<div className="inline-flex items-center gap-1">
|
||||
<Star className="w-4 h-4 fill-yellow-500 text-yellow-500" />
|
||||
<span className="font-semibold">{park.average_rating.toFixed(1)}</span>
|
||||
{park.review_count > 0 && (
|
||||
{(park.review_count != null && park.review_count > 0) && (
|
||||
<span className="text-muted-foreground">({park.review_count})</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -65,12 +65,12 @@ export function ParkFilters({ filters, onFiltersChange, parks }: ParkFiltersProp
|
||||
}, [locations]);
|
||||
|
||||
const stateOptions: MultiSelectOption[] = useMemo(() => {
|
||||
const states = new Set(locations?.map(l => l.state_province).filter(Boolean) || []);
|
||||
const states = new Set(locations?.map(l => l.state_province).filter((s): s is string => s != null) || []);
|
||||
return Array.from(states).sort().map(s => ({ label: s, value: s }));
|
||||
}, [locations]);
|
||||
|
||||
const cityOptions: MultiSelectOption[] = useMemo(() => {
|
||||
const cities = new Set(locations?.map(l => l.city).filter(Boolean) || []);
|
||||
const cities = new Set(locations?.map(l => l.city).filter((c): c is string => c != null) || []);
|
||||
return Array.from(cities).sort().map(c => ({ label: c, value: c }));
|
||||
}, [locations]);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ export function ParkListView({ parks, onParkClick }: ParkListViewProps) {
|
||||
</div>
|
||||
|
||||
{/* Rating */}
|
||||
{park.average_rating > 0 && (
|
||||
{(park.average_rating != null && park.average_rating > 0) && (
|
||||
<div className="flex items-center gap-1.5 ml-4 flex-shrink-0 bg-yellow-400/10 px-3 py-1.5 rounded-full group-hover:bg-yellow-400/20 transition-colors duration-300">
|
||||
<Star className="w-4 h-4 fill-yellow-400 text-yellow-400" />
|
||||
<span className="font-semibold text-foreground">{park.average_rating.toFixed(1)}</span>
|
||||
@@ -149,7 +149,7 @@ export function ParkListView({ parks, onParkClick }: ParkListViewProps) {
|
||||
<span className="text-accent font-semibold">{park.coaster_count || 0}</span>
|
||||
<span className="text-muted-foreground text-xs">coasters</span>
|
||||
</div>
|
||||
{park.review_count > 0 && (
|
||||
{(park.review_count != null && park.review_count > 0) && (
|
||||
<div className="flex items-center gap-1.5 group/stat">
|
||||
<Users className="w-3.5 h-3.5 text-muted-foreground group-hover/stat:text-foreground transition-colors duration-300" />
|
||||
<span className="text-muted-foreground text-xs">{park.review_count} reviews</span>
|
||||
|
||||
Reference in New Issue
Block a user