Fixes to the pic list
This commit is contained in:
parent
d0d3d2cc00
commit
08788db7fa
5 changed files with 32 additions and 4 deletions
|
@ -17,7 +17,7 @@
|
||||||
<i class="fa-solid fa-share-nodes"></i>
|
<i class="fa-solid fa-share-nodes"></i>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<p class="description">{{Pic.Description}}</p>
|
<p class="description">{{Pic.DescriptionHtml}}</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
|
@ -1,4 +1,5 @@
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@inject State State
|
||||||
|
|
||||||
@if (Editable) {
|
@if (Editable) {
|
||||||
<PicCardEditableTemplate></PicCardEditableTemplate>
|
<PicCardEditableTemplate></PicCardEditableTemplate>
|
||||||
|
@ -28,6 +29,7 @@ else {
|
||||||
html = html.replaceAll("{{Pic.Address}}", pic.address)
|
html = html.replaceAll("{{Pic.Address}}", pic.address)
|
||||||
html = html.replaceAll("{{Pic.RelativeTime}}", pic.relativeTime)
|
html = html.replaceAll("{{Pic.RelativeTime}}", pic.relativeTime)
|
||||||
html = html.replaceAll("{{Pic.Description}}", pic.description)
|
html = html.replaceAll("{{Pic.Description}}", pic.description)
|
||||||
|
html = html.replaceAll("{{Pic.DescriptionHtml}}", pic.descriptionHtml)
|
||||||
|
|
||||||
clone.children[0].innerHTML = html
|
clone.children[0].innerHTML = html
|
||||||
|
|
||||||
|
@ -64,20 +66,26 @@ else {
|
||||||
private DotNetObjectReference<PicList>? objRef;
|
private DotNetObjectReference<PicList>? objRef;
|
||||||
|
|
||||||
protected override void OnInitialized() {
|
protected override void OnInitialized() {
|
||||||
|
base.OnInitialized();
|
||||||
objRef = DotNetObjectReference.Create(this);
|
objRef = DotNetObjectReference.Create(this);
|
||||||
|
State.CurrentPage = Page.Pics;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender) {
|
protected override async Task OnAfterRenderAsync(bool firstRender) {
|
||||||
await base.OnAfterRenderAsync(firstRender);
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
if (firstRender) {
|
if (firstRender) {
|
||||||
await JS.InvokeVoidAsync("injectCSharp", objRef);
|
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 (pics == null || pics.Count == 0) pics = await PicsFunc();
|
||||||
|
if (State.CurrentPage != Page.Pics) return;
|
||||||
|
|
||||||
int page_size = 1;
|
int page_size = 1;
|
||||||
for (int i = 0; i < pics.Count; i += page_size) {
|
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));
|
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");
|
await JS.InvokeVoidAsync("clearLoading");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<Virtualize ItemsProvider="GetStatuses" Context="status" ItemSize="180">
|
@inject State State
|
||||||
|
<Virtualize ItemsProvider="GetStatuses" Context="status" ItemSize="180">
|
||||||
<ItemContent>
|
<ItemContent>
|
||||||
<StatusCard status="@status"></StatusCard>
|
<StatusCard status="@status"></StatusCard>
|
||||||
</ItemContent>
|
</ItemContent>
|
||||||
|
@ -14,4 +15,9 @@
|
||||||
private async ValueTask<ItemsProviderResult<Status>> GetStatuses(ItemsProviderRequest request) {
|
private async ValueTask<ItemsProviderResult<Status>> GetStatuses(ItemsProviderRequest request) {
|
||||||
return await this.StatusFunc(request);
|
return await this.StatusFunc(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialized() {
|
||||||
|
base.OnInitialized();
|
||||||
|
State.CurrentPage = Page.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
using Markdig;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -15,6 +17,7 @@ namespace Neighbourhood.omg.lol.Models {
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public string Mime { get; set; }
|
public string Mime { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
public string DescriptionHtml { get => Markdown.ToHtml(Description); }
|
||||||
|
|
||||||
[JsonPropertyName("exif")]
|
[JsonPropertyName("exif")]
|
||||||
public JsonElement ExifJson { get; set; }
|
public JsonElement ExifJson { get; set; }
|
||||||
|
|
|
@ -11,6 +11,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Neighbourhood.omg.lol.Models {
|
namespace Neighbourhood.omg.lol.Models {
|
||||||
public class State {
|
public class State {
|
||||||
|
|
||||||
|
public Page CurrentPage { get; set; }
|
||||||
public AccountResponseData? AccountInfo { get; set; }
|
public AccountResponseData? AccountInfo { get; set; }
|
||||||
public AddressResponseList? AddressList { get; set; }
|
public AddressResponseList? AddressList { get; set; }
|
||||||
|
|
||||||
|
@ -205,4 +207,13 @@ namespace Neighbourhood.omg.lol.Models {
|
||||||
return offsetString;
|
return offsetString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Page {
|
||||||
|
None = 0,
|
||||||
|
Status,
|
||||||
|
Pics,
|
||||||
|
Ephemeral,
|
||||||
|
Person,
|
||||||
|
Other
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue