From dd31f7352cd170616f03b1af301d4d2597ac3966 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 24 May 2026 01:25:02 +1000 Subject: Modified Razor pages and components to temporarily allow them to compile --- Pages/Component/AboutDialog.razor | 26 ++++---- Pages/Component/MediaTagTable.razor | 39 ++++++------ Pages/Component/NsfwSwitch.razor | 8 +-- Pages/Component/Switch.razor | 4 +- Pages/Component/TagEditDialog.razor | 10 ++-- Pages/Component/TagSelectDialog.razor | 109 ++++++++++++++++++---------------- Pages/Component/Titlebar.razor | 93 ++++++++++++++++------------- 7 files changed, 154 insertions(+), 135 deletions(-) (limited to 'Pages/Component') diff --git a/Pages/Component/AboutDialog.razor b/Pages/Component/AboutDialog.razor index 1229dc7..fa7b1ca 100644 --- a/Pages/Component/AboutDialog.razor +++ b/Pages/Component/AboutDialog.razor @@ -1,7 +1,9 @@ @using System.Reflection -@using Microsoft.AspNetCore.Hosting -@inject IDbContextFactory dbFactory -@inject IHostingEnvironment hostingEnvironment +@* + * @using Microsoft.AspNetCore.Hosting + * @inject IDbContextFactory dbFactory + * @inject IHostingEnvironment hostingEnvironment + *@ @implements IDialog @@ -699,15 +701,15 @@ set { dialog.Visible = value; if(value) { - using var db = dbFactory.CreateDbContext(); - progress = ( - Untagged: db.Media - .Where(m => m.Tags.Any(t => t.TagDefinition.ObjectId == (int) HBObjectId.IngestTag)) - .Count(), - Total: db.Media.Count() - ); - progressBar.Progress = (float) progress.Value!.Untagged / (float) progress.Value!.Total; - InvokeAsync(() => StateHasChanged()); + // using var db = dbFactory.CreateDbContext(); + // progress = ( + // Untagged: db.Media + // .Where(m => m.Tags.Any(t => t.TagDefinition.ObjectId == (int) HBObjectId.IngestTag)) + // .Count(), + // Total: db.Media.Count() + // ); + // progressBar.Progress = (float) progress.Value!.Untagged / (float) progress.Value!.Total; + // InvokeAsync(() => StateHasChanged()); } } } diff --git a/Pages/Component/MediaTagTable.razor b/Pages/Component/MediaTagTable.razor index 1b62832..0524739 100644 --- a/Pages/Component/MediaTagTable.razor +++ b/Pages/Component/MediaTagTable.razor @@ -1,7 +1,4 @@ -@inject IDbContextFactory dbFactory -@inject ITagService tagService - - +@inject HBSession hb @@ -19,7 +16,7 @@ }
- + @if(e.isImplicit) { @e.tagDef.Name } else { @@ -40,33 +37,39 @@ @code { [Parameter] - public Media Media { get; set; } + public Guid MediaId { get; set; } - private (TagDefinition tagDef, bool isImplicit)[] tagDefs; + private (TagDefinition tagDef, bool isImplicit)[] tagDefs = []; protected override void OnInitialized() => LoadTagDefs(); public void Refresh() { LoadTagDefs(); - StateHasChanged(); + // StateHasChanged(); } private void Delete(TagDefinition tagDef) { - tagService.RemoveTag(Media.Guid, tagDef.Guid); - Refresh(); + // tagService.RemoveTag(Media.Guid, tagDef.Guid); + // Refresh(); } - private void LoadTagDefs() { - using var db = dbFactory.CreateDbContext(); - var media = db.Media.First(m => m.ObjectId == Media.ObjectId); + private async void LoadTagDefs() { + var tags = await hb.Media.GetTagsAsync(MediaId); + + tagDefs = tags.Select(td => (tagDef: td, isImplicit: false)).ToArray(); + + await InvokeAsync(() => StateHasChanged()); + + // using var db = dbFactory.CreateDbContext(); + // var media = db.Media.First(m => m.ObjectId == Media.ObjectId); - tagDefs = tagService.GetAllTags(Media) - .Where(e => e.tagDefinition.Source == ApiModels.TagSource.UserTag) - .ToArray(); + // tagDefs = tagService.GetAllTags(Media) + // .Where(e => e.tagDefinition.Source == TagSource.UserTag) + // .ToArray(); } private void MakeExplicit(TagDefinition tagDef) { - tagService.AddTag(Media, tagDef); - Refresh(); + // tagService.AddTag(Media, tagDef); + // Refresh(); } } diff --git a/Pages/Component/NsfwSwitch.razor b/Pages/Component/NsfwSwitch.razor index b96606d..f4f9c1f 100644 --- a/Pages/Component/NsfwSwitch.razor +++ b/Pages/Component/NsfwSwitch.razor @@ -1,8 +1,6 @@ -@inject IUserService userService - - + @code { - private void ToggleNsfw(bool showNsfw) => - userService.UserSessionState.ShowNsfw = showNsfw; + private void ToggleNsfw(bool showNsfw) => _ = 0; + // userService.UserSessionState.ShowNsfw = showNsfw; } \ No newline at end of file diff --git a/Pages/Component/Switch.razor b/Pages/Component/Switch.razor index d11ac81..5264094 100644 --- a/Pages/Component/Switch.razor +++ b/Pages/Component/Switch.razor @@ -1,6 +1,4 @@ - - - + @* *@ +} else { + +} @code { - private AboutDialog aboutDialog; + // private AboutDialog aboutDialog; + + public string Username { get; set; } = ""; + public string Password { get; set; } = ""; + + private bool IsLoginPage => + new Uri(nav.Uri).AbsolutePath.Equals("/Login", StringComparison.OrdinalIgnoreCase); + + private async void Login() { + await session.LoginAsync(Username, Password); + } } -- cgit v1.3