2023-09-28 04:02:42 +02:00
|
|
|
<script lang="ts">
|
2023-09-28 23:50:27 +02:00
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
|
|
|
import StarsBar from "./StarsBar.svelte"
|
2023-12-24 05:01:10 +01:00
|
|
|
import { ariaLabel } from "../../Utils/ariaLabel"
|
|
|
|
import Translations from "../i18n/Translations"
|
2023-09-28 04:02:42 +02:00
|
|
|
|
2023-09-28 23:50:27 +02:00
|
|
|
export let score: Store<number>
|
2023-12-24 05:01:10 +01:00
|
|
|
let scoreRounded = score.mapD(count => Math.round(count / 10) / 2)
|
2023-09-28 04:02:42 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if $score !== undefined && $score !== null}
|
2023-12-24 05:01:10 +01:00
|
|
|
<div tabindex="0"
|
|
|
|
use:ariaLabel={Translations.t.reviews.averageRating.Subs({n: $scoreRounded})}>
|
|
|
|
<StarsBar readonly={true} score={$score} />
|
|
|
|
</div>
|
2023-09-28 04:02:42 +02:00
|
|
|
{/if}
|