Interfaccia: correzioni della revisione (web-1, web-2, web-3, web-4, web-5, web-6, web-7, web-9, web-10, web-11, web-12, web-13, web-14, web-15)
Il browser preso dalle pagine Browser e Collegamento si restituisce uscendo senza «Ho finito» (anche chiudendo o ricaricando la scheda); dopo «Ho finito» la vista remota si chiude e non si riprende il browser. Vista remota: AltGr/Option come testo, pulsante rilasciato anche fuori dalla vista. Mosaico e scheda account senza risposte vecchie né viste sovrascritte; nuovi elementi dopo la libreria vuota; intestazione sempre aggiornata. Indietro del browser con la richiesta delle modifiche non salvate; nulla resta registrato da una pagina lasciata mentre caricava; maniglie della fascia trascinabili. «Da una data» come giorno locale; niente «@null» nel riquadro di stato; orari futuri dei fermi «verso le». Prove nel browser vero (InterfaceTests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
27 files changed
+1365
-59
No files matched your search
@@ -52,10 +52,12 @@ export default {
|
||||
page.back(t('scheda.indietro'), '/account');
|
||||
const header = h('header.scheda-testa');
|
||||
page.header(header, `@${detail.account.username}`);
|
||||
drawHeader(header, detail, async () => {
|
||||
// The menu of the header redraws it after every action, with the same reload each time.
|
||||
const reload = async () => {
|
||||
detail = await api(`/api/accounts/${id}`, { signal: page.signal });
|
||||
drawHeader(header, detail);
|
||||
});
|
||||
drawHeader(header, detail, reload);
|
||||
};
|
||||
drawHeader(header, detail, reload);
|
||||
|
||||
const base = `/account/${id}`;
|
||||
page.tabs(h('nav.linguette', { 'aria-label': `@${detail.account.username}` },
|
||||
@@ -106,6 +108,10 @@ async function contentsTab(page, route, detail) {
|
||||
let kind = available.find((k) => k.key === route.query.get('tipo')) || available.find((k) => s[k.stat] > 0) || available[0];
|
||||
let period = route.query.get('periodo') || '';
|
||||
let mosaic = null;
|
||||
// «In evidenza» is drawn by its own code: its listeners go when another chip is chosen. The token tells a view
|
||||
// still loading that another one took its place.
|
||||
let highlightCleanup = null;
|
||||
let showToken = 0;
|
||||
const chips = h('div.filtri', { role: 'group', 'aria-label': t('scheda.linguette.contenuti') });
|
||||
const periodButton = h('button.campo.scelta', { type: 'button', 'aria-haspopup': 'true', 'aria-expanded': 'false', style: { minWidth: '150px' } });
|
||||
const selectButton = h('button.btn', { type: 'button', 'aria-pressed': 'false' }, icon('circle-check'), h('span', t('libreria.seleziona')));
|
||||
@@ -184,13 +190,18 @@ async function contentsTab(page, route, detail) {
|
||||
selectButton.addEventListener('click', () => mosaic && setSelecting(!mosaic.selecting));
|
||||
|
||||
async function show() {
|
||||
const token = ++showToken;
|
||||
drawTools();
|
||||
if (mosaic) mosaic.destroy();
|
||||
mosaic = null;
|
||||
if (highlightCleanup) highlightCleanup();
|
||||
highlightCleanup = null;
|
||||
page.saveBar(null);
|
||||
page.body.scrollTop = 0;
|
||||
if (kind.key === 'evidenza') {
|
||||
await showHighlights(host, detail, page);
|
||||
const cleanup = await showHighlights(host, detail, page, () => token === showToken);
|
||||
if (token === showToken) highlightCleanup = cleanup;
|
||||
else if (cleanup) cleanup();
|
||||
return;
|
||||
}
|
||||
const rowHeight = local.get('libreria.tessere', 160);
|
||||
@@ -220,6 +231,7 @@ async function contentsTab(page, route, detail) {
|
||||
page.onLeave(() => {
|
||||
onChange.cancel();
|
||||
if (mosaic) mosaic.destroy();
|
||||
if (highlightCleanup) highlightCleanup();
|
||||
});
|
||||
await show();
|
||||
}
|
||||
@@ -233,18 +245,22 @@ function storiesDayLabel(day, count, today) {
|
||||
return [capitalize(name), n];
|
||||
}
|
||||
|
||||
/** «In evidenza»: the mosaic grouped under the titles of the collections (mockup 12). */
|
||||
async function showHighlights(host, detail, page) {
|
||||
/**
|
||||
* «In evidenza»: the mosaic grouped under the titles of the collections (mockup 12). current() is false once another
|
||||
* chip took the place of this view (nothing is drawn then). Returns the function that removes its listeners, or null.
|
||||
*/
|
||||
async function showHighlights(host, detail, page, current) {
|
||||
const collections = detail.highlights.filter((c) => c.count > 0);
|
||||
if (!collections.length) {
|
||||
fill(host, h('div.vuoto-pagina', icon('star'), h('p', t('scheda.nessunContenuto'))));
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
fill(host, h('div.caricamento', t('comune.caricamento')));
|
||||
const ids = [...new Set(collections.flatMap((c) => c.entryIds))];
|
||||
const tiles = new Map();
|
||||
for (let i = 0; i < ids.length; i += 1000) {
|
||||
const page2 = await api(`/api/library/tiles?ids=${ids.slice(i, i + 1000).join(',')}`, { signal: page.signal });
|
||||
if (!current()) return null;
|
||||
for (const tile of page2.tiles) tiles.set(tile.id, tile);
|
||||
}
|
||||
const flat = [];
|
||||
@@ -272,9 +288,14 @@ async function showHighlights(host, detail, page) {
|
||||
const tile = flat.find((x) => x.id === Number(el.dataset.id));
|
||||
if (tile) openViewer({ tile, source, origin: `@${detail.account.username}`, onDeleted: () => draw() });
|
||||
};
|
||||
const observer = new ResizeObserver(later(draw, 150));
|
||||
const redraw = later(draw, 150);
|
||||
const observer = new ResizeObserver(redraw);
|
||||
observer.observe(host);
|
||||
page.onLeave(() => observer.disconnect());
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
redraw.cancel();
|
||||
host.onclick = null;
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------- settings
|
||||
|
||||
Reference in new issue
Block a user