feat:rating
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { formatDistance } from '$lib/utils/distance';
|
||||
import { Star } from 'lucide-svelte';
|
||||
|
||||
interface Location {
|
||||
id: string;
|
||||
@@ -10,6 +11,8 @@
|
||||
username: string;
|
||||
profilePictureUrl?: string | null;
|
||||
findCount: number;
|
||||
averageRating?: number | null;
|
||||
ratingCount?: number;
|
||||
distance?: number;
|
||||
}
|
||||
|
||||
@@ -84,6 +87,13 @@
|
||||
</svg>
|
||||
<span>{location.findCount} {location.findCount === 1 ? 'find' : 'finds'}</span>
|
||||
</div>
|
||||
|
||||
{#if location.averageRating && (location.ratingCount || 0) > 0}
|
||||
<div class="meta-item rating">
|
||||
<Star size={16} fill="currentColor" class="star-icon" />
|
||||
<span>{(location.averageRating / 100).toFixed(1)} ({location.ratingCount})</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -188,6 +198,14 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.meta-item.rating {
|
||||
color: #fbbf24;
|
||||
}
|
||||
|
||||
:global(.star-icon) {
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.explore-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user