mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:51:13 -05:00
Fix: Resolve type errors in homepage components
This commit is contained in:
@@ -112,11 +112,11 @@ export function DesignerCard({ company }: DesignerCardProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{company.average_rating > 0 && (
|
{company.average_rating && company.average_rating > 0 && (
|
||||||
<div className="inline-flex items-center gap-1">
|
<div className="inline-flex items-center gap-1">
|
||||||
<Star className="w-4 h-4 fill-yellow-500 text-yellow-500" />
|
<Star className="w-4 h-4 fill-yellow-500 text-yellow-500" />
|
||||||
<span className="font-semibold">{company.average_rating.toFixed(1)}</span>
|
<span className="font-semibold">{company.average_rating.toFixed(1)}</span>
|
||||||
{company.review_count > 0 && (
|
{company.review_count && company.review_count > 0 && (
|
||||||
<span className="text-muted-foreground">({company.review_count})</span>
|
<span className="text-muted-foreground">({company.review_count})</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export function FeaturedParks() {
|
|||||||
{/* Rating Badge */}
|
{/* Rating Badge */}
|
||||||
<Badge className="absolute top-3 right-3 bg-background/90 text-foreground border-0">
|
<Badge className="absolute top-3 right-3 bg-background/90 text-foreground border-0">
|
||||||
<Star className="w-3 h-3 mr-1 fill-yellow-400 text-yellow-400" />
|
<Star className="w-3 h-3 mr-1 fill-yellow-400 text-yellow-400" />
|
||||||
{park.average_rating.toFixed(1)}
|
{park.average_rating ? park.average_rating.toFixed(1) : 'N/A'}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function ManufacturerCard({ company }: ManufacturerCardProps) {
|
|||||||
<div className="aspect-[3/2] relative bg-gradient-to-br from-primary/20 via-primary/10 to-transparent overflow-hidden">
|
<div className="aspect-[3/2] relative bg-gradient-to-br from-primary/20 via-primary/10 to-transparent overflow-hidden">
|
||||||
{(company.card_image_url || company.card_image_id) ? (
|
{(company.card_image_url || company.card_image_id) ? (
|
||||||
<img
|
<img
|
||||||
src={company.card_image_url || getCloudflareImageUrl(company.card_image_id, 'card')}
|
src={company.card_image_url || (company.card_image_id ? getCloudflareImageUrl(company.card_image_id, 'card') : undefined)}
|
||||||
srcSet={company.card_image_id ? `
|
srcSet={company.card_image_id ? `
|
||||||
${getCloudflareImageUrl(company.card_image_id, 'cardthumb')} 600w,
|
${getCloudflareImageUrl(company.card_image_id, 'cardthumb')} 600w,
|
||||||
${getCloudflareImageUrl(company.card_image_id, 'card')} 1200w
|
${getCloudflareImageUrl(company.card_image_id, 'card')} 1200w
|
||||||
@@ -143,11 +143,11 @@ export function ManufacturerCard({ company }: ManufacturerCardProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{company.average_rating > 0 && (
|
{company.average_rating && company.average_rating > 0 && (
|
||||||
<div className="inline-flex items-center gap-1">
|
<div className="inline-flex items-center gap-1">
|
||||||
<Star className="w-4 h-4 fill-yellow-500 text-yellow-500" />
|
<Star className="w-4 h-4 fill-yellow-500 text-yellow-500" />
|
||||||
<span className="font-semibold">{company.average_rating.toFixed(1)}</span>
|
<span className="font-semibold">{company.average_rating.toFixed(1)}</span>
|
||||||
{company.review_count > 0 && (
|
{company.review_count && company.review_count > 0 && (
|
||||||
<span className="text-muted-foreground">({company.review_count})</span>
|
<span className="text-muted-foreground">({company.review_count})</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export interface Company {
|
|||||||
banner_image_id?: string | null;
|
banner_image_id?: string | null;
|
||||||
card_image_url?: string | null;
|
card_image_url?: string | null;
|
||||||
card_image_id?: string | null;
|
card_image_id?: string | null;
|
||||||
average_rating: number;
|
average_rating: number | null;
|
||||||
review_count: number;
|
review_count: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Park {
|
export interface Park {
|
||||||
@@ -52,10 +52,10 @@ export interface Park {
|
|||||||
banner_image_id?: string | null;
|
banner_image_id?: string | null;
|
||||||
card_image_url?: string | null;
|
card_image_url?: string | null;
|
||||||
card_image_id?: string | null;
|
card_image_id?: string | null;
|
||||||
average_rating: number;
|
average_rating: number | null;
|
||||||
review_count: number;
|
review_count: number | null;
|
||||||
ride_count: number;
|
ride_count: number | null;
|
||||||
coaster_count: number;
|
coaster_count: number | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
@@ -135,76 +135,76 @@ export interface Ride {
|
|||||||
description?: string | null;
|
description?: string | null;
|
||||||
park?: Park | { name: string; slug: string; location?: Location }; // Allow partial park data
|
park?: Park | { name: string; slug: string; location?: Location }; // Allow partial park data
|
||||||
ride_model?: RideModel;
|
ride_model?: RideModel;
|
||||||
manufacturer?: Company;
|
manufacturer?: Company | null;
|
||||||
designer?: Company;
|
designer?: Company | null;
|
||||||
category: string; // Allow any string from database
|
category: string; // Allow any string from database
|
||||||
ride_sub_type?: string; // Sub-category like "Flying Coaster", "Inverted Coaster", etc.
|
ride_sub_type?: string | null; // Sub-category like "Flying Coaster", "Inverted Coaster", etc.
|
||||||
status: string; // Allow any string from database
|
status: string; // Allow any string from database
|
||||||
opening_date?: string | null;
|
opening_date?: string | null;
|
||||||
opening_date_precision?: string | null;
|
opening_date_precision?: string | null;
|
||||||
closing_date?: string | null;
|
closing_date?: string | null;
|
||||||
closing_date_precision?: string | null;
|
closing_date_precision?: string | null;
|
||||||
height_requirement?: number;
|
height_requirement?: number | null;
|
||||||
age_requirement?: number;
|
age_requirement?: number | null;
|
||||||
capacity_per_hour?: number;
|
capacity_per_hour?: number | null;
|
||||||
duration_seconds?: number;
|
duration_seconds?: number | null;
|
||||||
max_speed_kmh?: number;
|
max_speed_kmh?: number | null;
|
||||||
max_height_meters?: number;
|
max_height_meters?: number | null;
|
||||||
length_meters?: number;
|
length_meters?: number | null;
|
||||||
inversions?: number;
|
inversions?: number | null;
|
||||||
technical_specifications?: RideTechnicalSpec[];
|
technical_specifications?: RideTechnicalSpec[];
|
||||||
coaster_statistics?: RideCoasterStat[];
|
coaster_statistics?: RideCoasterStat[];
|
||||||
name_history?: RideNameHistory[];
|
name_history?: RideNameHistory[];
|
||||||
average_rating: number;
|
average_rating: number | null;
|
||||||
review_count: number;
|
review_count: number | null;
|
||||||
image_url?: string;
|
image_url?: string | null;
|
||||||
banner_image_url?: string;
|
banner_image_url?: string | null;
|
||||||
banner_image_id?: string;
|
banner_image_id?: string | null;
|
||||||
card_image_url?: string;
|
card_image_url?: string | null;
|
||||||
card_image_id?: string;
|
card_image_id?: string | null;
|
||||||
// Roller coaster specific fields
|
// Roller coaster specific fields
|
||||||
coaster_type?: string;
|
coaster_type?: string | null;
|
||||||
seating_type?: string;
|
seating_type?: string | null;
|
||||||
intensity_level?: string;
|
intensity_level?: string | null;
|
||||||
track_material?: string[];
|
track_material?: string[] | null;
|
||||||
support_material?: string[];
|
support_material?: string[] | null;
|
||||||
propulsion_method?: string[];
|
propulsion_method?: string[] | null;
|
||||||
drop_height_meters?: number;
|
drop_height_meters?: number | null;
|
||||||
max_g_force?: number;
|
max_g_force?: number | null;
|
||||||
// Water ride specific fields
|
// Water ride specific fields
|
||||||
water_depth_cm?: number;
|
water_depth_cm?: number | null;
|
||||||
splash_height_meters?: number;
|
splash_height_meters?: number | null;
|
||||||
wetness_level?: string;
|
wetness_level?: string | null;
|
||||||
flume_type?: string;
|
flume_type?: string | null;
|
||||||
boat_capacity?: number;
|
boat_capacity?: number | null;
|
||||||
// Dark ride specific fields
|
// Dark ride specific fields
|
||||||
theme_name?: string;
|
theme_name?: string | null;
|
||||||
story_description?: string;
|
story_description?: string | null;
|
||||||
show_duration_seconds?: number;
|
show_duration_seconds?: number | null;
|
||||||
animatronics_count?: number;
|
animatronics_count?: number | null;
|
||||||
projection_type?: string;
|
projection_type?: string | null;
|
||||||
ride_system?: string;
|
ride_system?: string | null;
|
||||||
scenes_count?: number;
|
scenes_count?: number | null;
|
||||||
// Flat ride specific fields
|
// Flat ride specific fields
|
||||||
rotation_type?: string;
|
rotation_type?: string | null;
|
||||||
motion_pattern?: string;
|
motion_pattern?: string | null;
|
||||||
platform_count?: number;
|
platform_count?: number | null;
|
||||||
swing_angle_degrees?: number;
|
swing_angle_degrees?: number | null;
|
||||||
rotation_speed_rpm?: number;
|
rotation_speed_rpm?: number | null;
|
||||||
arm_length_meters?: number;
|
arm_length_meters?: number | null;
|
||||||
max_height_reached_meters?: number;
|
max_height_reached_meters?: number | null;
|
||||||
// Kiddie ride specific fields
|
// Kiddie ride specific fields
|
||||||
min_age?: number;
|
min_age?: number | null;
|
||||||
max_age?: number;
|
max_age?: number | null;
|
||||||
educational_theme?: string;
|
educational_theme?: string | null;
|
||||||
character_theme?: string;
|
character_theme?: string | null;
|
||||||
// Transportation specific fields
|
// Transportation specific fields
|
||||||
transport_type?: string;
|
transport_type?: string | null;
|
||||||
route_length_meters?: number;
|
route_length_meters?: number | null;
|
||||||
stations_count?: number;
|
stations_count?: number | null;
|
||||||
vehicle_capacity?: number;
|
vehicle_capacity?: number | null;
|
||||||
vehicles_count?: number;
|
vehicles_count?: number | null;
|
||||||
round_trip_duration_seconds?: number;
|
round_trip_duration_seconds?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Profile {
|
export interface Profile {
|
||||||
|
|||||||
Reference in New Issue
Block a user