diff --git a/Components/PicCardTemplate.razor b/Components/PicCardTemplate.razor
index c5e67bd..ea1f98e 100644
--- a/Components/PicCardTemplate.razor
+++ b/Components/PicCardTemplate.razor
@@ -17,7 +17,7 @@
-
{{Pic.Description}}
+ {{Pic.DescriptionHtml}}
\ No newline at end of file
diff --git a/Components/PicList.razor b/Components/PicList.razor
index dca2e78..37af9fa 100644
--- a/Components/PicList.razor
+++ b/Components/PicList.razor
@@ -1,4 +1,5 @@
@inject IJSRuntime JS
+@inject State State
@if (Editable) {
@@ -28,6 +29,7 @@ else {
html = html.replaceAll("{{Pic.Address}}", pic.address)
html = html.replaceAll("{{Pic.RelativeTime}}", pic.relativeTime)
html = html.replaceAll("{{Pic.Description}}", pic.description)
+ html = html.replaceAll("{{Pic.DescriptionHtml}}", pic.descriptionHtml)
clone.children[0].innerHTML = html
@@ -64,20 +66,26 @@ else {
private DotNetObjectReference? objRef;
protected override void OnInitialized() {
+ base.OnInitialized();
objRef = DotNetObjectReference.Create(this);
+ State.CurrentPage = Page.Pics;
}
protected override async Task OnAfterRenderAsync(bool firstRender) {
await base.OnAfterRenderAsync(firstRender);
if (firstRender) {
await JS.InvokeVoidAsync("injectCSharp", objRef);
- RestService api = new RestService();
+ if (State.CurrentPage != Page.Pics) return;
if (pics == null || pics.Count == 0) pics = await PicsFunc();
+ if (State.CurrentPage != Page.Pics) return;
int page_size = 1;
for (int i = 0; i < pics.Count; i += page_size) {
+ if (State.CurrentPage != Page.Pics) return;
await JS.InvokeVoidAsync("renderPics", pics.Skip(i * page_size).Take(page_size));
+ if (State.CurrentPage != Page.Pics) return;
}
+ if (State.CurrentPage != Page.Pics) return;
await JS.InvokeVoidAsync("clearLoading");
}
}
diff --git a/Components/StatusList.razor b/Components/StatusList.razor
index 4f57156..90af0c0 100644
--- a/Components/StatusList.razor
+++ b/Components/StatusList.razor
@@ -1,4 +1,5 @@
-
+@inject State State
+
@@ -14,4 +15,9 @@
private async ValueTask> GetStatuses(ItemsProviderRequest request) {
return await this.StatusFunc(request);
}
+
+ protected override void OnInitialized() {
+ base.OnInitialized();
+ State.CurrentPage = Page.Status;
+ }
}
diff --git a/Models/Pic.cs b/Models/Pic.cs
index d3e103b..6d7d355 100644
--- a/Models/Pic.cs
+++ b/Models/Pic.cs
@@ -1,4 +1,6 @@
-using System;
+using Markdig;
+using Microsoft.AspNetCore.Components;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -15,6 +17,7 @@ namespace Neighbourhood.omg.lol.Models {
public long Size { get; set; }
public string Mime { get; set; }
public string Description { get; set; }
+ public string DescriptionHtml { get => Markdown.ToHtml(Description); }
[JsonPropertyName("exif")]
public JsonElement ExifJson { get; set; }
diff --git a/Models/State.cs b/Models/State.cs
index 8adc086..42b57f1 100644
--- a/Models/State.cs
+++ b/Models/State.cs
@@ -11,6 +11,8 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models {
public class State {
+
+ public Page CurrentPage { get; set; }
public AccountResponseData? AccountInfo { get; set; }
public AddressResponseList? AddressList { get; set; }
@@ -205,4 +207,13 @@ namespace Neighbourhood.omg.lol.Models {
return offsetString;
}
}
+
+ public enum Page {
+ None = 0,
+ Status,
+ Pics,
+ Ephemeral,
+ Person,
+ Other
+ }
}