@@ -73,7 +72,6 @@
get => $"https://{Address}.omg.lol/";
}
- private EditPicDialog? editPicDialog { get; set; }
public ExternalPageComponent? NowPage { get; set; }
public ExternalPageComponent? ProfilePage { get; set; }
@@ -86,9 +84,14 @@
private NowData? now;
protected override async Task OnInitializedAsync() {
+ List
? garden = await State.GetNowGarden();
+ now = garden?.FirstOrDefault(n => n.Address == Address);
+ await InvokeAsync(StateHasChanged);
+ string fragment = new Uri(Nav.Uri).Fragment;
+ await JS.InvokeVoidAsync("ui", fragment);
+ if (fragment.EndsWith("now")) await ReloadNow();
+ else if (fragment.EndsWith("profile")) await ReloadProfile();
bio = await State.GetBio(Address);
- List garden = await State.GetNowGarden();
- now = garden.FirstOrDefault(n => n.Address == Address);
}
private async Task ReloadNow() {
diff --git a/Components/Pages/Pics.razor b/Components/Pages/Pics.razor
index 95351b1..29f0e4d 100644
--- a/Components/Pages/Pics.razor
+++ b/Components/Pages/Pics.razor
@@ -1,16 +1,9 @@
@page "/pics"
@inject State State
-@inject IJSRuntime JS
-
-
-
- Some.pics
-
-
-
+
+ Sit back, relax, and look at some.pics
+
diff --git a/Components/Pages/StatuslogLatest.razor b/Components/Pages/StatuslogLatest.razor
index 62d9bfa..2d2e060 100644
--- a/Components/Pages/StatuslogLatest.razor
+++ b/Components/Pages/StatuslogLatest.razor
@@ -1,14 +1,9 @@
@page "/statuslog/latest"
@inject State State
-
-
- Statuslog
-
-
-
+
+ The latest posts from everyone at status.lol
+
@@ -20,10 +15,9 @@
-
+
-
@code {
}
diff --git a/Components/PicCard.razor b/Components/PicCard.razor
index 55efda8..2ca63d6 100644
--- a/Components/PicCard.razor
+++ b/Components/PicCard.razor
@@ -12,7 +12,7 @@
@Pic.RelativeTime
- @Pic.Description
+ @((MarkupString)Pic.DescriptionHtml)
@if(Editable) {
diff --git a/Components/PicList.razor b/Components/PicList.razor
index 37af9fa..aef6e07 100644
--- a/Components/PicList.razor
+++ b/Components/PicList.razor
@@ -2,112 +2,30 @@
@inject State State
@if (Editable) {
-
-}
-else {
-
+
}
-
-
-
+@if (pics != null) foreach (Pic pic in pics) {
+
+}
-
-
+
@code {
[Parameter]
public Func?>> PicsFunc { get; set; }
[Parameter]
public bool Editable { get; set; } = false;
- [Parameter]
+
public EditPicDialog? Dialog { get; set; }
- private List pics;
- private DotNetObjectReference? objRef;
+ private List? pics;
- 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);
- 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");
- }
- }
-
- [JSInvokable]
- public async Task EditClick(string? id) {
- if (Editable && Dialog != null)
- {
- Pic? pic = pics.FirstOrDefault(p => p.Id == id);
- Dialog.Pic = pic;
- // await InvokeAsync(StateHasChanged);
- await JS.InvokeVoidAsync("ui", "#" + Dialog?.id);
- }
- }
-
- [JSInvokable]
- public async Task ShareClick(string? url, string? description) {
- await Share.Default.RequestAsync(new ShareTextRequest {
- Uri = url,
- Text = description,
- Title = "I saw this on some.pics",
- Subject = "I saw this on some.pics"
- });
+ // TODO: There is a noticable rendering delay between the pics loading and the page rendering
+ protected override async Task OnInitializedAsync() {
+ await base.OnInitializedAsync();
+ if (pics == null || pics.Count == 0) pics = await PicsFunc();
+ await InvokeAsync(StateHasChanged);
+ await JS.InvokeVoidAsync("removeElementById", "pics-loading");
}
}
\ No newline at end of file
diff --git a/Components/StatusCard.razor b/Components/StatusCard.razor
index 8e909a0..ffdbab3 100644
--- a/Components/StatusCard.razor
+++ b/Components/StatusCard.razor
@@ -1,25 +1,25 @@
-
@status.EmojiOrDefault
+
@status.EmojiOrDefault
-
-
- @status.RelativeTime
-
-
- Respond
-
-
-
-
-
-
@code {
diff --git a/Components/StatusList.razor b/Components/StatusList.razor
index 90af0c0..a63b2a1 100644
--- a/Components/StatusList.razor
+++ b/Components/StatusList.razor
@@ -1,23 +1,24 @@
-@inject State State
-
-
-
-
-
-
-
-
+@inject IJSRuntime JS
+@inject State State
+
+@if(statuses != null) foreach(Status status in statuses) {
+
+}
+
+
@code {
[Parameter]
- public Func>> StatusFunc { get; set; }
+ public Func?>> StatusFunc { get; set; }
+ [Parameter]
+ public bool Editable { get; set; } = false;
+
+ private List? statuses;
- private async ValueTask> GetStatuses(ItemsProviderRequest request) {
- return await this.StatusFunc(request);
- }
-
- protected override void OnInitialized() {
- base.OnInitialized();
- State.CurrentPage = Page.Status;
+ protected override async Task OnInitializedAsync() {
+ await base.OnInitializedAsync();
+ if (statuses == null || statuses.Count == 0) statuses = await StatusFunc();
+ await InvokeAsync(StateHasChanged);
+ await JS.InvokeVoidAsync("removeElementById", "statusLoading");
}
}
diff --git a/Models/Pic.cs b/Models/Pic.cs
index 6d7d355..c0554ce 100644
--- a/Models/Pic.cs
+++ b/Models/Pic.cs
@@ -17,7 +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); }
+ public string DescriptionHtml { get => Description == null ? string.Empty : Markdown.ToHtml(Description); }
[JsonPropertyName("exif")]
public JsonElement ExifJson { get; set; }
diff --git a/Models/State.cs b/Models/State.cs
index 42b57f1..e1c2397 100644
--- a/Models/State.cs
+++ b/Models/State.cs
@@ -25,6 +25,7 @@ namespace Neighbourhood.omg.lol.Models {
public List? Statuses { get; set; }
public List? Pics { get; set; }
public List? NowGarden { get; set; }
+ public List? EphemeralMessages { get; set; }
public List? CachedAddressStatuses { get; set; }
public List? CachedAddressPics { get; set; }
@@ -88,6 +89,14 @@ namespace Neighbourhood.omg.lol.Models {
return CachedAddressBio;
}
+ public async Task?> GetEphemeralMessages(bool forceRefresh = false) {
+ RestService api = new RestService();
+ if(forceRefresh || this.EphemeralMessages == null || this.EphemeralMessages.Count == 0) {
+ this.EphemeralMessages = await api.Ephemeral();
+ }
+ return this.EphemeralMessages;
+ }
+
public async Task?> GetStatuses(bool forceRefresh = false) {
RestService api = new RestService();
if (forceRefresh || this.Statuses == null || this.Statuses.Count == 0) {
@@ -96,27 +105,13 @@ namespace Neighbourhood.omg.lol.Models {
return this.Statuses;
}
- public async ValueTask> VirtualStatuses(ItemsProviderRequest request) {
- // TODO: request.cancellationToken
- var statuses = (await this.GetStatuses()) ?? new List();
- var numStatuses = Math.Min(request.Count, statuses.Count - request.StartIndex);
- return new ItemsProviderResult(statuses.Skip(request.StartIndex).Take(numStatuses), statuses.Count);
- }
-
- public async ValueTask> VirtualStatuses(ItemsProviderRequest request, string address) {
- // TODO: request.cancellationToken
+ public async Task?> GetStatuses(string address, bool forceRefresh = false) {
+ this.CachedAddress = address;
RestService api = new RestService();
- CachedAddressStatuses = (await api.Statuslog(address)) ?? new List();
- var numStatuses = Math.Min(request.Count, CachedAddressStatuses.Count - request.StartIndex);
- return new ItemsProviderResult(CachedAddressStatuses.Skip(request.StartIndex).Take(numStatuses), CachedAddressStatuses.Count);
- }
-
- public Func>> VirtualStatusesFunc(string? address = null) {
- if (address == null) return VirtualStatuses;
- else {
- CachedAddress = address;
- return async (ItemsProviderRequest request) => await VirtualStatuses(request, CachedAddress);
+ if (forceRefresh || this.CachedAddressStatuses == null || this.CachedAddressStatuses.Count == 0) {
+ this.CachedAddressStatuses = await api.Statuslog(address);
}
+ return this.CachedAddressStatuses;
}
public async Task?> GetNowGarden(bool forceRefresh = false) {
@@ -126,16 +121,6 @@ namespace Neighbourhood.omg.lol.Models {
}
return this.NowGarden;
}
- public async ValueTask> VirtualNowGarden(ItemsProviderRequest request) {
- // TODO: request.cancellationToken
- var garden = (await this.GetNowGarden()) ?? new List();
- var numSeedlings = Math.Min(request.Count, garden.Count - request.StartIndex);
- return new ItemsProviderResult(garden.Skip(request.StartIndex).Take(numSeedlings), garden.Count);
- }
-
- public Func>> VirtualNowGardenFunc() {
- return VirtualNowGarden;
- }
public async Task?> GetPics(bool forceRefresh = false) {
if(forceRefresh || this.Pics == null || this.Pics.Count == 0) {
@@ -147,36 +132,13 @@ namespace Neighbourhood.omg.lol.Models {
public async Task?> GetPics(string address, bool forceRefresh = false) {
CachedAddress = address;
- if (forceRefresh || this.Pics == null || this.Pics.Count == 0) {
+ if (forceRefresh || this.CachedAddressPics == null || this.CachedAddressPics.Count == 0) {
RestService api = new RestService();
CachedAddressPics = (await api.SomePics(address)) ?? new List();
}
return CachedAddressPics;
}
- public async ValueTask> VirtualPics(ItemsProviderRequest request) {
- // TODO: request.cancellationToken
- var pics = (await this.GetPics()) ?? new List();
- var numPics = Math.Min(request.Count, pics.Count - request.StartIndex);
- return new ItemsProviderResult(pics.Skip(request.StartIndex).Take(numPics), pics.Count);
- }
-
- public async ValueTask> VirtualPics(ItemsProviderRequest request, string address) {
- // TODO: request.cancellationToken
- RestService api = new RestService();
- CachedAddressPics = (await api.SomePics(address)) ?? new List();
- var numPics = Math.Min(request.Count, CachedAddressPics.Count - request.StartIndex);
- return new ItemsProviderResult(CachedAddressPics.Skip(request.StartIndex).Take(numPics), CachedAddressPics.Count);
- }
-
- public Func>> VirtualPicsFunc(string? address = null) {
- if (address == null) return VirtualPics;
- else {
- CachedAddress = address;
- return async (ItemsProviderRequest request) => await VirtualPics(request, CachedAddress);
- }
- }
-
public async Task FileSize(FileResult file) {
using var fileStream = await file.OpenReadAsync();
return fileStream.Length;
@@ -213,7 +175,7 @@ namespace Neighbourhood.omg.lol.Models {
Status,
Pics,
Ephemeral,
- Person,
+ NowGarden,
Other
}
}
diff --git a/wwwroot/css/style.css b/wwwroot/css/style.css
index 1a59572..5ff9421 100644
--- a/wwwroot/css/style.css
+++ b/wwwroot/css/style.css
@@ -10,6 +10,13 @@
--emoji-font: SegoeUIEmoji, 'Segoe UI Emoji', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Symbol';
--font: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif, var(--emoji-font);
--prami-svg: url('data:image/svg+xml, ');
+ --spacing: 1.5rem;
+ --radius: .75em;
+ --small-radius: .13em;
+/* --color: var(--white);
+ --background: var(--gray-8);
+ --shadow: var(--black);
+ --button-shadow: var(--gray-7);*/
}
html, body {
font-family: var(--font);
@@ -53,13 +60,17 @@ img {
.status .emoji, #status-emoji {
margin-bottom: auto;
- inline-size: 3.5rem;
- block-size: 3.5rem;
- font-size: 3.1rem;
- line-height: 3.5rem;
+ inline-size: 5.5rem;
+ block-size: 5.5rem;
+ font-size: 5rem;
+ line-height: 5.5rem;
text-indent: -6px;
}
+.status nav .chip, .status nav {
+ color: var(--gray-7);
+}
+
.profile.avatar {
border-radius: .75rem;
max-block-size: 10rem;
@@ -268,4 +279,12 @@ main {
.hover {
z-index: 1;
+}
+
+#info :is(ul, ol) {
+ margin-left: var(--spacing);
+}
+
+#info :is(p, ul, ol) {
+ margin-bottom: var(--spacing);
}
\ No newline at end of file
diff --git a/wwwroot/js/csharp.js b/wwwroot/js/csharp.js
index 7647a6e..544181e 100644
--- a/wwwroot/js/csharp.js
+++ b/wwwroot/js/csharp.js
@@ -1,3 +1,14 @@
window.injectCSharp = async function (helper) {
window.CSHARP = helper
+}
+
+
+async function delay(t) {
+ return new Promise((resolve) => {
+ setTimeout(resolve, t);
+ });
+}
+
+async function removeElementById(id) {
+ document.getElementById(id)?.remove()
}
\ No newline at end of file