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/ViewMedia.razor | 143 +++++++++++++++++++++++++++----------------------- 1 file changed, 78 insertions(+), 65 deletions(-) (limited to 'Pages/ViewMedia.razor') diff --git a/Pages/ViewMedia.razor b/Pages/ViewMedia.razor index 46cbc45..e210e79 100644 --- a/Pages/ViewMedia.razor +++ b/Pages/ViewMedia.razor @@ -1,11 +1,7 @@ @page "/ViewMedia" -@using HyperBooru.Util +@* @using HyperBooru.Util*@ +@inject HBSession hb @inject IJSRuntime jsRuntime -@inject IDbContextFactory dbFactory -@inject ITagService tagService -@inject IMediaService mediaService -@inject ISourceService sourceService -@attribute [Authorize] @title @@ -33,11 +29,14 @@
+ +@* -
+*@ +
@@ -45,6 +44,7 @@
@if(infoEditMode) { +@*
ApplyInfoEdit(true))> @@ -57,11 +57,13 @@
+*@ } else { -

Title: @(media.ShortDescription ?? "None")

-

Description:
@(media.LongDescription ?? "None")

+

Title: @(media?.ShortDescription ?? "None")

+

Description:
@(media?.LongDescription ?? "None")

} -

Resolution: @(media.CurrentUploadedFile.Width)x@(media.CurrentUploadedFile.Height)

+@* +

Resolution: @(media.CurrentUploadedFile.Width)x@(media.CurrentUploadedFile.Height)

Upload history


@@ -102,16 +104,18 @@ }
+*@

Tags


- +
- @@ -123,8 +127,10 @@

View OCR

- @if(infoEditMode) { - @@ -132,23 +138,26 @@

Apply

- } else { +*@ + } else { } - @if(media.IsIngest) { +@* + @if(media.IsIngest) { } else { - - } + @* } *@
@@ -159,6 +168,7 @@ +@* @@ -181,56 +191,59 @@ Title="Select one or more tag(s) to add" OnSubmit=AddTags @ref=tagDialog/> +*@ @code { - [Parameter] - [SupplyParameterFromQuery(Name = "m")] - public Guid MediaId { get; set; } + [Parameter] + [SupplyParameterFromQuery(Name = "m")] + public Guid MediaId { get; set; } - private Media media; + private ApiModels.Media media; - private string title; + private string title; - private bool infoEditMode = false; - private string? shortDescription; - private string? longDescription; + private bool infoEditMode = false; + private string? shortDescription; + private string? longDescription; - private MediaTagTable mediaTagTable; - private Dialog deleteDialog; - private Dialog ocrDialog; - private TagSelectDialog tagDialog; + private MediaTagTable mediaTagTable; + // private Dialog deleteDialog; + // private Dialog ocrDialog; + // private TagSelectDialog tagDialog; - private ElementReference shortDescriptionInput; + private ElementReference shortDescriptionInput; - protected override void OnInitialized() => - LoadMedia(); + protected override void OnInitialized() => + LoadMedia(); - protected override async void OnAfterRender(bool firstRender) { - if(infoEditMode) - await shortDescriptionInput.FocusAsync(); - } + protected override async void OnAfterRender(bool firstRender) { + if(infoEditMode) + await shortDescriptionInput.FocusAsync(); + } - private void LoadMedia() { - using var db = dbFactory.CreateDbContext(); - media = db.Media - .Include(m => m.Tags) - .ThenInclude(t => t.TagDefinition) - .Include(m => m.CurrentUploadedFile) - .Include(m => m.UploadedFiles) - .Include(m => m.OcrData) - .First(m => m.Guid == MediaId); + private async void LoadMedia() { + media = await hb.Media.GetAsync(MediaId); + // using var db = dbFactory.CreateDbContext(); + // media = db.Media + // .Include(m => m.Tags) + // .ThenInclude(t => t.TagDefinition) + // .Include(m => m.CurrentUploadedFile) + // .Include(m => m.UploadedFiles) + // .Include(m => m.OcrData) + // .First(m => m.Guid == MediaId); - title = media.DisplayName ?? "Media View"; - } + // title = media.DisplayName ?? "Media View"; + // InvokeAsync(() => StateHasChanged()); + } - private void AddTags(TagDefinition[] tagDefs) { - foreach(var tagDef in tagDefs) - tagService.AddTag(media, tagDef); - mediaTagTable.Refresh(); - } + // private void AddTags(TagDefinition[] tagDefs) { + // foreach(var tagDef in tagDefs) + // tagService.AddTag(media, tagDef); + // mediaTagTable.Refresh(); + // } private async void SetIngest(bool ingest) { - mediaService.SetIngest(media, ingest); + // mediaService.SetIngest(media, ingest); LoadMedia(); if(ingest) @@ -249,17 +262,17 @@ } } - private void ApplyInfoEdit(bool apply) { - if(apply) { - mediaService.SetDescription(media, shortDescription, longDescription); - LoadMedia(); - } + // private void ApplyInfoEdit(bool apply) { + // if(apply) { + // mediaService.SetDescription(media, shortDescription, longDescription); + // LoadMedia(); + // } - infoEditMode = false; - } + // infoEditMode = false; + // } - private async void DeleteMedia() { - mediaService.Delete(media); - await jsRuntime.InvokeVoidAsync("history.back"); - } + // private async void DeleteMedia() { + // mediaService.Delete(media); + // await jsRuntime.InvokeVoidAsync("history.back"); + // } } -- cgit v1.3