mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 08:51:16 -05:00
Remove debug console logs
This commit is contained in:
@@ -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[]);
|
||||
|
||||
Reference in New Issue
Block a user