mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 18:31:12 -05:00
Fix type errors in admin components
This commit is contained in:
@@ -163,7 +163,11 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
|
||||
{/* Additional Details */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<FlexibleDateInput
|
||||
value={watch('founded_date') ? parseDateOnly(watch('founded_date')) : undefined}
|
||||
value={(() => {
|
||||
const dateValue = watch('founded_date');
|
||||
if (!dateValue) return undefined;
|
||||
return parseDateOnly(dateValue);
|
||||
})()}
|
||||
precision={(watch('founded_date_precision') as DatePrecision) || 'year'}
|
||||
onChange={(date, precision) => {
|
||||
setValue('founded_date', date ? toDateOnly(date) : undefined);
|
||||
|
||||
@@ -9,10 +9,10 @@ import { supabase } from '@/integrations/supabase/client';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
interface DuplicateStats {
|
||||
date: string;
|
||||
total_attempts: number;
|
||||
duplicates_prevented: number;
|
||||
prevention_rate: number;
|
||||
date: string | null;
|
||||
total_attempts: number | null;
|
||||
duplicates_prevented: number | null;
|
||||
prevention_rate: number | null;
|
||||
health_status: 'healthy' | 'warning' | 'critical';
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ interface RecentDuplicate {
|
||||
id: string;
|
||||
user_id: string;
|
||||
channel: string;
|
||||
idempotency_key: string;
|
||||
idempotency_key: string | null;
|
||||
created_at: string;
|
||||
profiles?: {
|
||||
username: string;
|
||||
display_name: string;
|
||||
display_name: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ export function NotificationDebugPanel() {
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{stats.map((stat) => (
|
||||
<TableRow key={stat.date}>
|
||||
<TableCell>{format(new Date(stat.date), 'MMM d, yyyy')}</TableCell>
|
||||
<TableCell className="text-right">{stat.total_attempts}</TableCell>
|
||||
<TableCell className="text-right">{stat.duplicates_prevented}</TableCell>
|
||||
<TableCell className="text-right">{stat.prevention_rate.toFixed(1)}%</TableCell>
|
||||
<TableRow key={stat.date || 'unknown'}>
|
||||
<TableCell>{stat.date ? format(new Date(stat.date), 'MMM d, yyyy') : 'N/A'}</TableCell>
|
||||
<TableCell className="text-right">{stat.total_attempts ?? 0}</TableCell>
|
||||
<TableCell className="text-right">{stat.duplicates_prevented ?? 0}</TableCell>
|
||||
<TableCell className="text-right">{stat.prevention_rate !== null ? stat.prevention_rate.toFixed(1) : 'N/A'}%</TableCell>
|
||||
<TableCell>{getHealthBadge(stat.health_status)}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
|
||||
@@ -375,7 +375,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
{/* Dates */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<FlexibleDateInput
|
||||
value={watch('opening_date') ? parseDateOnly(watch('opening_date')) : undefined}
|
||||
value={watch('opening_date') ? parseDateOnly(watch('opening_date')!) : undefined}
|
||||
precision={(watch('opening_date_precision') as DatePrecision) || 'day'}
|
||||
onChange={(date, precision) => {
|
||||
setValue('opening_date', date ? toDateOnly(date) : undefined);
|
||||
@@ -388,7 +388,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
/>
|
||||
|
||||
<FlexibleDateInput
|
||||
value={watch('closing_date') ? parseDateOnly(watch('closing_date')) : undefined}
|
||||
value={watch('closing_date') ? parseDateOnly(watch('closing_date')!) : undefined}
|
||||
precision={(watch('closing_date_precision') as DatePrecision) || 'day'}
|
||||
onChange={(date, precision) => {
|
||||
setValue('closing_date', date ? toDateOnly(date) : undefined);
|
||||
@@ -632,7 +632,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
{/* Images */}
|
||||
<EntityMultiImageUploader
|
||||
mode={isEditing ? 'edit' : 'create'}
|
||||
value={watch('images')}
|
||||
value={watch('images') as ImageAssignments}
|
||||
onChange={(images: ImageAssignments) => setValue('images', images)}
|
||||
entityType="park"
|
||||
entityId={isEditing ? initialData?.id : undefined}
|
||||
@@ -663,7 +663,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
<Dialog open={isOperatorModalOpen} onOpenChange={setIsOperatorModalOpen}>
|
||||
<DialogContent className="max-w-4xl max-h-[90vh] overflow-y-auto">
|
||||
<OperatorForm
|
||||
initialData={tempNewOperator}
|
||||
initialData={tempNewOperator || undefined}
|
||||
onSubmit={(data) => {
|
||||
setTempNewOperator(data);
|
||||
setIsOperatorModalOpen(false);
|
||||
@@ -678,7 +678,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
<Dialog open={isPropertyOwnerModalOpen} onOpenChange={setIsPropertyOwnerModalOpen}>
|
||||
<DialogContent className="max-w-4xl max-h-[90vh] overflow-y-auto">
|
||||
<PropertyOwnerForm
|
||||
initialData={tempNewPropertyOwner}
|
||||
initialData={tempNewPropertyOwner || undefined}
|
||||
onSubmit={(data) => {
|
||||
setTempNewPropertyOwner(data);
|
||||
setIsPropertyOwnerModalOpen(false);
|
||||
|
||||
@@ -326,10 +326,10 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
_technical_specifications: technicalSpecs,
|
||||
_coaster_statistics: coasterStats,
|
||||
_name_history: formerNames,
|
||||
_tempNewPark: tempNewPark,
|
||||
_tempNewManufacturer: tempNewManufacturer,
|
||||
_tempNewDesigner: tempNewDesigner,
|
||||
_tempNewRideModel: tempNewRideModel
|
||||
_tempNewPark: tempNewPark || undefined,
|
||||
_tempNewManufacturer: tempNewManufacturer || undefined,
|
||||
_tempNewDesigner: tempNewDesigner || undefined,
|
||||
_tempNewRideModel: tempNewRideModel || undefined
|
||||
};
|
||||
|
||||
// Pass clean data to parent with extended fields
|
||||
@@ -492,7 +492,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
// Show combobox for existing manufacturers
|
||||
<Combobox
|
||||
options={manufacturers}
|
||||
value={watch('manufacturer_id')}
|
||||
value={watch('manufacturer_id') || undefined}
|
||||
onValueChange={(value) => {
|
||||
setValue('manufacturer_id', value);
|
||||
setSelectedManufacturerId(value);
|
||||
@@ -557,7 +557,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
<>
|
||||
<Combobox
|
||||
options={rideModels}
|
||||
value={watch('ride_model_id')}
|
||||
value={watch('ride_model_id') || undefined}
|
||||
onValueChange={(value) => setValue('ride_model_id', value)}
|
||||
placeholder="Select model"
|
||||
searchPlaceholder="Search models..."
|
||||
@@ -595,7 +595,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
{/* Dates */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<FlexibleDateInput
|
||||
value={watch('opening_date') ? parseDateOnly(watch('opening_date')) : undefined}
|
||||
value={watch('opening_date') ? parseDateOnly(watch('opening_date')!) : undefined}
|
||||
precision={(watch('opening_date_precision') as DatePrecision) || 'day'}
|
||||
onChange={(date, precision) => {
|
||||
setValue('opening_date', date ? toDateOnly(date) : undefined);
|
||||
@@ -608,7 +608,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
/>
|
||||
|
||||
<FlexibleDateInput
|
||||
value={watch('closing_date') ? parseDateOnly(watch('closing_date')) : undefined}
|
||||
value={watch('closing_date') ? parseDateOnly(watch('closing_date')!) : undefined}
|
||||
precision={(watch('closing_date_precision') as DatePrecision) || 'day'}
|
||||
onChange={(date, precision) => {
|
||||
setValue('closing_date', date ? toDateOnly(date) : undefined);
|
||||
@@ -1390,7 +1390,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
<DialogTitle>Create New Designer</DialogTitle>
|
||||
</DialogHeader>
|
||||
<ManufacturerForm
|
||||
initialData={tempNewDesigner}
|
||||
initialData={tempNewDesigner || undefined}
|
||||
onSubmit={(data) => {
|
||||
setTempNewDesigner(data);
|
||||
setIsDesignerModalOpen(false);
|
||||
@@ -1413,7 +1413,7 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<ManufacturerForm
|
||||
initialData={tempNewManufacturer}
|
||||
initialData={tempNewManufacturer || undefined}
|
||||
onSubmit={(data) => {
|
||||
setTempNewManufacturer(data);
|
||||
setSelectedManufacturerName(data.name);
|
||||
@@ -1442,9 +1442,9 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<RideModelForm
|
||||
manufacturerName={selectedManufacturerName || tempNewManufacturer?.name}
|
||||
manufacturerName={selectedManufacturerName || tempNewManufacturer?.name || ''}
|
||||
manufacturerId={selectedManufacturerId}
|
||||
initialData={tempNewRideModel}
|
||||
initialData={tempNewRideModel || undefined}
|
||||
onSubmit={(data) => {
|
||||
setTempNewRideModel(data);
|
||||
setIsModelModalOpen(false);
|
||||
|
||||
@@ -730,7 +730,7 @@ export const SystemActivityLog = forwardRef<SystemActivityLogRef, SystemActivity
|
||||
}
|
||||
|
||||
default:
|
||||
return null;
|
||||
return <span>Unknown activity type</span>;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
const { handlePostAuthFlow } = await import('@/lib/authService');
|
||||
const postAuthResult = await handlePostAuthFlow(data.session, 'password');
|
||||
|
||||
if (postAuthResult.success && postAuthResult.data.shouldRedirect) {
|
||||
if (postAuthResult.success && postAuthResult.data?.shouldRedirect) {
|
||||
// Get the TOTP factor ID
|
||||
const { data: factors } = await supabase.auth.mfa.listFactors();
|
||||
const totpFactor = factors?.totp?.find(f => f.status === 'verified');
|
||||
|
||||
@@ -35,13 +35,13 @@ export interface Park {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description?: string;
|
||||
description?: string | null;
|
||||
status: string; // Allow any string from database
|
||||
park_type: string; // Allow any string from database
|
||||
opening_date?: string;
|
||||
opening_date_precision?: string;
|
||||
closing_date?: string;
|
||||
closing_date_precision?: string;
|
||||
opening_date?: string | null;
|
||||
opening_date_precision?: string | null;
|
||||
closing_date?: string | null;
|
||||
closing_date_precision?: string | null;
|
||||
website_url?: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
@@ -132,7 +132,7 @@ export interface Ride {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description?: string;
|
||||
description?: string | null;
|
||||
park?: Park | { name: string; slug: string; location?: Location }; // Allow partial park data
|
||||
ride_model?: RideModel;
|
||||
manufacturer?: Company;
|
||||
@@ -140,10 +140,10 @@ export interface Ride {
|
||||
category: string; // Allow any string from database
|
||||
ride_sub_type?: string; // Sub-category like "Flying Coaster", "Inverted Coaster", etc.
|
||||
status: string; // Allow any string from database
|
||||
opening_date?: string;
|
||||
opening_date_precision?: string;
|
||||
closing_date?: string;
|
||||
closing_date_precision?: string;
|
||||
opening_date?: string | null;
|
||||
opening_date_precision?: string | null;
|
||||
closing_date?: string | null;
|
||||
closing_date_precision?: string | null;
|
||||
height_requirement?: number;
|
||||
age_requirement?: number;
|
||||
capacity_per_hour?: number;
|
||||
|
||||
Reference in New Issue
Block a user