Fix: Resolve TypeScript errors in pages

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 02:59:07 +00:00
parent 88403f04f5
commit 3c13b7a9f4
8 changed files with 57 additions and 55 deletions

View File

@@ -50,9 +50,9 @@ export default function OperatorDetail() {
// Update Open Graph meta tags
useOpenGraph({
title: operator?.name || '',
description: operator?.description || (operator ? `${operator.name} - Park Operator${operator.headquarters_location ? ` based in ${operator.headquarters_location}` : ''}` : ''),
imageUrl: operator?.banner_image_url,
imageId: operator?.banner_image_id,
description: operator?.description ?? (operator ? `${operator.name} - Park Operator${operator.headquarters_location ? ` based in ${operator.headquarters_location}` : ''}` : undefined),
imageUrl: operator?.banner_image_url ?? undefined,
imageId: operator?.banner_image_id ?? undefined,
type: 'profile',
enabled: !!operator
});
@@ -75,7 +75,7 @@ export default function OperatorDetail() {
const { data, error } = await supabase
.from('companies')
.select('*')
.eq('slug', slug)
.eq('slug', slug || '')
.eq('company_type', 'operator')
.maybeSingle();
@@ -242,10 +242,10 @@ export default function OperatorDetail() {
<picture>
<source
media="(max-width: 768px)"
srcSet={getBannerUrls(operator.banner_image_id).mobile || operator.banner_image_url}
srcSet={getBannerUrls(operator.banner_image_id ?? undefined).mobile ?? operator.banner_image_url ?? undefined}
/>
<img
src={getBannerUrls(operator.banner_image_id).desktop || operator.banner_image_url}
src={getBannerUrls(operator.banner_image_id ?? undefined).desktop ?? operator.banner_image_url ?? undefined}
alt={operator.name}
className="w-full h-full object-cover"
loading="eager"
@@ -289,12 +289,12 @@ export default function OperatorDetail() {
</div>
</div>
{operator.average_rating > 0 && (
{(operator.average_rating ?? 0) > 0 && (
<div className="bg-black/30 backdrop-blur-md rounded-lg p-6 text-center">
<div className="flex items-center gap-2 text-white mb-2">
<Star className="w-6 h-6 fill-yellow-400 text-yellow-400" />
<span className="text-3xl font-bold">
{operator.average_rating.toFixed(1)}
{(operator.average_rating ?? 0).toFixed(1)}
</span>
</div>
<div className="text-white/90 text-sm">
@@ -447,14 +447,14 @@ export default function OperatorDetail() {
id: operator.id,
name: operator.name,
slug: operator.slug,
description: operator.description,
description: operator.description ?? undefined,
company_type: 'operator',
person_type: (operator.person_type || 'company') as 'company' | 'individual' | 'firm' | 'organization',
website_url: operator.website_url,
founded_year: operator.founded_year,
headquarters_location: operator.headquarters_location,
banner_image_url: operator.banner_image_url,
card_image_url: operator.card_image_url
website_url: operator.website_url ?? undefined,
founded_year: operator.founded_year ?? undefined,
headquarters_location: operator.headquarters_location ?? undefined,
banner_image_url: operator.banner_image_url ?? undefined,
card_image_url: operator.card_image_url ?? undefined
}}
onSubmit={handleEditSubmit}
onCancel={() => setIsEditModalOpen(false)}