mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 04:31:13 -05:00
feat: Implement final type safety fixes
This commit is contained in:
@@ -6,6 +6,7 @@ import { Progress } from '@/components/ui/progress';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { CheckCircle2, XCircle, AlertCircle, Loader2 } from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
|
||||
interface MigrationResult {
|
||||
userId: string;
|
||||
@@ -71,11 +72,12 @@ export function NovuMigrationUtility() {
|
||||
title: "Migration completed",
|
||||
description: `Successfully migrated ${successCount} users. ${failureCount} failures.`,
|
||||
});
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Migration failed",
|
||||
description: error.message,
|
||||
description: errorMsg,
|
||||
});
|
||||
} finally {
|
||||
setIsRunning(false);
|
||||
|
||||
@@ -66,10 +66,10 @@ export function ManufacturerCard({ company }: ManufacturerCardProps) {
|
||||
|
||||
{/* Logo Display */}
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
{(company.logo_url || (company as any).logo_image_id) ? (
|
||||
{company.logo_url ? (
|
||||
<div className="w-16 h-16 md:w-20 md:h-20 bg-background/90 rounded-xl overflow-hidden shadow-lg backdrop-blur-sm border border-border/50">
|
||||
<img
|
||||
src={company.logo_url || ''}
|
||||
src={company.logo_url}
|
||||
alt={`${company.name} logo`}
|
||||
className="w-full h-full object-contain p-2"
|
||||
loading="lazy"
|
||||
|
||||
@@ -55,7 +55,7 @@ export function SubmissionReviewManager({
|
||||
const [showRejectionDialog, setShowRejectionDialog] = useState(false);
|
||||
const [showEditDialog, setShowEditDialog] = useState(false);
|
||||
const [editingItem, setEditingItem] = useState<SubmissionItemWithDeps | null>(null);
|
||||
const [activeTab, setActiveTab] = useState<'items' | 'dependencies'>('items' as const);
|
||||
const [activeTab, setActiveTab] = useState<'items' | 'dependencies'>('items');
|
||||
const [submissionType, setSubmissionType] = useState<string>('submission');
|
||||
const [showValidationBlockerDialog, setShowValidationBlockerDialog] = useState(false);
|
||||
const [showWarningConfirmDialog, setShowWarningConfirmDialog] = useState(false);
|
||||
|
||||
@@ -30,8 +30,24 @@ export function ValidationSummary({ item, onValidationChange, compact = false }:
|
||||
async function validate() {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
// Type guard for valid entity types
|
||||
type ValidEntityType = 'park' | 'ride' | 'manufacturer' | 'operator' | 'designer' | 'property_owner' | 'ride_model' | 'photo';
|
||||
const validEntityTypes: ValidEntityType[] = ['park', 'ride', 'manufacturer', 'operator', 'designer', 'property_owner', 'ride_model', 'photo'];
|
||||
|
||||
if (!validEntityTypes.includes(item.item_type as ValidEntityType)) {
|
||||
setValidationResult({
|
||||
isValid: false,
|
||||
blockingErrors: [{ field: 'item_type', message: `Invalid entity type: ${item.item_type}`, severity: 'blocking' }],
|
||||
warnings: [],
|
||||
suggestions: [],
|
||||
allErrors: [{ field: 'item_type', message: `Invalid entity type: ${item.item_type}`, severity: 'blocking' }],
|
||||
});
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await validateEntityData(
|
||||
item.item_type as any,
|
||||
item.item_type as ValidEntityType,
|
||||
{ ...item.item_data, id: item.id }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user