D1, correzioni della revisione: conteggi della Libreria più rapidi, frecce che seguono le tessere, Dashboard nei testi
- /api/library/days in «Tutte le foto» faceva due volte il passaggio su tutta la tabella media a ogni aggiornamento del mosaico: il totale dei file è ora la somma dei giorni (CountLibraryFilesAsync tolto). - I totali e i conteggi per giorno di «Foto» e «Video» su tutta la libreria non pagano più un EXISTS per post (1,3-1,6 s): elenco degli elementi con file di quel tipo su un indice di copertura, 86-141 ms su 200.000 elementi; nuove misure con limite 600 ms in LibraryScaleTests. - La quota di chi aspetta non è un minimo per tipo: corretti commento e decisioni, prova con un arretrato più vecchio di un altro tipo. - Visualizzatore in «Tutte le foto»: le frecce saltano i file che non sono tessere (foto sotto «Video» e simili) e l'intestazione non dà il numero di un altro file; la voce già scelta dell'interruttore non ridisegna il mosaico. Prova d'interfaccia nuova (solo CI). - «Ricetta sospesa» dice di riattivarla dalla Dashboard, non da Attività; commenti aggiornati. - Nomi accessibili distinti nella scheda account, variabile in inglese in download-order.js, icona activity tolta perché nessuna pagina la usa. - Schermate 06, 11 e 14 rifatte con /dashboard e nuova 01-libreria-tutte-le-foto, confrontate con i mockup in docs/schermate/differenze.md (con quattro difetti visivi ancora da sistemare). - LEGGIMI del web (mode, cursore, files, moduli riusabili) e guida della Libreria (la scelta del mosaico resta nel browser, a differenza del tema). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30e159cbd4
commit
58ff4e48b3
44 files changed
+261
-118
No files matched your search
@@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Routing;
|
||||
namespace Febe.Web.Api;
|
||||
|
||||
/// <summary>
|
||||
/// What the Attività page needs beside the engine snapshot (spec §7.6, §7.9, mockups 06 and 11): the history of the
|
||||
/// What the Dashboard (before: Attività) needs beside the engine snapshot (spec §7.6, §7.9, mockups 06 and 11): the history of the
|
||||
/// stops, the still frame of the browser, the probable duplicates waiting for Alberto, the diagnostic report.
|
||||
/// </summary>
|
||||
public static class ActivityApi
|
||||
|
||||
@@ -285,7 +285,7 @@ public sealed record ProfileSearchHitDto(string InstagramId, string Username, st
|
||||
/// <param name="State">"connected", "notConnected", "verification", "disconnected".</param>
|
||||
public sealed record ConnectionDto(string State, string? Username, string? DisplayName, string? Avatar);
|
||||
|
||||
/// <summary>The engine for the sidebar, the stop strip and the Attività page.</summary>
|
||||
/// <summary>The engine for the sidebar, the stop strip and the Dashboard.</summary>
|
||||
public sealed record EngineDto(long Now, EngineSnapshot Snapshot, ConnectionDto Connection, bool CanResume);
|
||||
|
||||
public sealed record ResumeDto(bool Resumed, string Message);
|
||||
|
||||
@@ -33,8 +33,9 @@ public static class LibraryApi
|
||||
var filter = ApiMapping.Filter(context.Request.Query, zone);
|
||||
var mode = ApiMapping.Mode(context.Request.Query["mode"]);
|
||||
var totals = await storage.Entries.GetLibraryTotalsAsync(filter, ct).ConfigureAwait(false);
|
||||
int? files = mode == MosaicMode.Files ? await storage.Entries.CountLibraryFilesAsync(filter, ct).ConfigureAwait(false) : null;
|
||||
var days = await storage.Entries.CountLibraryByDayAsync(filter, zone, mode, ct).ConfigureAwait(false);
|
||||
// The files of «Tutte le foto» are the sum of their days: one pass over the media table per request.
|
||||
int? files = mode == MosaicMode.Files ? days.Sum(d => d.Count) : null;
|
||||
var list = days.Select(d =>
|
||||
{
|
||||
var end = LocalCalendar.StartOfDay(d.Day.AddDays(1), zone);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Febe.Web.Api;
|
||||
|
||||
// JSON shapes of the second part of the interface (Attività, Impostazioni, Importa, Collegamento, Browser, doppioni).
|
||||
// JSON shapes of the second part of the interface (Dashboard, Impostazioni, Importa, Collegamento, Browser, doppioni).
|
||||
// Same conventions as Dtos.cs: English camelCase names, Italian texts, times as Unix milliseconds or LocalTimeDto.
|
||||
|
||||
// ---------------------------------------------------------------- connection (PROTOCOLLO.md)
|
||||
@@ -64,7 +64,7 @@ public sealed record IncidentDto(
|
||||
public sealed record IncidentListDto(IReadOnlyList<IncidentDto> Items, int ThrottlesLastWeek, string? Advice);
|
||||
|
||||
/// <summary>
|
||||
/// A line of the «Avvisi» list of Attività (spec §13.3): an alert or a failed delivery. <see cref="Kind"/>:
|
||||
/// A line of the «Avvisi» list of the Dashboard (spec §13.3): an alert or a failed delivery. <see cref="Kind"/>:
|
||||
/// verification, disconnection, throttleStop, throttleEnd, backfillDone, unknownFormat, recipeSuspended, diskLow,
|
||||
/// deliveryFailed. <see cref="Level"/>: error, warning, success, info.
|
||||
/// </summary>
|
||||
|
||||
@@ -497,7 +497,7 @@ public static class DemoSeeder
|
||||
withNews == 0 ? "Giro dei profili che segui: nessuna novità" : $"Giro dei profili che segui: {withNews} contenuti nuovi", null));
|
||||
}
|
||||
|
||||
// The alerts of the last days (Attività, «Avvisi»): the throttle of three days ago (as DemoIncidentHistory) and
|
||||
// The alerts of the last days (Dashboard, «Avvisi»): the throttle of three days ago (as DemoIncidentHistory) and
|
||||
// its end, and the backfills completed in the last two weeks.
|
||||
var throttle = LocalCalendar.StartOfDay(today.AddDays(-3), zone) + TimeSpan.FromHours(18.4);
|
||||
var throttleEnd = throttle + TimeSpan.FromHours(1);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace Febe.Web.Engine;
|
||||
|
||||
/// <summary>A still frame of Febe's browser for the Attività page (mockup 06: one frame every few seconds, not a video).</summary>
|
||||
/// <summary>A still frame of Febe's browser for the Dashboard (mockup 06: one frame every few seconds, not a video).</summary>
|
||||
/// <param name="Jpeg">The frame, JPEG encoded.</param>
|
||||
/// <param name="Url">Address of the page, without query string.</param>
|
||||
/// <param name="At">When the frame was taken.</param>
|
||||
public sealed record BrowserFrame(byte[] Jpeg, string? Url, DateTimeOffset At);
|
||||
|
||||
/// <summary>
|
||||
/// The latest frame of Febe's browser, for the preview of the Attività page. Implemented by the composition over the
|
||||
/// The latest frame of Febe's browser, for the preview of the Dashboard. Implemented by the composition over the
|
||||
/// browser host (Docker: the screencast of the remote view; Windows: the WebView2). Taking frames is never an action
|
||||
/// toward the site: it reads what the browser already shows.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ using Febe.Core.Collection.Diagnostics;
|
||||
namespace Febe.Web.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// The traces of the diagnostic report (issue #39) for «Esporta il rapporto di diagnostica» in Attività: the finished
|
||||
/// The traces of the diagnostic report (issue #39) for «Esporta il rapporto di diagnostica» in the Dashboard: the finished
|
||||
/// ones of the last two weeks and the ones in progress, oldest first. They hold no data value
|
||||
/// (<see cref="SessionTrace"/>).
|
||||
/// </summary>
|
||||
|
||||
@@ -100,7 +100,7 @@ public sealed class OfflineEngine(IClock clock) : IEngineMonitor, IEngineControl
|
||||
/// <summary>Pieces for building snapshots outside <see cref="EngineMonitor"/> (offline engine, demo).</summary>
|
||||
public static class SnapshotParts
|
||||
{
|
||||
/// <summary>The four main budgets in the order of the Attività page.</summary>
|
||||
/// <summary>The four main budgets in the order of the Dashboard.</summary>
|
||||
public static readonly ActionKind[] Main = [ActionKind.ProfileOpen, ActionKind.StoryView, ActionKind.BackfillPage, ActionKind.DataDownload];
|
||||
|
||||
/// <summary>Every category in the order of the table of spec §7.5.</summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ using Febe.Core.Storage;
|
||||
|
||||
namespace Febe.Web.Engine;
|
||||
|
||||
/// <summary>The stops of the last days for the Attività page (spec §7.6: «nella cronologia della pagina Attività»).</summary>
|
||||
/// <summary>The stops of the last days for the Dashboard (spec §7.6 still says «nella cronologia della pagina Attività», the page before it).</summary>
|
||||
public interface IIncidentHistory
|
||||
{
|
||||
/// <summary>Incidents that started in [from, to), newest first.</summary>
|
||||
|
||||
@@ -107,8 +107,8 @@ sono anche `day` (`aaaa-mm-gg`) e `clock` calcolati sul fuso di Febe.
|
||||
| `GET /api/engine`, `POST /api/engine/pause`, `/resume` | Istantanea del motore, collegamento, `canResume` |
|
||||
| `POST /api/browser/show`, `/api/browser/used` | «Apri il browser» (desktop), uso del browser |
|
||||
| `GET /api/eventi` | SSE: `motore` (istantanea, al massimo ogni 300 ms, comunque ogni 60 s), `libreria` (al massimo ogni 1,5 s), commento ogni 25 s |
|
||||
| `GET /api/library/days` | Totali e giorni con conteggio e cursore (per la finestra del mosaico) |
|
||||
| `GET /api/library?cursor=&direction=older\|newer&limit=` | Una finestra di tessere, con `older`/`newer` per continuare; filtri `kind`, `accounts`, `from`, `to`, `provenance`, `q` |
|
||||
| `GET /api/library/days?mode=grouped\|files` | Totali (sempre elementi: `entries`, `accounts`) e giorni con conteggio e cursore (per la finestra del mosaico); con `mode=files` («Tutte le foto») i giorni contano i file presenti in libreria e `files` è la loro somma (altrimenti `null`). Un altro valore di `mode` dà 400. Stessi filtri di `/api/library` |
|
||||
| `GET /api/library?cursor=&direction=older\|newer&limit=&mode=grouped\|files` | Una finestra di tessere, con `older`/`newer` per continuare; filtri `kind`, `accounts`, `from`, `to`, `provenance`, `q`. Con `mode=files` una tessera per file (con la sua posizione e `files`, i file dell'elemento) e il cursore è `ms.elemento.posizione` (raggruppato `ms.elemento`); un cursore malformato o `mode` sconosciuto danno 400 |
|
||||
| `GET /api/library/tiles?ids=` | Tessere per chiave |
|
||||
| `GET /api/thumbnails/{chiave}`, `GET /api/media/{id}/file[?download=1]` | Miniature (immutabili) e file (con range) |
|
||||
| `GET /api/entries/{id}`, `POST /api/entries/delete`, `/export`, `/{id}/open-on-instagram`, `POST /api/media/show-in-folder` | Visualizzatore, eliminazione (`remember` o `allowReturn`), CSV (`{ ids }` per la selezione, `{ query }` per il filtro della pagina: «Esporta l'elenco» nella riga degli strumenti) |
|
||||
@@ -210,7 +210,12 @@ Moduli ES, nessuna dipendenza, nessuna build. Durante lo sviluppo si servono da
|
||||
|
||||
Pezzi riusabili delle pagine: `pages/mosaic.js` (`Mosaic`: righe giustificate o griglia 9:16, finestre per giorno,
|
||||
virtualizzazione, selezione, nuovi elementi in cima senza spostare la vista), `pages/viewer.js` (`openViewer`),
|
||||
`pages/accounts.js` (`checkNow`, `removeAccount`, `accountMenu`, `stateLine`), `pages/library.js` (`confirmDelete`).
|
||||
`pages/accounts.js` (`checkNow`, `removeAccount`, `accountMenu`, `stateLine`), `pages/library.js` (`confirmDelete`,
|
||||
`selectionBar`: la barra della selezione, che con «Tutte le foto» dice file ed elementi), `pages/mosaic.js` anche
|
||||
`storedMode` e `modeSwitch` («Raggruppa i post» / «Tutte le foto», ricordato per pagina nella memoria locale del
|
||||
browser), `pages/download-order.js` (`orderEditor`: l'elenco da trascinare di «Cosa scaricare prima», con Su/Giù e i
|
||||
tipi spenti attenuati, usato da Limiti e comportamento e dalla scheda account; `kindName`, `orderOrDefault`,
|
||||
`DEFAULT_ORDER`).
|
||||
|
||||
### Testi, stile, accessibilità
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="3 12 7 12 9.5 6 14 18 16.5 12 21 12"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 228 B |
@@ -1,5 +1,5 @@
|
||||
// The engine and the library as seen by the pages: one event stream (/api/eventi) for the whole interface.
|
||||
// «motore» carries the snapshot (sidebar, stop strip, Attività); «libreria» says the library changed.
|
||||
// «motore» carries the snapshot (sidebar, stop strip, Dashboard); «libreria» says the library changed.
|
||||
|
||||
import { api, eventsUrl } from './api.js';
|
||||
import { caps } from './context.js';
|
||||
|
||||
@@ -384,7 +384,8 @@ function settingsTab(page, detail) {
|
||||
label: t('impAccount.ordineScelta'),
|
||||
});
|
||||
const orderChoice = segmented({
|
||||
label: t('impAccount.ordineScelta'),
|
||||
// The list is «Ordine dei tipi per questo account»; the two-way choice has the name of the section.
|
||||
label: t('impAccount.ordine'),
|
||||
value: Array.isArray(form.downloadOrder) && form.downloadOrder.length ? 'own' : 'general',
|
||||
options: [{ value: 'general', label: t('impAccount.ordineGenerale') }, { value: 'own', label: t('impAccount.ordineSuo') }],
|
||||
onchange: (v) => {
|
||||
|
||||
@@ -53,13 +53,13 @@ export function orderEditor({ read, write, changed, off = () => false, label })
|
||||
const order = read();
|
||||
fill(list, order.map((kind, i) => {
|
||||
const name = kindName(kind);
|
||||
const spento = off(kind);
|
||||
const row = h(spento ? 'li.riga-ordine.spenta' : 'li.riga-ordine', { draggable: 'true', dataset: { tipo: kind } },
|
||||
const switchedOff = off(kind);
|
||||
const row = h(switchedOff ? 'li.riga-ordine.spenta' : 'li.riga-ordine', { draggable: 'true', dataset: { tipo: kind } },
|
||||
h('span.maniglia', { title: t('impostazioni.limiti.ordineManiglia'), 'aria-hidden': 'true' }, icon('grip-vertical', 's')),
|
||||
h('span.posizione.dati', String(i + 1)),
|
||||
h('b', name),
|
||||
spento ? h('span.muto.piccolo', t('impostazioni.limiti.ordineSpento')) : null,
|
||||
kind === 'storie' && i > 0 && !spento ? h('span.muto.piccolo', icon('clock', 'xs'), ' ', t('impostazioni.limiti.ordineStorie')) : null,
|
||||
switchedOff ? h('span.muto.piccolo', t('impostazioni.limiti.ordineSpento')) : null,
|
||||
kind === 'storie' && i > 0 && !switchedOff ? h('span.muto.piccolo', icon('clock', 'xs'), ' ', t('impostazioni.limiti.ordineStorie')) : null,
|
||||
h('div.destra',
|
||||
h('button.btn.piccolo.nudo', {
|
||||
type: 'button', disabled: i === 0, dataset: { verso: 'su' }, 'aria-label': t('impostazioni.limiti.ordineSuDi', { tipo: name }), onclick: () => move(i, i - 1, 'su'),
|
||||
|
||||
@@ -13,24 +13,33 @@ import { t, dayName, duration, capitalize } from '../core/text.js';
|
||||
import { avatar, segmented } from '../core/ui.js';
|
||||
|
||||
/**
|
||||
* «Raggruppa i post» or «Tutte le foto» of a page ('libreria', or 'account' for every account), remembered in this
|
||||
* browser like the theme (spec §4.6). Storage that is missing, blocked or holds anything else means grouped.
|
||||
* «Raggruppa i post» or «Tutte le foto» of a page ('libreria', or 'account' for every account), kept only in the
|
||||
* local storage of this browser (spec §4.6): unlike the theme, Febe does not save it, so another browser starts
|
||||
* grouped. Storage that is missing, blocked or holds anything else means grouped.
|
||||
*/
|
||||
export function storedMode(page) {
|
||||
return local.get(`mosaico.${page}`, 'grouped') === 'files' ? 'files' : 'grouped';
|
||||
}
|
||||
|
||||
/** The two-voice switch of the tools row; onchange(mode) after the choice is remembered. compact: icons only sooner. */
|
||||
/**
|
||||
* The two-voice switch of the tools row; onchange(mode) after the choice is remembered, and only when the mode
|
||||
* changes: the voice already chosen does nothing (the mosaic, its place and the selection stay). compact: icons only
|
||||
* sooner.
|
||||
*/
|
||||
export function modeSwitch(page, onchange, { compact = false } = {}) {
|
||||
const labels = { grouped: t('libreria.modi.grouped'), files: t('libreria.modi.files') };
|
||||
// The mode shown, kept here: without browser storage storedMode() always says grouped.
|
||||
let current = storedMode(page);
|
||||
const group = segmented({
|
||||
label: t('libreria.modi.etichetta'),
|
||||
value: storedMode(page),
|
||||
value: current,
|
||||
options: [
|
||||
{ value: 'grouped', icon: 'layers', label: h('span.voce', labels.grouped) },
|
||||
{ value: 'files', icon: 'layout-grid', label: h('span.voce', labels.files) },
|
||||
],
|
||||
onchange: (value) => {
|
||||
if (value === current) return;
|
||||
current = value;
|
||||
local.set(`mosaico.${page}`, value);
|
||||
onchange(value);
|
||||
},
|
||||
|
||||
@@ -112,6 +112,11 @@ export function openViewer({ tile, source, origin, onDeleted }) {
|
||||
const at = mediaId == null ? -1 : entry.media.findIndex((m) => m.id === mediaId);
|
||||
if (at >= 0) fileIndex = at;
|
||||
else fileIndex = index < 0 ? entry.media.length - 1 : Math.min(index, entry.media.length - 1);
|
||||
if (files && at < 0) {
|
||||
// Entered from an edge without a file named: the first (or last) file that is a tile.
|
||||
const tiles = entry.media.map((m, i) => (source.has(m.id) ? i : -1)).filter((i) => i >= 0);
|
||||
if (tiles.length) fileIndex = index < 0 ? tiles[tiles.length - 1] : tiles[0];
|
||||
}
|
||||
draw();
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
@@ -120,7 +125,10 @@ export function openViewer({ tile, source, origin, onDeleted }) {
|
||||
|
||||
async function step(delta) {
|
||||
if (!entry) return;
|
||||
const target = fileIndex + delta;
|
||||
let target = fileIndex + delta;
|
||||
// With «Tutte le foto» the arrows follow the tiles: the files the mosaic does not show (the photos of a post under
|
||||
// «Video», the videos under «Foto», a file not in the library) are passed over, as the mosaic passes over them.
|
||||
if (files) while (target >= 0 && target < entry.media.length && !source.has(entry.media[target].id)) target += delta;
|
||||
if (target >= 0 && target < entry.media.length) {
|
||||
fileIndex = target;
|
||||
drawFile();
|
||||
@@ -149,7 +157,10 @@ export function openViewer({ tile, source, origin, onDeleted }) {
|
||||
}
|
||||
|
||||
function drawWhere() {
|
||||
const key = source && source.position ? keyAt(0) : null;
|
||||
// With «Tutte le foto» the place is that of the file on screen; a file that is not a tile (chosen in the series
|
||||
// strip) has none, and the header says only where the viewer was opened.
|
||||
const current = files && entry.media[fileIndex];
|
||||
const key = !source || !source.position ? null : !files ? keyAt(0) : current && source.has(current.id) ? current.id : null;
|
||||
if (key != null) {
|
||||
const p = source.position(key);
|
||||
where.textContent = p.index ? t(files ? 'vis.doveFile' : 'vis.dove', { origine: origin, n: number(p.index), totale: number(p.total) }) : origin;
|
||||
|
||||
Reference in new issue
Block a user