D1, quarta parte: «Raggruppa i post» o «Tutte le foto» in Libreria e scheda account
Un post con più foto era una tessera sola: per vederle tutte bisognava aprirlo. Ora un interruttore nella riga degli strumenti (Libreria e Contenuti dell'account, non «In evidenza») passa a una tessera per file, video dei caroselli compresi, con la posizione «2/4» sulla tessera; la scelta resta nel browser, una per pagina, e il predefinito è raggruppato (§4.6). - API: /api/library e /api/library/days accettano mode=files; il cursore diventa «ms.elemento.posizione», i giorni contano file e il totale dice anche quanti file. Le finestre restano a chiavi sull'indice di pubblicazione; per i conteggi un indice ix_media_entry_files (entry_id, state, kind) nella migrazione 0002 non ancora unita. Prova di scala a 200.000 elementi: finestre 6-11 ms, conteggi 0,2-0,3 s. - Visualizzatore: si apre sul file della tessera e va di file in file, anche da un elemento al successivo («Libreria, file 12 di 30.340»). - Selezione di file; elenco CSV ed «Elimina» lavorano sugli elementi interi e lo dicono («3 file scelti appartengono a 2 elementi: elimino gli elementi interi, 9 file»). «Copia in…» non è in questo ramo. - Dimostrazione: alcune serie hanno un video in seconda posizione, scelto dall'identificativo senza toccare la sequenza casuale. - Prove di archivio, API, dimostrazione e interfaccia (queste ultime con Chromium, solo nella CI); guida e decisioni aggiornate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34fe5e9073
commit
30e159cbd4
23 files changed
+1126
-130
No files matched your search
@@ -11,8 +11,8 @@ import { navigate, setQuery } from '../core/shell.js';
|
||||
import { t, number, decimal, dayName, shortDay, capitalize } from '../core/text.js';
|
||||
import { avatar, checkbox, confirmDialog, menu, segmented, showError, toast, toggle } from '../core/ui.js';
|
||||
import { accountLabels, accountMenu, checkNow, openProfile } from './accounts.js';
|
||||
import { confirmDelete } from './library.js';
|
||||
import { Mosaic, justify, tileElement, defaultDayLabel } from './mosaic.js';
|
||||
import { confirmDelete, selectionBar } from './library.js';
|
||||
import { Mosaic, justify, tileElement, defaultDayLabel, filesDayLabel, modeSwitch, storedMode } from './mosaic.js';
|
||||
import { kindName, orderEditor, orderOrDefault } from './download-order.js';
|
||||
import { openViewer } from './viewer.js';
|
||||
|
||||
@@ -109,6 +109,12 @@ 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;
|
||||
// «Raggruppa i post» / «Tutte le foto» (spec §4.6): one choice for the views of every account, apart from the Libreria.
|
||||
let mode = storedMode('account');
|
||||
const modes = modeSwitch('account', (value) => {
|
||||
mode = value;
|
||||
show();
|
||||
});
|
||||
// «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;
|
||||
@@ -116,7 +122,7 @@ async function contentsTab(page, route, detail) {
|
||||
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')));
|
||||
page.tools(h('div', { style: { display: 'contents' } }, chips, periodButton, h('div.destra', selectButton)));
|
||||
page.tools(h('div', { style: { display: 'contents' } }, chips, periodButton, h('div.destra', modes, selectButton)));
|
||||
const host = h('div');
|
||||
fill(page.body, host);
|
||||
|
||||
@@ -131,6 +137,8 @@ async function contentsTab(page, route, detail) {
|
||||
}, t(k.label), h('i', number(s[k.stat])))));
|
||||
fill(periodButton, h('span.val', period ? t(`libreria.periodi.${period}`) : t('libreria.periodi.qualsiasi')), icon('chevron-down', 's'));
|
||||
selectButton.hidden = kind.key === 'evidenza';
|
||||
// «In evidenza» is drawn by collection, one tile per item (almost always a single story): no switch there.
|
||||
modes.hidden = kind.key === 'evidenza';
|
||||
}
|
||||
|
||||
periodButton.addEventListener('click', () => menu(periodButton,
|
||||
@@ -159,26 +167,25 @@ async function contentsTab(page, route, detail) {
|
||||
page.saveBar(null);
|
||||
return;
|
||||
}
|
||||
const n = selected.size;
|
||||
page.saveBar(h('div', { style: { display: 'contents' } },
|
||||
h('span.nota', n ? t('selezione.scelti', { n }) : t('selezione.nessuno')),
|
||||
h('div.destra',
|
||||
h('button.btn.nudo', { type: 'button', onclick: () => setSelecting(false) }, t('selezione.annulla')),
|
||||
h('button.btn', { type: 'button', disabled: !n, onclick: async () => {
|
||||
try {
|
||||
await download('/api/entries/export', { ids: [...mosaic.selected] }, 'febe-elementi.csv');
|
||||
toast(t('selezione.esportato'));
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
}
|
||||
} }, icon('file-down'), t('selezione.esporta')),
|
||||
h('button.btn.pericolo', { type: 'button', disabled: !n, onclick: async () => {
|
||||
const removed = await confirmDelete([...mosaic.selected]);
|
||||
if (removed) {
|
||||
mosaic.removeTiles(removed);
|
||||
setSelecting(false);
|
||||
}
|
||||
} }, icon('trash-2'), t('selezione.elimina', { n })))));
|
||||
page.saveBar(selectionBar(mosaic, selected, {
|
||||
cancel: () => setSelecting(false),
|
||||
exportSelected: async () => {
|
||||
try {
|
||||
await download('/api/entries/export', { ids: mosaic.selectedEntries().ids }, 'febe-elementi.csv');
|
||||
toast(t('selezione.esportato'));
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
}
|
||||
},
|
||||
deleteSelected: async () => {
|
||||
const { ids, files } = mosaic.selectedEntries();
|
||||
const removed = await confirmDelete(ids, mosaic.files ? { files: mosaic.selected.size, total: files } : null);
|
||||
if (removed) {
|
||||
mosaic.removeTiles(removed);
|
||||
setSelecting(false);
|
||||
}
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
function setSelecting(on) {
|
||||
@@ -211,9 +218,10 @@ async function contentsTab(page, route, detail) {
|
||||
host,
|
||||
query: query(),
|
||||
mode: kind.grid ? 'grid' : 'justified',
|
||||
files: mode === 'files',
|
||||
rowHeight,
|
||||
signal: page.signal,
|
||||
dayLabel: kind.grid ? storiesDayLabel : defaultDayLabel,
|
||||
dayLabel: mode === 'files' ? filesDayLabel : kind.grid ? storiesDayLabel : defaultDayLabel,
|
||||
onOpen: (tile) => openViewer({ tile, source: mosaic, origin: `@${detail.account.username}`, onDeleted: (ids) => mosaic.removeTiles(ids) }),
|
||||
onSelection: drawSelection,
|
||||
onEmpty: () => fill(host, h('div.vuoto-pagina', icon(kind.grid ? 'circle-dashed' : 'image'), h('p', t('scheda.nessunContenuto')))),
|
||||
|
||||
Reference in new issue
Block a user