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:
1 parent
0547c747c5
commit
34fe5e9073
31 files changed
+265
-78
No files matched your search
@@ -703,6 +703,15 @@ a.stato:hover{border-color:var(--bordo-forte)}
|
||||
.cruscotto .anteprima{width:100%}
|
||||
.storia-coda{grid-template-columns:minmax(0,1fr)}
|
||||
}
|
||||
@media (max-width:560px){
|
||||
/* On the phone the preview stays at the top but lower, so that what is happening and the budgets fit too */
|
||||
.cruscotto{padding:12px;gap:14px}
|
||||
.cruscotto .anteprima .quadro{height:196px}
|
||||
.miniatura,.miniature-altre{width:40px;height:40px}
|
||||
.miniature{min-height:40px}
|
||||
.anteprima-palco{height:min(52vh,460px)}
|
||||
.anteprima-scena .btn.tondo{width:30px;height:30px}
|
||||
}
|
||||
.ora-pannello{display:flex;align-items:center;gap:24px;padding:18px 18px 18px 24px;min-height:142px}
|
||||
.ora-testo{flex:1;min-width:0}
|
||||
.ora-testo .riga{display:flex;align-items:center;gap:10px}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<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">
|
||||
<rect x="3.5" y="3.5" width="7" height="9" rx="1.5"/>
|
||||
<rect x="13.5" y="3.5" width="7" height="5" rx="1.5"/>
|
||||
<rect x="13.5" y="11.5" width="7" height="9" rx="1.5"/>
|
||||
<rect x="3.5" y="15.5" width="7" height="5" rx="1.5"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 397 B |
@@ -12,7 +12,7 @@ import { avatar, showError, toast, closeMenu } from './ui.js';
|
||||
import { routes } from '../routes.js';
|
||||
|
||||
const NAV = [
|
||||
{ key: 'dashboard', href: '/dashboard', icon: 'activity' },
|
||||
{ key: 'dashboard', href: '/dashboard', icon: 'layout-dashboard' },
|
||||
{ key: 'libreria', href: '/libreria', icon: 'layout-grid' },
|
||||
{ key: 'account', href: '/account', icon: 'users' },
|
||||
{ key: 'importa', href: '/importa', icon: 'folder-input' },
|
||||
|
||||
@@ -374,7 +374,7 @@ function historyBox(page) {
|
||||
page.onLeave(() => watcher && watcher.disconnect());
|
||||
|
||||
function keyOf(r) {
|
||||
return `${r.accountId}|${r.from}|${r.at}`;
|
||||
return `${r.accountId || ''}|${r.from}|${r.at}`;
|
||||
}
|
||||
|
||||
async function loadThumbs(holder) {
|
||||
@@ -388,8 +388,7 @@ function historyBox(page) {
|
||||
const item = { loading: true, result: null, line: holder.line };
|
||||
arrived.set(key, item);
|
||||
try {
|
||||
const query = new URLSearchParams({ account: String(holder.line.accountId), from: holder.line.from, to: holder.line.at, limit: String(THUMBS) });
|
||||
item.result = await api(`/api/activity/arrived?${query}`, { signal: page.signal });
|
||||
item.result = await api(`/api/activity/arrived?${arrivedQuery(holder.line, THUMBS)}`, { signal: page.signal });
|
||||
} catch (error) {
|
||||
if (error.name === 'AbortError') return;
|
||||
item.result = { tiles: [], total: 0 };
|
||||
@@ -423,7 +422,7 @@ function historyBox(page) {
|
||||
}
|
||||
const list = h('ul.elenco-attivita.storia-righe', items.map((r) => {
|
||||
let holder = null;
|
||||
if (r.accountId && r.from && r.newEntries > 0) {
|
||||
if (r.from && r.newEntries > 0) {
|
||||
holder = h('div.miniature', { dataset: { chiave: keyOf(r) }, 'aria-label': t('attivita.arrivate', { n: r.newEntries }), role: 'group' });
|
||||
holder.line = r;
|
||||
const known = arrived.get(keyOf(r));
|
||||
@@ -438,13 +437,23 @@ function historyBox(page) {
|
||||
}));
|
||||
fill(element, h('h2', t('attivita.fatto')), h('div.pannello', list));
|
||||
// Lines no longer shown are forgotten, so that a long day does not keep every answer.
|
||||
const keys = new Set(items.filter((r) => r.accountId && r.from).map(keyOf));
|
||||
const keys = new Set(items.filter((r) => r.from).map(keyOf));
|
||||
for (const key of arrived.keys()) if (!keys.has(key)) arrived.delete(key);
|
||||
}
|
||||
|
||||
return { element, draw };
|
||||
}
|
||||
|
||||
/**
|
||||
* The question for what a line of the history saved: the recipe's account and time; a line without an account (the
|
||||
* Giro dei seguiti saves posts of many accounts) asks for what arrived of every account in that time.
|
||||
*/
|
||||
function arrivedQuery(line, limit) {
|
||||
const query = new URLSearchParams({ from: line.from, to: line.at, limit: String(limit) });
|
||||
if (line.accountId) query.set('account', String(line.accountId));
|
||||
return query;
|
||||
}
|
||||
|
||||
/** A small tile of the history: the thumbnail of §8.4 with the marks of the mosaic (video length, ring of stories). */
|
||||
function thumb(tile, onOpen) {
|
||||
const cover = tile.cover;
|
||||
@@ -475,8 +484,7 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
|
||||
// More entries than the thumbnails: the arrows walk all of them (up to the server's limit).
|
||||
if (total > firstTiles.length) {
|
||||
try {
|
||||
const query = new URLSearchParams({ account: String(line.accountId), from: line.from, to: line.at, limit: '60' });
|
||||
const all = await api(`/api/activity/arrived?${query}`, { signal: page.signal });
|
||||
const all = await api(`/api/activity/arrived?${arrivedQuery(line, 60)}`, { signal: page.signal });
|
||||
if (all.tiles.length) tiles = all.tiles;
|
||||
} catch (error) {
|
||||
if (error.name === 'AbortError') return;
|
||||
@@ -492,6 +500,8 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
|
||||
const prev = h('button.btn.nudo.tondo', { type: 'button', 'aria-label': t('vis.precedente'), onclick: () => step(-1) }, icon('chevron-left'));
|
||||
const next = h('button.btn.nudo.tondo', { type: 'button', 'aria-label': t('vis.successivo'), onclick: () => step(1) }, icon('chevron-right'));
|
||||
let closeDialog = null;
|
||||
// «Apri l'account» follows the arrows: a line of the Giro dei seguiti holds entries of many accounts.
|
||||
const accountLink = h('a.btn', { onclick: () => closeDialog() }, icon('user'), t('attivita.apriAccount'));
|
||||
|
||||
async function entryOf(i) {
|
||||
const id = tiles[i].id;
|
||||
@@ -502,6 +512,7 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
|
||||
async function show() {
|
||||
const mine = ++token;
|
||||
const tile = tiles[entryIndex];
|
||||
accountLink.href = withCarried(`/account/${tile.accountId}/contenuti`);
|
||||
const entry = await entryOf(entryIndex);
|
||||
if (mine !== token) return;
|
||||
const media = entry && entry.media.length ? entry.media[Math.min(fileIndex, entry.media.length - 1)] : null;
|
||||
@@ -571,12 +582,18 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
|
||||
className: 'anteprima-cronologia',
|
||||
build: (close) => {
|
||||
closeDialog = close;
|
||||
// The arrows walk the files wherever the focus is in the dialog (also on its buttons); Esc is the dialog's.
|
||||
document.addEventListener('keydown', onKey);
|
||||
return {
|
||||
body: h('div.contenuto', { onkeydown: onKey }, h('div.anteprima-scena', prev, stage, next), caption),
|
||||
onClose: () => {
|
||||
token += 1; // an entry still loading draws nothing any more
|
||||
document.removeEventListener('keydown', onKey);
|
||||
},
|
||||
body: h('div.contenuto', h('div.anteprima-scena', prev, stage, next), caption),
|
||||
footer: h('footer',
|
||||
position,
|
||||
h('div.destra',
|
||||
h('a.btn', { href: withCarried(`/account/${tiles[entryIndex].accountId}/contenuti`), onclick: () => closeDialog() }, icon('user'), t('attivita.apriAccount')),
|
||||
accountLink,
|
||||
h('button.btn.primo', {
|
||||
type: 'button',
|
||||
onclick: () => {
|
||||
|
||||
Reference in new issue
Block a user