@using TaikoWebUI.Services @using SharedProject.Models.Responses @using SharedProject.Models @using SharedProject.Models.Requests @using SharedProject.Enums @inject IGameDataService GameDataService @inject HttpClient Client @page "/Cards/{baid:int}/PlayResults"

Play Data

Card: @Baid @if (response is null) { No data. } else { @GameDataService.GetMusicNameBySongId(context.Item.SongId) @GameDataService.GetMusicArtistBySongId(context.Item.SongId) @(context.Item.Difficulty) @(context.Item.BestCrown) } @code { [Parameter] public int Baid { get; set; } private SongBestResponse? response; private List breadcrumbs = new() { new BreadcrumbItem("Cards", href: "/Cards"), }; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); response = await Client.GetFromJsonAsync($"api/PlayData/{Baid}"); breadcrumbs.Add(new BreadcrumbItem($"Card: {Baid}", href: null, disabled: true)); breadcrumbs.Add(new BreadcrumbItem("Play Data", href: $"/Cards/{Baid}/PlayResults", disabled: false)); } private async Task OnFavoriteToggled(SongBestData data) { var request = new SetFavoriteRequest { Baid = (uint)Baid, IsFavorite = !data.IsFavorite, SongId = data.SongId }; var result = await Client.PostAsJsonAsync("api/FavoriteSongs", request); if (result.IsSuccessStatusCode) { data.IsFavorite = !data.IsFavorite; } } private static string GetCrownText(CrownType crown) { return crown switch { CrownType.None => "Fail", CrownType.Clear => "Cleared", CrownType.Gold => "Full Combo", CrownType.Dondaful => "Donderful Combo", _ => "" }; } }