mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:31:12 -05:00
Remove debug console logs
This commit is contained in:
@@ -76,7 +76,6 @@ export function AuthButtons() {
|
||||
src={profile?.avatar_url || undefined}
|
||||
alt={profile?.display_name || profile?.username || user.email || 'User avatar'}
|
||||
onError={(e) => {
|
||||
console.warn('[Avatar] Failed to load image:', profile?.avatar_url);
|
||||
e.currentTarget.src = ''; // Force fallback
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -99,8 +99,6 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
const postAuthResult = await handlePostAuthFlow(data.session, 'password');
|
||||
|
||||
if (postAuthResult.success && postAuthResult.data.shouldRedirect) {
|
||||
console.log('[AuthModal] MFA step-up required');
|
||||
|
||||
// Get the TOTP factor ID
|
||||
const { data: factors } = await supabase.auth.mfa.listFactors();
|
||||
const totpFactor = factors?.totp?.find(f => f.status === 'verified');
|
||||
|
||||
@@ -125,7 +125,6 @@ export function TOTPSetup() {
|
||||
const isOAuthUser = authMethod === 'oauth';
|
||||
|
||||
if (isOAuthUser) {
|
||||
console.log('[TOTPSetup] OAuth user enrolled MFA, triggering step-up...');
|
||||
setStepUpRequired(true, window.location.pathname);
|
||||
navigate('/auth/mfa-step-up');
|
||||
return;
|
||||
|
||||
@@ -19,69 +19,36 @@ export function PhotoSubmissionDisplay({ submissionId }: PhotoSubmissionDisplayP
|
||||
}, [submissionId]);
|
||||
|
||||
const fetchPhotos = async () => {
|
||||
console.log('🖼️ PhotoSubmissionDisplay: Starting fetch for submission:', submissionId);
|
||||
|
||||
try {
|
||||
// Check user auth and roles
|
||||
const { data: session } = await supabase.auth.getSession();
|
||||
const userId = session?.session?.user?.id;
|
||||
console.log('👤 Current user ID:', userId);
|
||||
|
||||
if (userId) {
|
||||
const { data: roles } = await supabase
|
||||
.from('user_roles')
|
||||
.select('role')
|
||||
.eq('user_id', userId);
|
||||
console.log('👤 Current user roles:', roles);
|
||||
}
|
||||
|
||||
// Step 1: Get photo_submission_id from submission_id
|
||||
console.log('📸 Step 1: Querying photo_submissions table...');
|
||||
const { data: photoSubmission, error: photoSubmissionError } = await supabase
|
||||
.from('photo_submissions')
|
||||
.select('id, entity_type, title')
|
||||
.eq('submission_id', submissionId)
|
||||
.maybeSingle();
|
||||
|
||||
console.log('📸 Photo submission query result:', {
|
||||
photoSubmission,
|
||||
error: photoSubmissionError
|
||||
});
|
||||
|
||||
if (photoSubmissionError) {
|
||||
console.error('❌ Error fetching photo_submission:', photoSubmissionError);
|
||||
throw photoSubmissionError;
|
||||
}
|
||||
|
||||
if (!photoSubmission) {
|
||||
console.log('⚠️ No photo_submission found for submission_id:', submissionId);
|
||||
setPhotos([]);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ Found photo_submission ID:', photoSubmission.id);
|
||||
|
||||
// Step 2: Get photo items using photo_submission_id
|
||||
console.log('🖼️ Step 2: Querying photo_submission_items table...');
|
||||
const { data, error } = await supabase
|
||||
.from('photo_submission_items')
|
||||
.select('*')
|
||||
.eq('photo_submission_id', photoSubmission.id)
|
||||
.order('order_index');
|
||||
|
||||
console.log('🖼️ Photo items query result:', {
|
||||
itemCount: data?.length,
|
||||
error
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error('❌ Error fetching photo_submission_items:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
setPhotos(data || []);
|
||||
console.log(`✅ Successfully loaded ${data?.length || 0} photos`);
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('❌ PhotoSubmissionDisplay error:', errorMsg);
|
||||
|
||||
@@ -27,18 +27,15 @@ export const QueueSortControls = ({
|
||||
const validFields: SortField[] = ['created_at', 'submission_type', 'status'];
|
||||
|
||||
if (!validFields.includes(value as SortField)) {
|
||||
console.warn('⚠️ [SORT] Invalid sort field:', value);
|
||||
return;
|
||||
}
|
||||
|
||||
const field = value as SortField;
|
||||
console.log('🔄 [SORT] Field change:', { from: sortConfig.field, to: field });
|
||||
onSortChange({ ...sortConfig, field });
|
||||
};
|
||||
|
||||
const handleDirectionToggle = () => {
|
||||
const newDirection = sortConfig.direction === 'asc' ? 'desc' : 'asc';
|
||||
console.log('🔄 [SORT] Direction toggle:', { from: sortConfig.direction, to: newDirection });
|
||||
onSortChange({
|
||||
...sortConfig,
|
||||
direction: newDirection
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { logger } from '@/lib/logger';
|
||||
import {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
@@ -128,7 +129,7 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
return JSON.parse(saved);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load sort config from localStorage:', error);
|
||||
logger.warn('Failed to load sort config from localStorage');
|
||||
}
|
||||
return { field: 'created_at', direction: 'asc' as ReportSortDirection };
|
||||
});
|
||||
@@ -153,7 +154,7 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
try {
|
||||
localStorage.setItem('reportsQueue_sortConfig', JSON.stringify(sortConfig));
|
||||
} catch (error) {
|
||||
console.warn('Failed to save sort config to localStorage:', error);
|
||||
logger.warn('Failed to save sort config to localStorage');
|
||||
}
|
||||
}, [sortConfig]);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { AlertCircle, Loader2 } from 'lucide-react';
|
||||
import type { SubmissionItemData } from '@/types/submissions';
|
||||
import { logger } from '@/lib/logger';
|
||||
|
||||
interface SubmissionItemsListProps {
|
||||
submissionId: string;
|
||||
@@ -54,7 +55,7 @@ export const SubmissionItemsList = memo(function SubmissionItemsList({
|
||||
.eq('submission_id', submissionId);
|
||||
|
||||
if (photoError) {
|
||||
console.warn('Error checking photo submissions:', photoError);
|
||||
logger.warn('Error checking photo submissions:', photoError);
|
||||
}
|
||||
|
||||
setItems((itemsData || []) as SubmissionItemData[]);
|
||||
|
||||
@@ -85,7 +85,6 @@ export function SearchResults({ query, onClose }: SearchResultsProps) {
|
||||
break;
|
||||
case 'company':
|
||||
// Navigate to manufacturer page when implemented
|
||||
console.log('Company clicked:', result.data);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,9 +72,7 @@ export function PrivacyTab() {
|
||||
...parseResult.data
|
||||
});
|
||||
} else {
|
||||
console.warn('Invalid privacy settings, reinitializing with defaults', {
|
||||
errors: parseResult.error.issues
|
||||
});
|
||||
logger.warn('Invalid privacy settings, reinitializing with defaults');
|
||||
await initializePreferences();
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -50,8 +50,6 @@ export function EntityPhotoGallery({
|
||||
|
||||
const fetchPhotos = async () => {
|
||||
try {
|
||||
console.log('📷 [FETCH PHOTOS] Starting fetch for:', { entityId, entityType });
|
||||
|
||||
// Fetch photos directly from the photos table
|
||||
const { data: photoData, error } = await supabase
|
||||
.from('photos')
|
||||
@@ -60,8 +58,6 @@ export function EntityPhotoGallery({
|
||||
.eq('entity_id', entityId)
|
||||
.order('created_at', { ascending: sortBy === 'oldest' });
|
||||
|
||||
console.log('📷 [FETCH PHOTOS] Query result:', { photoData, error, count: photoData?.length });
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
// Map to Photo interface
|
||||
@@ -74,7 +70,6 @@ export function EntityPhotoGallery({
|
||||
created_at: photo.created_at,
|
||||
})) || [];
|
||||
|
||||
console.log('📷 [FETCH PHOTOS] Mapped photos:', mappedPhotos);
|
||||
setPhotos(mappedPhotos);
|
||||
} catch (error: unknown) {
|
||||
console.error('📷 [FETCH PHOTOS] Error:', error);
|
||||
|
||||
@@ -17,6 +17,7 @@ import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { invokeWithTracking } from '@/lib/edgeFunctionTracking';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { logger } from '@/lib/logger';
|
||||
|
||||
interface PhotoUploadProps {
|
||||
onUploadComplete?: (urls: string[], imageId?: string) => void;
|
||||
@@ -250,7 +251,7 @@ export function PhotoUpload({
|
||||
'DELETE'
|
||||
);
|
||||
} catch (deleteError) {
|
||||
console.warn('Failed to delete old avatar:', deleteError);
|
||||
logger.warn('Failed to delete old avatar');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,14 +232,6 @@ export function UppyPhotoSubmissionUpload({
|
||||
throw itemsError;
|
||||
}
|
||||
|
||||
console.log('✅ Photo submission created:', {
|
||||
submission_id: submissionData.id,
|
||||
photo_submission_id: photoSubmissionData.id,
|
||||
entity_type: entityType,
|
||||
entity_id: entityId,
|
||||
photo_count: photoItems.length,
|
||||
});
|
||||
|
||||
toast({
|
||||
title: 'Submission Successful',
|
||||
description: 'Your photos have been submitted for review. Thank you for contributing!',
|
||||
|
||||
Reference in New Issue
Block a user