D1, terza parte: Dashboard come pagina iniziale ovunque, miniature anche del Giro

Richiesta di Alberto (#59, parte b): la Dashboard al posto di Attività, prima voce e
pagina iniziale, compatta, con l'anteprima del browser sempre visibile e le miniature di
ciò che è arrivato. La prima parte (d6c0ef8) aveva già pagina, rotte e anteprima; qui si
chiude ciò che mancava.

- La finestra di Febe per Windows apre /dashboard?gettone=… (non più /): tolto il
  gettone l'indirizzo resta /dashboard.
- La voce Dashboard ha un'icona sua, layout-dashboard, disegnata in casa.
- Cronologia: anche le righe del Giro dei seguiti, che non hanno un account, mostrano le
  miniature di ciò che è arrivato di tutti gli account; mai gli elementi importati. Indice
  ix_entry_discovered nella migrazione 0002 (non ancora unita), così la domanda legge
  solo le righe dei minuti della ricetta anche con 200.000 elementi.
- Anteprima ingrandita: le frecce funzionano anche con il fuoco sui pulsanti del piede,
  «Apri l'account» segue l'elemento mostrato, chiudendo non si disegna più nulla.
- Al telefono il cruscotto è più basso (anteprima 196 px, miniature 40 px).
- Guida: «Attività e arresti» diventa «Dashboard e arresti», collegamenti e testi delle
  altre pagine aggiornati; differenze dai mockup in docs/schermate/differenze.md; quattro
  righe in docs/decisioni.md.
- Prove: DashboardApiTests (riga del Giro, importati esclusi, domande sbagliate),
  DesktopCompositionTests (/dashboard), GuideTests; DashboardInterfaceTests con Chromium
  (miniature, anteprima, frecce, Esc, una colonna sotto i 1000 px), solo nella CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-25 16:00:02 +01:00
1 parent 0547c747c5
commit 34fe5e9073
31 files changed
+265 -78

No files matched your search

@@ -39,13 +39,15 @@ public sealed class DesktopCompositionTests
Assert.AreEqual(HttpStatusCode.Unauthorized, anonymous.StatusCode, path);
}
// The window opens /?gettone=… once: the token becomes an HttpOnly cookie and leaves the address.
// The window opens /dashboard?gettone=… once (the Dashboard is the start page, spec §7.9, §12): the token
// becomes an HttpOnly cookie and leaves the address, which stays on the Dashboard.
var first = bed.Platform.FirstAddress(bed.App.Address);
Assert.AreEqual("/dashboard", first.AbsolutePath);
StringAssert.StartsWith(first.Query, "?gettone=");
using (var opening = await bed.Client.GetAsync(first.PathAndQuery, TestContext.CancellationToken))
{
Assert.AreEqual(HttpStatusCode.Redirect, opening.StatusCode);
Assert.AreEqual("/", opening.Headers.Location?.OriginalString);
Assert.AreEqual("/dashboard", opening.Headers.Location?.OriginalString);
var cookie = opening.Headers.GetValues("Set-Cookie").Single();
StringAssert.Contains(cookie, "httponly");
StringAssert.Contains(cookie, "samesite=strict");
+2 -2
View File
@@ -21,7 +21,7 @@ public sealed partial class GuideTests
"Libreria",
"Importazione",
"Limiti-e-comportamento",
"Attivita-e-arresti",
"Dashboard-e-arresti",
"Avvisi-e-Telegram",
"Copie-e-ricostruzione",
"Sicurezza-e-riservatezza",
@@ -45,7 +45,7 @@ public sealed partial class GuideTests
["l'interfaccia Docker non va esposta su Internet", new[] { "Sicurezza-e-riservatezza" }, new[] { "non esporre mai l'interfaccia docker su internet", "vpn", "https" }],
["in Docker la password di Instagram passa dal server", new[] { "Primo-collegamento", "Sicurezza-e-riservatezza" }, new[] { "la password di instagram passa dal server" }],
["il compromesso sulla sandbox di Chromium", new[] { "Installazione-Docker-e-Unraid", "Sicurezza-e-riservatezza" }, new[] { "sandbox", "seccomp", "febe_senza_sandbox=1", "compromesso" }],
["che cosa fare dopo una verifica o un rallentamento", new[] { "Attivita-e-arresti" }, new[] { "che cosa fare dopo una verifica", "che cosa fare dopo un rallentamento", "completa la verifica a mano", "riprendi", "tre rallentamenti in sette giorni" }],
["che cosa fare dopo una verifica o un rallentamento", new[] { "Dashboard-e-arresti" }, new[] { "che cosa fare dopo una verifica", "che cosa fare dopo un rallentamento", "completa la verifica a mano", "riprendi", "tre rallentamenti in sette giorni" }],
["dove sono le copie del database e come si ricostruisce", new[] { "Copie-e-ricostruzione" }, new[] { "/dati/copie", "%localappdata%\\febe\\copie", "febe-aaaa-mm-gg.sqlite", "ricostruisci il database dalla libreria", "_febe.jsonl" }],
["esportazione CSV dell'elenco (§4.8)", new[] { "Libreria" }, new[] { "esporta l'elenco", "`;`", "utf-8 con bom" }],
["Telegram: BotFather e identificativo della chat (§13.3)", new[] { "Avvisi-e-Telegram" }, new[] { "@botfather", "/newbot", "getupdates", "\"chat\":{\"id\":", "invia una prova" }],
+28 -2
View File
@@ -40,8 +40,34 @@ public sealed class DashboardApiTests
var (status, _, _) = await server.GetAsync($"/api/activity/arrived?account={marta.Id}&from={to}&to={from}");
Assert.AreEqual(HttpStatusCode.BadRequest, status, "the end before the start");
(status, _, _) = await server.GetAsync("/api/activity/arrived?account=uno");
Assert.AreEqual(HttpStatusCode.BadRequest, status);
(status, _, _) = await server.GetAsync($"/api/activity/arrived?account=uno&from={from}&to={to}");
Assert.AreEqual(HttpStatusCode.BadRequest, status, "an account that is no number");
(status, _, _) = await server.GetAsync($"/api/activity/arrived?account={marta.Id}");
Assert.AreEqual(HttpStatusCode.BadRequest, status, "no time");
}
[TestMethod]
public async Task ALineOfTheGiroGetsWhatArrivedOfEveryAccountButNeverTheImportedFiles()
{
// The Giro dei seguiti saves posts of many accounts: its line has no account and shows what arrived of all of
// them in its time. What an import brought in meanwhile is not something the engine downloaded.
await using var server = await Part2.StartAsync();
var marta = await server.Db.Accounts.AddAsync(Make.Account("marta.prova"));
var luca = await server.Db.Accounts.AddAsync(Make.Account("luca.prova"));
var start = Make.T0.AddHours(1);
await server.Db.Entries.AddAsync(Make.Entry(marta.Id, "uno", Make.T0) with { DiscoveredAt = start.AddSeconds(5) }, [Make.Photo()]);
await server.Db.Entries.AddAsync(Make.Entry(luca.Id, "due", Make.T0) with { DiscoveredAt = start.AddSeconds(20) }, [Make.Photo()]);
await server.Db.Entries.AddAsync(Make.Entry(luca.Id, "importato", Make.T0) with { DiscoveredAt = start.AddSeconds(30), Provenance = Provenance.Imported }, [Make.Photo()]);
await server.Db.Entries.AddAsync(Make.Entry(luca.Id, "dopo", Make.T0) with { DiscoveredAt = start.AddMinutes(5) }, [Make.Photo()]);
var from = Uri.EscapeDataString(start.ToString("O"));
var to = Uri.EscapeDataString(start.AddMinutes(1).ToString("O"));
var all = await server.GetJsonAsync($"/api/activity/arrived?from={from}&to={to}");
Assert.AreEqual(2, all.Int("total"), "both accounts, without the imported entry and what came after");
CollectionAssert.AreEqual(new long[] { luca.Id, marta.Id }, all.Items("tiles").Select(t => (long)t.Int("accountId")).ToArray(), "newest first");
var one = await server.GetJsonAsync($"/api/activity/arrived?account={luca.Id}&from={from}&to={to}");
Assert.AreEqual(1, one.Int("total"), "a line of one account: never the imported entry");
}
[TestMethod]
@@ -0,0 +1,64 @@
using Febe.Tests.Support;
using Febe.Tests.Web.Support;
using Febe.Web.Demo;
namespace Febe.Tests.Web;
/// <summary>
/// The Dashboard in a real browser, on the demo (spec §7.9, §10.3, tappa D1): the first item of the sidebar with its own
/// icon, the preview of the browser always visible at the top, the thumbnails of the history and the enlarged preview
/// they open (arrows, Esc, «Apri l'account», «Apri nella Libreria»), and one column below 1000 px. Chromium only (CI).
/// </summary>
[TestClass]
public sealed class DashboardInterfaceTests
{
[TestMethod]
public async Task TheHistoryThumbnailsOpenALightPreviewThatTheArrowsWalkAndEscCloses()
{
await using var ui = await UiBrowser.StartAsync(1440, 900);
using var temp = new TempFolder("dashboard-ui");
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
await ui.OpenAsync(new Uri(demo.Address, "/?scena=sessione"));
await ui.WaitAsync("location.pathname === '/dashboard' && document.querySelector('main .dashboard .cruscotto .anteprima img:not([hidden])') !== null", "Dashboard con l'anteprima del browser");
Assert.AreEqual("#i-layout-dashboard", (await ui.EvalAsync("document.querySelector('.nav a[data-nav=dashboard] use').getAttribute('href')")).GetString(), "la sua icona");
Assert.AreEqual("dashboard", (await ui.EvalAsync("document.querySelector('.nav a').dataset.nav")).GetString(), "prima voce");
Assert.IsTrue((await ui.EvalAsync("(() => { const p = document.querySelector('.cruscotto .anteprima').getBoundingClientRect(); return p.top < 200 && p.bottom <= innerHeight; })()")).GetBoolean(), "l'anteprima sta in alto, intera, senza scorrere " + ui.Report());
// The thumbnails of a line come when it is in view; a click opens the light dialog, not the full viewer.
await ui.EvalAsync("document.querySelector('.storia').scrollIntoView()");
// A line with two thumbnails at least, so that the arrows have somewhere to go.
const string Line = "[...document.querySelectorAll('.storia .miniature')].find((m) => m.querySelectorAll('.miniatura').length >= 2)";
await ui.WaitAsync($"({Line}) !== undefined", "miniature della cronologia");
await ui.EvalAsync($"({Line}).querySelector('.miniatura').click()");
await ui.WaitAsync("document.querySelector('.dialogo.anteprima-cronologia .anteprima-palco img, .dialogo.anteprima-cronologia .anteprima-palco video, .dialogo.anteprima-cronologia .anteprima-neutra') !== null", "anteprima ingrandita");
Assert.IsTrue((await ui.EvalAsync("document.querySelector('.vis') === null")).GetBoolean(), "non il visualizzatore a tutta finestra");
var first = (await ui.EvalAsync("document.querySelector('.anteprima-cronologia footer .dati').textContent")).GetString();
var dida = (await ui.EvalAsync("document.querySelector('.anteprima-cronologia .anteprima-dida').textContent")).GetString();
StringAssert.StartsWith(dida, "@");
StringAssert.StartsWith((await ui.EvalAsync("new URL(document.querySelector('.anteprima-cronologia footer a.btn').href).pathname")).GetString(), "/account/", "«Apri l'account»");
// The arrows walk the files of the line also with the focus on a button of the footer.
await ui.EvalAsync("document.querySelector('.anteprima-cronologia footer button.primo').focus()");
await ui.EvalAsync("document.activeElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight', bubbles: true }))");
await ui.WaitAsync($"document.querySelector('.anteprima-cronologia .anteprima-dida').textContent !== {System.Text.Json.JsonSerializer.Serialize(dida)} || document.querySelector('.anteprima-cronologia footer .dati').textContent !== {System.Text.Json.JsonSerializer.Serialize(first)}", "la freccia passa al file seguente");
await ui.EvalAsync("document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))");
await ui.WaitAsync("document.querySelector('.anteprima-cronologia') === null", "Esc chiude");
Assert.AreEqual("/dashboard", (await ui.EvalAsync("location.pathname")).GetString(), "senza lasciare la pagina");
}
[TestMethod]
public async Task BelowAThousandPixelsTheDashboardIsOneColumnWithThePreviewOnTop()
{
await using var ui = await UiBrowser.StartAsync(860, 900);
using var temp = new TempFolder("dashboard-stretta");
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
await ui.OpenAsync(new Uri(demo.Address, "/dashboard?scena=sessione&tema=scuro"));
await ui.WaitAsync("document.querySelector('main .dashboard .cruscotto .anteprima') !== null && document.querySelector('.storia') !== null", "Dashboard stretta");
Assert.IsTrue((await ui.EvalAsync("(() => { const a = document.querySelector('.cruscotto .anteprima').getBoundingClientRect(); const s = document.querySelector('.cruscotto-lato').getBoundingClientRect(); return a.bottom <= s.top + 1; })()")).GetBoolean(), "l'anteprima sopra lo stato e i tetti");
Assert.IsTrue((await ui.EvalAsync("(() => { const h = document.querySelector('.storia').getBoundingClientRect(); const q = document.querySelector('.coda').getBoundingClientRect(); return h.bottom <= q.top + 1; })()")).GetBoolean(), "cronologia e coda in una colonna");
Assert.IsTrue((await ui.EvalAsync("document.documentElement.scrollWidth <= innerWidth")).GetBoolean(), "nessuno scorrimento orizzontale");
}
}