Refactoring, database structure changed

This commit is contained in:
2025-03-03 00:56:32 +01:00
Unverified
parent d3805ef3db
commit c603c41c0b
913 changed files with 21764 additions and 32775 deletions

View File

@@ -0,0 +1,18 @@
@inherits Component
<div class="panel h-100">
<div class="d-flex flex-wrap metadata-pill-container">
@if (!string.IsNullOrWhiteSpace(Data.Gender?.Name))
{
<div class="metadata-pill"><strong>Gender:</strong> @(Data.Gender?.Name)</div>
}
@if (Data.BirthDate.HasValue)
{
<div class="metadata-pill"><strong>Birth date:</strong> @(Data.BirthDate.Value.ToString())</div>
}
@if (Data.DeathDate.HasValue)
{
<div class="metadata-pill"><strong>Death date:</strong> @(Data.DeathDate.Value.ToString())</div>
}
</div>
</div>

View File

@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Components;
using WatchIt.DTO.Models.Controllers.People.Person;
namespace WatchIt.Website.Components.Panels.Pages.PersonPage;
public partial class MetadataPanel : Component
{
#region PARAMETERS
[Parameter] public required PersonResponse Data { get; set; }
#endregion
}

View File

@@ -0,0 +1,24 @@
@using WatchIt.Website.Components.Subcomponents.Common
@inherits Component
<div class="panel panel-background-gold h-100 text-dark">
<div class="vstack">
<TitledDisplayRating Rating="@(_globalRating)" Title="Global rating:"/>
<hr/>
<Authorization>
<Authorized>
<TitledDisplayRating Rating="@(_userRating)" Title="Your rating:"/>
</Authorized>
<NotAuthorized>
<div class="vstack">
<h4 class="fw-bold">Your rating:</h4>
<span>Log in to see your rating</span>
</div>
</NotAuthorized>
<Loading>
<LoadingInline/>
</Loading>
</Authorization>
</div>
</div>

View File

@@ -0,0 +1,87 @@
using Microsoft.AspNetCore.Components;
using Refit;
using WatchIt.DTO.Models.Controllers.People.Person;
using WatchIt.DTO.Models.Generics.Rating;
using WatchIt.Website.Clients;
using WatchIt.Website.Components.Layout;
namespace WatchIt.Website.Components.Panels.Pages.PersonPage;
public partial class RatingPanel : Component
{
#region SERVICES
[Inject] protected IPeopleClient PeopleClient { get; set; } = null!;
#endregion
#region PARAMETERS
[Parameter] public required PersonResponse Data { get; set; }
#endregion
#region FIELDS
private RatingOverallResponse _globalRating;
private RatingUserOverallResponse? _userRating;
#endregion
#region PUBLIC METHODS
public async Task Update()
{
await Task.WhenAll(
[
GetGlobalRating(),
GetUserRating()
]);
StateHasChanged();
}
#endregion
#region PRIVATE METHODS
protected override async Task OnFirstRenderAsync()
{
await base.OnFirstRenderAsync();
_globalRating = Data.Rating;
await GetUserRating();
StateHasChanged();
}
private async Task GetUserRating()
{
if (Base.AuthorizationLoaded && Base.AuthorizedAccount is not null)
{
IApiResponse<RatingUserOverallResponse> response = await PeopleClient.GetPersonUserRating(Data.Id, Base.AuthorizedAccount.Id);
if (response.IsSuccessful)
{
_userRating = response.Content;
}
}
}
private async Task GetGlobalRating()
{
IApiResponse<RatingOverallResponse> response = await PeopleClient.GetPersonRating(Data.Id);
if (response.IsSuccessful)
{
_globalRating = response.Content;
}
}
#endregion
}