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
@@ -25,6 +25,9 @@ let navLinks = {};
|
||||
let statusBox;
|
||||
let current = null;
|
||||
let renderToken = 0;
|
||||
// Address of the page drawn last (path and query) and whether the history guard is waiting for Alberto.
|
||||
let shownUrl = '';
|
||||
let asking = false;
|
||||
|
||||
/** Builds the sidebar and the page area inside root. */
|
||||
export function buildShell(root) {
|
||||
@@ -60,11 +63,16 @@ function renderStatus(state) {
|
||||
const s = state.snapshot;
|
||||
const meter = s.profilesOpenedToday;
|
||||
const connection = state.connection;
|
||||
const linkState = t(connection.state === 'verification' ? 'stato.verifica' : connection.state === 'disconnected' ? 'stato.scollegato' : 'stato.collegato');
|
||||
// The own account is known only after the first sweep (a verification can come before it): no «@null».
|
||||
const who = connection.state === 'notConnected'
|
||||
? h('div.chi', h('span.av.segnaposto', icon('user', 's')),
|
||||
h('div', h('b', t('stato.nessunAccount')), h('span', t('stato.daCollegare'))))
|
||||
: h('div.chi', avatar(connection.username || ''),
|
||||
h('div', h('b', `@${connection.username}`), h('span', t(connection.state === 'verification' ? 'stato.verifica' : connection.state === 'disconnected' ? 'stato.scollegato' : 'stato.collegato'))));
|
||||
: connection.username
|
||||
? h('div.chi', avatar(connection.username),
|
||||
h('div', h('b', `@${connection.username}`), h('span', linkState)))
|
||||
: h('div.chi', h('span.av.segnaposto', icon('user', 's')),
|
||||
h('div', h('b', linkState), h('span', t('stato.accountDaLeggere'))));
|
||||
const ratio = Math.max(0, Math.min(1, meter.ratio || 0));
|
||||
fill(statusBox,
|
||||
h('div.riga', h(`span.spia${dotOf(s.mode) ? '.' + dotOf(s.mode) : ''}`, { 'aria-hidden': 'true' }), h('span', s.headline)),
|
||||
@@ -168,16 +176,29 @@ class PageFrame {
|
||||
|
||||
/** Engine changes while the page is open. */
|
||||
onEngine(fn) {
|
||||
if (this.signal.aborted) return;
|
||||
this.cleanups.push(onEngine(fn));
|
||||
}
|
||||
|
||||
/** Library changes while the page is open. */
|
||||
onLibrary(fn) {
|
||||
if (this.signal.aborted) return;
|
||||
this.cleanups.push(onLibrary(fn));
|
||||
}
|
||||
|
||||
/** Runs fn when the page is left. */
|
||||
/**
|
||||
* Runs fn when the page is left. A page left while it was still loading (its mount went on after an await) runs it
|
||||
* at once: nothing registered late may outlive the page.
|
||||
*/
|
||||
onLeave(fn) {
|
||||
if (this.signal.aborted) {
|
||||
try {
|
||||
fn();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.cleanups.push(fn);
|
||||
}
|
||||
|
||||
@@ -272,6 +293,8 @@ export function setQuery(params, { replace = true } = {}) {
|
||||
const target = url.pathname + url.search + url.hash;
|
||||
if (replace) history.replaceState(null, '', target);
|
||||
else history.pushState(null, '', target);
|
||||
// The page already shows this address.
|
||||
shownUrl = url.pathname + url.search;
|
||||
}
|
||||
|
||||
/** Starts the router: link clicks, back and forward buttons. */
|
||||
@@ -287,7 +310,30 @@ export function startRouter() {
|
||||
e.preventDefault();
|
||||
navigate(url.pathname + url.search);
|
||||
});
|
||||
window.addEventListener('popstate', () => render());
|
||||
window.addEventListener('popstate', onHistory);
|
||||
render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Back and forward buttons: the address has already changed, so a page with unsaved changes is asked first (like a
|
||||
* link) and, when Alberto stays, its address is put back. A change of the fragment alone (the skip link) is no new page.
|
||||
*/
|
||||
async function onHistory() {
|
||||
if (location.pathname + location.search === shownUrl) return;
|
||||
if (asking) return;
|
||||
if (current) {
|
||||
asking = true;
|
||||
let leave;
|
||||
try {
|
||||
leave = await current.frame.mayLeave();
|
||||
} finally {
|
||||
asking = false;
|
||||
}
|
||||
if (!leave) {
|
||||
history.pushState(null, '', shownUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render();
|
||||
}
|
||||
|
||||
@@ -295,6 +341,7 @@ async function render() {
|
||||
closeMenu();
|
||||
const token = ++renderToken;
|
||||
const path = location.pathname;
|
||||
shownUrl = path + location.search;
|
||||
const route = routes.find((r) => r.pattern.test(path));
|
||||
if (route && route.redirect) {
|
||||
history.replaceState(null, '', withCarried(route.redirect));
|
||||
|
||||
Reference in new issue
Block a user