mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 05:11:14 -05:00
Continue console cleanup
This commit is contained in:
@@ -13,6 +13,8 @@ import { DragDropZone } from './DragDropZone';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { toast } from '@/hooks/use-toast';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
|
||||
export interface UploadedImage {
|
||||
url: string;
|
||||
@@ -68,7 +70,7 @@ export function EntityMultiImageUploader({
|
||||
try {
|
||||
URL.revokeObjectURL(image.url);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
logger.error('Failed to revoke object URL', { error: getErrorMessage(error) });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -106,10 +108,9 @@ export function EntityMultiImageUploader({
|
||||
card_assignment: cardIndex >= 0 ? cardIndex : null,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to load entity photos:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: 'Failed to load existing photos',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
|
||||
@@ -17,6 +17,8 @@ import { PhotoModal } from '@/components/moderation/PhotoModal';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { EntityPhotoGalleryProps } from '@/types/submissions';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
|
||||
interface Photo {
|
||||
id: string;
|
||||
@@ -72,7 +74,7 @@ export function EntityPhotoGallery({
|
||||
|
||||
setPhotos(mappedPhotos);
|
||||
} catch (error: unknown) {
|
||||
console.error('📷 [FETCH PHOTOS] Error:', error);
|
||||
logger.error('Failed to fetch photos', { error: getErrorMessage(error), entityId, entityType });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { Trash2, Pencil } from 'lucide-react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
|
||||
interface Photo {
|
||||
id: string;
|
||||
@@ -78,10 +80,9 @@ export function PhotoManagementDialog({
|
||||
if (error) throw error;
|
||||
setPhotos(data || []);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching photos:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: 'Failed to load photos',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
@@ -123,7 +124,7 @@ export function PhotoManagementDialog({
|
||||
if (data?.name) entityName = data.name;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching entity name:', err);
|
||||
logger.error('Failed to fetch entity name', { error: getErrorMessage(err), entityType, entityId });
|
||||
}
|
||||
|
||||
// Create content submission
|
||||
@@ -173,10 +174,9 @@ export function PhotoManagementDialog({
|
||||
setDeleteReason('');
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error requesting photo deletion:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: 'Failed to submit deletion request',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
}
|
||||
@@ -238,10 +238,9 @@ export function PhotoManagementDialog({
|
||||
});
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error requesting photo edit:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: 'Failed to submit edit request',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ export function PhotoUpload({
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
logger.error('Failed to revoke object URL', { error: getErrorMessage(error) });
|
||||
}
|
||||
});
|
||||
objectUrlsRef.current.clear();
|
||||
@@ -91,7 +91,7 @@ export function PhotoUpload({
|
||||
URL.revokeObjectURL(url);
|
||||
objectUrlsRef.current.delete(url);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
logger.error('Failed to revoke object URL', { error: getErrorMessage(error) });
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -129,7 +129,6 @@ export function PhotoUpload({
|
||||
);
|
||||
|
||||
if (uploadError) {
|
||||
console.error('Upload URL error:', uploadError);
|
||||
revokeObjectUrl(previewUrl);
|
||||
throw new Error(uploadError.message);
|
||||
}
|
||||
@@ -196,7 +195,7 @@ export function PhotoUpload({
|
||||
}
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
console.error('Status poll error:', error);
|
||||
logger.error('Status poll error', { error: getErrorMessage(error) });
|
||||
}
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
@@ -340,7 +339,7 @@ export function PhotoUpload({
|
||||
alt="Avatar"
|
||||
className="w-24 h-24 rounded-full object-cover border-2 border-border"
|
||||
onError={(e) => {
|
||||
console.error('Failed to load avatar image:', uploadedImages[0].thumbnailUrl);
|
||||
logger.warn('Failed to load avatar image');
|
||||
e.currentTarget.src = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZjNmNGY2Ii8+CjxwYXRoIGQ9Im0xNSAxMi0zLTMtMy4wMDEgM0w2IDlsNi02aDZ2NloiIGZpbGw9IiM5Y2EzYWYiLz4KPC9zdmc+';
|
||||
}}
|
||||
/>
|
||||
@@ -488,7 +487,7 @@ export function PhotoUpload({
|
||||
alt={image.filename}
|
||||
className="w-full aspect-square object-cover rounded-lg border"
|
||||
onError={(e) => {
|
||||
console.error('Failed to load image:', image.thumbnailUrl);
|
||||
logger.warn('Failed to load thumbnail image');
|
||||
e.currentTarget.src = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZjNmNGY2Ii8+CjxwYXRoIGQ9Im0xNSAxMi0zLTMtMy4wMDEgM0w2IDlsNi02aDZ2NloiIGZpbGw9IiM5Y2EzYWYiLz4KPC9zdmc+';
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user