feat: Allow half stars for reviews

This commit is contained in:
gpt-engineer-app[bot]
2025-09-28 21:20:01 +00:00
parent ec664a1669
commit 93278a5f24
3 changed files with 125 additions and 35 deletions

View File

@@ -5,6 +5,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Star, ThumbsUp, Calendar, MapPin } from 'lucide-react';
import { supabase } from '@/integrations/supabase/client';
import { ReportButton } from '@/components/moderation/ReportButton';
import { StarRating } from './StarRating';
interface ReviewWithProfile {
id: string;
@@ -69,16 +70,7 @@ export function ReviewsList({ entityType, entityId, entityName }: ReviewsListPro
};
const renderStars = (rating: number) => {
return Array.from({ length: 5 }, (_, i) => (
<Star
key={i}
className={`w-4 h-4 ${
i < rating
? 'fill-yellow-400 text-yellow-400'
: 'text-muted-foreground'
}`}
/>
));
return <StarRating rating={rating} size="sm" />;
};
const formatDate = (dateString: string) => {
@@ -161,6 +153,9 @@ export function ReviewsList({ entityType, entityId, entityName }: ReviewsListPro
</div>
<div className="flex items-center gap-1">
{renderStars(review.rating)}
<span className="ml-1 text-sm font-medium">
{review.rating}
</span>
</div>
</div>