Interfaccia, parte 2: Attività, Impostazioni, collegamento, Importa, doppioni, primo avvio ed errori di configurazione

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 20:27:34 +00:00
1 parent 0515776b04
commit d614050ee5
90 files changed
+7825 -49

No files matched your search

+20 -2
View File
@@ -1,13 +1,15 @@
// Libreria (mockup 01, spec §4.6): every entry by publication day, filters by kind, account, period and provenance,
// search by account name and caption, tile size, multiple selection to export or delete, viewer on click.
import { api, download } from '../core/api.js';
import { api, download, withCarried } from '../core/api.js';
import { caps } from '../core/context.js';
import { h, icon, fill, later, local } from '../core/dom.js';
import { setQuery } from '../core/shell.js';
import { t, number, shortDay, parseDay } from '../core/text.js';
import { menu, showError, toast, confirmDialog } from '../core/ui.js';
import { engineState } from '../core/engine.js';
import { Mosaic } from './mosaic.js';
import { welcome } from './welcome.js';
import { openViewer } from './viewer.js';
const KINDS = [
@@ -89,11 +91,19 @@ export default {
const size = local.get('libreria.tessere', 160);
const slider = h('input.cursore', { type: 'range', min: '96', max: '300', step: '4', value: String(size), 'aria-label': t('libreria.grandezza') });
const selectButton = h('button.btn', { type: 'button', 'aria-pressed': 'false' }, icon('circle-check'), h('span', t('libreria.seleziona')));
// Probable duplicates after a download wait for Alberto (spec §9.5): a short link to their review.
const duplicates = h('a.btn.nudo.piccolo.doppioni-link', { href: withCarried('/doppioni'), hidden: true });
api('/api/duplicates/count', { signal: page.signal }).then((counts) => {
if (!counts.download) return;
fill(duplicates, icon('layers', 's'), t('libreria.doppioni', { n: counts.download }));
duplicates.hidden = false;
}).catch(() => {});
page.tools(h('div', { style: { display: 'contents' } },
chips,
h('div.scelte-menu.solo-largo', accountButton, periodButton, provenanceButton),
filtersButton,
h('div.destra',
duplicates,
h('div.grandezza.solo-largo', { title: t('libreria.grandezza') }, icon('grid-3x3', 's'), slider, icon('square', 's')),
selectButton)));
@@ -323,7 +333,9 @@ export default {
onEmpty: () => fill(host, filtersActive()
? h('div.vuoto-pagina', icon('list-filter'), h('h2', t('libreria.nessuno')), h('p', t('libreria.nessunoTesto')),
h('button.btn', { type: 'button', onclick: () => { Object.assign(state, readState(new URLSearchParams())); search.value = ''; apply(); } }, t('libreria.togliFiltri')))
: h('div.vuoto-pagina', icon('image'), h('h2', t('libreria.vuota')), h('p', t('libreria.vuotaTesto')))),
: notConnected()
? welcome()
: h('div.vuoto-pagina', icon('image'), h('h2', t('libreria.vuota')), h('p', t('libreria.vuotaTesto')))),
});
try {
await mosaic.start();
@@ -371,3 +383,9 @@ export async function confirmDelete(ids) {
return null;
}
}
/** First start (spec §10.3): not connected to Instagram, so the empty library offers the two ways to begin. */
function notConnected() {
const state = engineState();
return Boolean(state && state.connection && state.connection.state === 'notConnected');
}