2024-10-23 02:39:15 +02:00
|
|
|
@using Blazorise.Extensions
|
2025-03-03 00:56:32 +01:00
|
|
|
@using WatchIt.DTO.Models.Generics.Rating
|
|
|
|
|
|
|
|
|
|
@inherits Component
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-23 02:39:15 +02:00
|
|
|
<div class="d-flex align-items-center gap-2">
|
2025-03-03 00:56:32 +01:00
|
|
|
@if (Rating is not IRatingOverallResponse overallRating || overallRating.Count > 0 || EmptyMode == DisplayRatingComponentEmptyMode.DoubleDash)
|
2024-10-23 02:39:15 +02:00
|
|
|
{
|
|
|
|
|
<i id="star" class="fas fa-star"></i>
|
|
|
|
|
}
|
|
|
|
|
<div class="vstack">
|
2025-03-03 00:56:32 +01:00
|
|
|
@switch (Rating)
|
2024-10-23 02:39:15 +02:00
|
|
|
{
|
2025-03-03 00:56:32 +01:00
|
|
|
case RatingUserResponse userRating:
|
|
|
|
|
<span id="ratingSingleLine">@($"{userRating.Rating}/10")</span>
|
|
|
|
|
break;
|
|
|
|
|
case IRatingOverallResponse { Count: > 0 } overallResponse:
|
|
|
|
|
<span id="ratingAverage">@($"{Math.Round(overallResponse.Rating!.Value, 2)}/10")</span>
|
|
|
|
|
<span id="ratingCount">@(overallResponse.Count)</span>
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
<div id="ratingSingleLine">
|
|
|
|
|
@switch (EmptyMode)
|
2024-10-23 02:39:15 +02:00
|
|
|
{
|
|
|
|
|
case DisplayRatingComponentEmptyMode.NoRatings: @("no ratings"); break;
|
|
|
|
|
case DisplayRatingComponentEmptyMode.DoubleDash: @("--/10"); break;
|
|
|
|
|
}
|
2025-03-03 00:56:32 +01:00
|
|
|
</div>
|
|
|
|
|
break;
|
2024-10-23 02:39:15 +02:00
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
#star {
|
|
|
|
|
font-size: @((2 * Scale).ToCultureInvariantString())rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ratingAverage {
|
|
|
|
|
margin-top: @((-5 * Scale).ToCultureInvariantString())px;
|
|
|
|
|
font-size: @((1.3 * Scale).ToCultureInvariantString())rem;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-01 01:03:00 +01:00
|
|
|
#ratingSingleLine {
|
2024-10-23 02:39:15 +02:00
|
|
|
font-size: @((1.3 * Scale).ToCultureInvariantString())rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ratingCount {
|
|
|
|
|
margin-top: @((-5 * Scale).ToCultureInvariantString())px;
|
|
|
|
|
font-size: @((0.8 * Scale).ToCultureInvariantString())rem;
|
|
|
|
|
}
|
|
|
|
|
</style>
|