Phase 1 completed on top of the library foundations: - Server: startup state machine (config, first run, database down, schema, identity, ready) with an error page that retries by itself; the configured database is the only one ever opened, and a vanished SQLite file is never recreated. REST API and status WebSocket; session cookie auth, CSRF on every form and write call; desktop and demo answer only the computer itself. - Interface: static Blazor rendering with plain forms (no interactive runtime), menu, top bar and phone bottom bar as in the mockups, light and dark themes with appendix C tokens and a contrast test, Panoramica, Diario, Rischio, Impostazioni; service pages for sign-in, first access, desktop first run and the database error page with its choices. - Demo mode (tasks seed-demo): appendix F in a database of its own under the temp folder, frozen clock, never touches the configured installation. - Docker: entrypoint gives /data to PUID:PGID and drops root with setpriv, HEALTHCHECK through bash /dev/tcp; proven with SQLite, PostgreSQL, a wrong configuration and a database that goes away and comes back. - tasks screenshots drives the installed Edge/Chrome through DevTools for exact 1440 and 390 pixel shots; anubis db export|import on the command line. Fixes from the independent review: return paths without control characters, Host check against DNS rebinding, attempt limit counted before the check and also on the error-page password, one-use TOTP codes and a code to switch the second factor off, error-page choices serialized with the startup loop, identity checked before migrating, restore restarts with "Ferma tutto" on, damaged archives reported instead of crashing. Running the server tests on PostgreSQL exposed pages rendered before their data arrived; data-loading components now load first (LoadedComponent). Decisions in ADR 0007. Tests: 100 on SQLite and on PostgreSQL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
2.0 KiB
C#
40 lines
2.0 KiB
C#
namespace Anubis.Server.Components;
|
|
|
|
internal sealed record MenuItem(string Path, string Label, string Icon, string Title);
|
|
|
|
/// <summary>The screens of SPEC 13.6 in the order of the mockups.</summary>
|
|
internal static class Menu
|
|
{
|
|
public static readonly MenuItem Overview = new("/", "Panoramica", "grid", "Panoramica");
|
|
public static readonly MenuItem Accounts = new("/conti", "Conti e posizioni", "card", "Conti e posizioni");
|
|
public static readonly MenuItem Trades = new("/operazioni", "Operazioni", "arrows", "Operazioni");
|
|
public static readonly MenuItem Strategies = new("/strategie", "Strategie", "layers", "Strategie");
|
|
public static readonly MenuItem News = new("/notizie", "Notizie e mercato", "news", "Notizie e mercato");
|
|
public static readonly MenuItem Learning = new("/apprendimento", "Apprendimento", "network", "Apprendimento");
|
|
public static readonly MenuItem Risk = new("/rischio", "Rischio", "shield", "Rischio");
|
|
public static readonly MenuItem Journal = new("/diario", "Diario e sistema", "list", "Diario e sistema");
|
|
public static readonly MenuItem Lab = new("/laboratorio", "Laboratorio", "flask", "Laboratorio");
|
|
public static readonly MenuItem Settings = new("/impostazioni", "Impostazioni", "sliders", "Impostazioni");
|
|
public static readonly MenuItem More = new("/altro", "Altro", "dots", "Altro");
|
|
|
|
public static readonly IReadOnlyList<IReadOnlyList<MenuItem>> Groups =
|
|
[
|
|
[Overview, Accounts, Trades],
|
|
[Strategies, News, Learning],
|
|
[Risk, Journal, Lab, Settings],
|
|
];
|
|
|
|
/// <summary>The bottom bar of the phone (SPEC 13.4).</summary>
|
|
public static readonly IReadOnlyList<MenuItem> Phone =
|
|
[
|
|
Overview,
|
|
Accounts with { Label = "Conti" },
|
|
Journal with { Label = "Diario" },
|
|
Risk,
|
|
More,
|
|
];
|
|
|
|
public static string Title(string path) =>
|
|
Groups.SelectMany(g => g).Append(More).FirstOrDefault(i => i.Path == "/" ? path == "/" : path.StartsWith(i.Path, StringComparison.Ordinal))?.Title ?? "Anubis";
|
|
}
|