Skip to content

Commit e141105

Browse files
committed
Stars change
1 parent 60f07fa commit e141105

3 files changed

Lines changed: 29 additions & 35 deletions

File tree

resources/js/Components/Resources/ResourceCard.vue

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
platformLabels,
1010
} from "@/Helpers/labels";
1111
import { platformIcons, pricingIcons, difficultyIcons } from "@/Helpers/icons";
12-
import ResourceThumbnail from "./ResourceThumbnail.vue";
12+
import ResourceThumbnail from "@/Components/Resources/ResourceThumbnail.vue";
13+
import StarRating from "@/Components/StarRating/StarRating.vue";
1314
1415
const props = defineProps({
1516
resource: {
@@ -81,7 +82,7 @@ const emit = defineEmits(["upvote", "downvote"]);
8182
<!-- Primary info row -->
8283
<div class="flex items-center gap-2 mb-1">
8384
<Icon
84-
icon="mdi:star"
85+
icon="mdi:label-outline"
8586
width="14"
8687
height="14"
8788
class="text-primary"
@@ -221,21 +222,22 @@ const emit = defineEmits(["upvote", "downvote"]);
221222
"
222223
class="flex items-center gap-1 hover:text-primary transition-colors"
223224
>
224-
<Icon
225-
icon="mdi:star"
226-
width="16"
227-
height="16"
228-
class="text-primary"
225+
<StarRating
226+
:model-value="
227+
Number(
228+
resource.review_summary
229+
?.overall_rating
230+
)
231+
"
232+
:size="16"
229233
/>
230-
{{
231-
Number(
232-
resource.review_summary?.overall_rating || 0
233-
).toFixed(1)
234-
}}
235-
({{
236-
resource.review_summary?.review_count || 0
237-
}}
234+
<span>
235+
236+
({{
237+
resource.review_summary?.review_count || 0
238+
}}
238239
reviews)
240+
</span>
239241
</ClickableHeading>
240242
</div>
241243
</div>

resources/js/Components/Resources/ResourceOverview.vue

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
pricingLabels,
99
difficultyLabels,
1010
} from "@/Helpers/labels";
11+
import StarRating from "@/Components/StarRating/StarRating.vue";
1112
1213
const props = defineProps({
1314
resource: {
@@ -268,22 +269,15 @@ const props = defineProps({
268269
v-if="props.resource.review_summary?.overall_rating > 0"
269270
class="flex items-center gap-1"
270271
>
271-
<Icon
272-
icon="mdi:star"
273-
width="16"
274-
height="16"
275-
class="text-primary"
276-
/>
277-
<span
278-
class="font-medium text-gray-900 dark:text-gray-100"
279-
>
280-
{{
272+
<StarRating
273+
:model-value="
281274
Number(
282275
props.resource.review_summary
283-
?.overall_rating || 0
284-
).toFixed(1)
285-
}}
286-
</span>
276+
?.overall_rating
277+
)
278+
"
279+
:size="16"
280+
/>
287281
<span class="text-gray-500 dark:text-gray-400">
288282
({{
289283
props.resource.review_summary?.review_count || 0

resources/js/Components/StarRating/StarRating.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@ const getStarClass = (type) =>
2727

2828
<template>
2929
<div class="inline-flex items-center flex-wrap gap-1">
30-
<span class="text-sm font-medium text-gray-600 dark:text-gray-200">
31-
{{ formattedRating }}
32-
</span>
3330
<div class="inline-flex items-center">
3431
<!-- Full stars -->
3532
<Icon
3633
v-for="i in stars.full"
3734
:key="'full-' + i"
38-
icon="material-symbols:star-rounded"
35+
icon="mdi:star"
3936
:class="getStarClass('full')"
4037
:width="size"
4138
:height="size"
4239
/>
4340
<!-- Half star -->
4441
<Icon
4542
v-if="stars.hasHalf"
46-
icon="material-symbols:star-half-rounded"
43+
icon="mdi:star-half-full"
4744
:class="getStarClass('half')"
4845
:width="size"
4946
:height="size"
@@ -52,11 +49,12 @@ const getStarClass = (type) =>
5249
<Icon
5350
v-for="i in stars.empty"
5451
:key="'empty-' + i"
55-
icon="material-symbols:star-outline-rounded"
52+
icon="mdi:star-outline"
5653
:class="getStarClass('empty')"
5754
:width="size"
5855
:height="size"
5956
/>
6057
</div>
58+
{{ formattedRating }}
6159
</div>
6260
</template>

0 commit comments

Comments
 (0)