Build / Build (push) Successful in 33s
- Every number shown on a page goes through NumbersExtensions: counts, percentages, the nerd readouts and the values written into a style. - A failure the client builds itself (offline, timeout, retries run out, an answer it can't read) is a 400 that names its kind; only a server's own 5XX passes through. - Login, sign-up, recovery and password confirmations leave autocomplete to the browser, so it can offer the saved login. - The Daisy components start with empty lists and attributes, and a decorative image still renders alt="". - Arasaka.HouseRules.Analyzers checks all of this in every build, together with PrivaPub.ClientModels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
65 lines
1.3 KiB
C#
65 lines
1.3 KiB
C#
using decePubClient.Components.Daisy;
|
|
|
|
namespace decePubClient.Services
|
|
{
|
|
/// <summary>
|
|
/// The overlays open now, newest last (IDOverlayHost): MainLayout closes the newest when the Back button is pressed
|
|
/// while one is open, and all of them when the app goes elsewhere.
|
|
/// </summary>
|
|
public class OverlayService : IDOverlayHost
|
|
{
|
|
readonly List<Entry> open = [];
|
|
|
|
public bool HasOpen
|
|
{
|
|
get
|
|
{
|
|
lock (open)
|
|
return open.Count > 0;
|
|
}
|
|
}
|
|
|
|
public IDisposable Open(Func<Task> close)
|
|
{
|
|
var entry = new Entry(this, close);
|
|
lock (open)
|
|
open.Add(entry);
|
|
return entry;
|
|
}
|
|
|
|
public async Task CloseTop(CancellationToken cancellationToken = default)
|
|
{
|
|
var top = default(Entry);
|
|
lock (open)
|
|
top = open.LastOrDefault();
|
|
if (top is null)
|
|
return;
|
|
top.Dispose();
|
|
await top.Close();
|
|
}
|
|
|
|
public async Task CloseAll(CancellationToken cancellationToken = default)
|
|
{
|
|
var all = default(Entry[]);
|
|
lock (open)
|
|
{
|
|
all = [.. open];
|
|
open.Clear();
|
|
}
|
|
foreach (var entry in all.Reverse())
|
|
await entry.Close();
|
|
}
|
|
|
|
sealed class Entry(OverlayService owner, Func<Task> close) : IDisposable
|
|
{
|
|
public Func<Task> Close { get; } = close;
|
|
|
|
public void Dispose()
|
|
{
|
|
lock (owner.open)
|
|
owner.open.Remove(this);
|
|
}
|
|
}
|
|
}
|
|
}
|