diff --git a/src/components/reviews/TestimonialsSection.tsx b/src/components/reviews/TestimonialsSection.tsx index 571600d..6513e64 100644 --- a/src/components/reviews/TestimonialsSection.tsx +++ b/src/components/reviews/TestimonialsSection.tsx @@ -8,6 +8,7 @@ interface Review { title: string; body: string; created_at: string; + reviewer_name: string | null; profiles: { name: string | null } | null; } @@ -20,13 +21,18 @@ export function TestimonialsSection() { }, []); const fetchReviews = async () => { - const { data } = await supabase + console.log('TestimonialsSection fetchReviews called'); + + const { data, error } = await supabase .from('reviews') - .select('id, rating, title, body, created_at, profiles:user_id (name)') + .select('id, rating, title, body, created_at, reviewer_name, profiles!user_id (name)') .eq('is_approved', true) .order('created_at', { ascending: false }) .limit(6); + console.log('TestimonialsSection - Raw data:', data); + console.log('TestimonialsSection - Error:', error); + if (data) { setReviews(data as unknown as Review[]); } @@ -45,7 +51,7 @@ export function TestimonialsSection() { rating={review.rating} title={review.title} body={review.body} - authorName={review.profiles?.name || 'Anonymous'} + authorName={review.reviewer_name || review.profiles?.name || 'Anonymous'} date={review.created_at} /> ))}