[CHANGE] Added video info page

This commit is contained in:
max
2025-11-02 21:22:56 +01:00
parent bf957436f0
commit a849b7524d
5 changed files with 295 additions and 19 deletions

View File

@@ -0,0 +1,48 @@
using Manager.YouTube.Models;
using Microsoft.AspNetCore.Components;
using MudBlazor;
namespace Manager.App.Components.Pages;
public partial class Video : ComponentBase
{
[Parameter]
public required string VideoId { get; set; }
[SupplyParameterFromQuery(Name = "clientId")]
public string ClientId { get; set; } = "";
private bool _loading = true;
private YouTubeVideo? _video;
protected override async Task OnInitializedAsync()
{
if (string.IsNullOrEmpty(VideoId))
{
Snackbar.Add("Video id is null or empty!", Severity.Error);
_loading = false;
return;
}
var clientResult = await ClientService.LoadClientByIdAsync(ClientId);
if (!clientResult.IsSuccess)
{
Snackbar.Add(clientResult.Error?.Description ?? "Failed to load client!", Severity.Error);
_loading = false;
return;
}
var client = clientResult.Value;
var videoResult = await client.GetVideoByIdAsync(VideoId);
if (!videoResult.IsSuccess)
{
Snackbar.Add(videoResult.Error?.Description ?? "Failed to get video.", Severity.Error);
_loading = false;
return;
}
_video = videoResult.Value;
_loading = false;
}
}