From 12eaa5814ef20b0910e8d64a753378b6f6797989 Mon Sep 17 00:00:00 2001
From: Jake Mannens
Date: Fri, 22 May 2026 00:52:16 +1000
Subject: Initial commit
---
Server.Client/Pages/ViewMedia.razor | 270 ++++++++++++++++++++++++++++++++++++
1 file changed, 270 insertions(+)
create mode 100644 Server.Client/Pages/ViewMedia.razor
(limited to 'Server.Client/Pages/ViewMedia.razor')
diff --git a/Server.Client/Pages/ViewMedia.razor b/Server.Client/Pages/ViewMedia.razor
new file mode 100644
index 0000000..4c9151e
--- /dev/null
+++ b/Server.Client/Pages/ViewMedia.razor
@@ -0,0 +1,270 @@
+@page "/ViewMedia"
+@* @using HyperBooru.Util*@
+@inject HBSession hb
+@inject IJSRuntime jsRuntime
+@* @inject IDbContextFactory dbFactory
+@inject ITagService tagService
+@inject IMediaService mediaService
+@inject ISourceService sourceService
+ *@
+
+@title
+
+
+
+
+
+
+
)
+@*
)
+ *@
+
+
+
+
+

+

+
+
+
+@*
+
+
+ } else {
+ @media.OcrData?.Text
+ }
+
+
+
+
+
+
+ *@
+@code {
+ [Parameter]
+ [SupplyParameterFromQuery(Name = "m")]
+ public Guid MediaId { get; set; }
+
+ private ApiModels.Media media;
+
+ private string title;
+
+ private bool infoEditMode = false;
+ private string? shortDescription;
+ private string? longDescription;
+
+ private MediaTagTable mediaTagTable;
+ // private Dialog deleteDialog;
+ // private Dialog ocrDialog;
+ // private TagSelectDialog tagDialog;
+
+ private ElementReference shortDescriptionInput;
+
+ protected override void OnInitialized() =>
+ LoadMedia();
+
+ protected override async void OnAfterRender(bool firstRender) {
+ if(infoEditMode)
+ await shortDescriptionInput.FocusAsync();
+ }
+
+ 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";
+ // InvokeAsync(() => StateHasChanged());
+ }
+
+ // 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);
+ LoadMedia();
+
+ if(ingest)
+ StateHasChanged();
+ else
+ await jsRuntime.InvokeVoidAsync("history.back");
+ }
+
+ private bool InfoEditMode {
+ get => infoEditMode;
+ set {
+ shortDescription = media.ShortDescription;
+ longDescription = media.LongDescription;
+ infoEditMode = value;
+ StateHasChanged();
+ }
+ }
+
+ // private void ApplyInfoEdit(bool apply) {
+ // if(apply) {
+ // mediaService.SetDescription(media, shortDescription, longDescription);
+ // LoadMedia();
+ // }
+
+ // infoEditMode = false;
+ // }
+
+ // private async void DeleteMedia() {
+ // mediaService.Delete(media);
+ // await jsRuntime.InvokeVoidAsync("history.back");
+ // }
+}
--
cgit v1.3