From 25e4ac541a458d6a7b6ef53e7e31bed4beeb8295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 6 Nov 2026 12:18:02 -0300 Subject: [PATCH] feat: the customer sees how long each site step is taking (0.12) The file card, the sheet preview and the analysis status now count the seconds since the file arrived; the confirmation says the Prumo is preparing the print file and the usual estimate per 10 m. --- web/checkout.js | 3 ++- web/site-config.js | 2 ++ web/site-packing.js | 2 +- web/site-pdf.js | 5 +++-- web/site-quality.js | 8 +++++--- web/site-upload.js | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/web/checkout.js b/web/checkout.js index d631d8f..ff374e3 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -506,7 +506,8 @@ const titulo=node('h4','Pagamento confirmado'); titulo.insertAdjacentHTML('afterbegin', icone('okCirculo')); box.append(titulo, - node('p','Recebemos seu pedido e ele já está na produção. Você acompanha cada etapa em Meus pedidos.')); + node('p','Recebemos seu pedido e ele já está na produção. Você acompanha cada etapa em Meus pedidos.'), + node('p','O Prumo está preparando o arquivo de impressão. Em geral leva até 1 min por 10 m; o card aparece em Meus pedidos quando fica pronto.')); button('Ver meus pedidos',()=>location.assign('/conta/pedidos?order='+quote.order.id),box); actions.append(box); } diff --git a/web/site-config.js b/web/site-config.js index 51749aa..76c4606 100644 --- a/web/site-config.js +++ b/web/site-config.js @@ -4,6 +4,8 @@ scope and run top to bottom, exactly as the original did. */ const $=id=>document.getElementById(id); +// Segundos desde um marco, para as etapas nunca ficarem mudas (item 0.12). +const segundosDesde=inicio=>inicio?Math.max(0,Math.round((Date.now()-inicio)/1000)):0; // What the browser measured while the customer built the cart (item 0.12): // page load, upload, Prumo's check and the loose-art montage. It only feeds // Números; no price or acceptance depends on it. diff --git a/web/site-packing.js b/web/site-packing.js index ca21298..d0ae639 100644 --- a/web/site-packing.js +++ b/web/site-packing.js @@ -393,7 +393,7 @@ function previaAoVivo(){ if(!x.previewSrc){ const esqueleto=document.createElement('div'); esqueleto.className='skel folhaSkel'; esqueleto.style.aspectRatio=x.med ? x.med.larg+' / '+Math.min(x.med.alt,x.med.larg*4) : '1 / 2'; - esqueleto.append(Object.assign(document.createElement('span'),{textContent:'Gerando a prévia da folha…'})); + esqueleto.append(Object.assign(document.createElement('span'),{textContent:'Gerando a prévia da folha… · '+segundosDesde(x.analiseInicio)+' s'})); figura.append(esqueleto,legenda); painel.append(figura); return; } const pilha=document.createElement('div'); pilha.className='folhaPilha'; diff --git a/web/site-pdf.js b/web/site-pdf.js index 281dade..f2d1d67 100644 --- a/web/site-pdf.js +++ b/web/site-pdf.js @@ -406,8 +406,9 @@ function medirFolha(file){ } function textoProgresso(x){ - if(x.med && x.med.grande) return 'gerando a prévia e conferindo a arte · '+faltaLeitura(x.leitura); - return x.pct<50?'lendo o arquivo…':x.pct<70?'medindo a folha…':'conferindo a arte…'; + const tempo=x.analiseInicio?' · '+segundosDesde(x.analiseInicio)+' s':''; + if(x.med && x.med.grande) return 'gerando a prévia e conferindo a arte · '+faltaLeitura(x.leitura)+tempo; + return (x.pct<50?'lendo o arquivo…':x.pct<70?'medindo a folha…':'conferindo a arte…')+tempo; } // The file card's thumbnail (52 x 96 px, drawn at twice that for sharp screens). // At 480 x 720 it is the picture the Kanban shows of the order (checkout.js). diff --git a/web/site-quality.js b/web/site-quality.js index cb8e23e..c7cd9db 100644 --- a/web/site-quality.js +++ b/web/site-quality.js @@ -93,7 +93,7 @@ function avaliar(){ // Resíduo e fundo chapado barram antes do pagamento, com um ponto só // (Dropstar, 21/10/2026): então o pedido espera a conferência terminar. const lendo=folhas.find(x=>x.pct!=null); - if(lendo) return {pronto:false, falta:'Conferindo '+lendo.f.name+'…'}; + if(lendo) return {pronto:false, falta:'Conferindo '+lendo.f.name+'… · '+segundosDesde(lendo.analiseInicio)+' s'}; const barrada=folhas.find(folhaBarrada); if(barrada) return {pronto:false, falta:barrada.an.fundoChapado ? barrada.f.name+' está sem fundo transparente. Exporte a folha com fundo transparente, em PNG ou PDF, e envie de novo.' @@ -145,7 +145,8 @@ function avaliar(){ return {pronto:true}; } if(!artes.length) return {pronto:false, falta:'Arraste suas artes para começar.'}; - if(artes.some(a=>a.lendo!=null)) return {pronto:false, falta:'Gerando a prévia das artes grandes…'}; + const grande=artes.find(a=>a.lendo!=null); + if(grande) return {pronto:false, falta:'Gerando a prévia das artes grandes… · '+segundosDesde(grande.analiseInicio)+' s'}; if(artes.some(a=>a.decodeError || !(a.src||a.semPrevia) || !(a.px>0) || !(a.py>0))) return {pronto:false, falta:'Não conseguimos ler uma das imagens. Exporte-a novamente em PNG antes de continuar.'}; if(artes.some(a=>!Number.isFinite(a.cm) || a.cm>larguraFilme())) @@ -156,7 +157,8 @@ function avaliar(){ ' para ver a nota e o preço.'}; // Item 4: a dot under 2 mm in a loose artwork holds the order like on a // sheet, until the customer erases it or accepts printing that artwork so. - if(artes.some(a=>a.lendoArte)) return {pronto:false, falta:'Conferindo as artes…'}; + const lendoArte=artes.find(a=>a.lendoArte); + if(lendoArte) return {pronto:false, falta:'Conferindo as artes… · '+segundosDesde(lendoArte.analiseInicio)+' s'}; const comPontos=artes.find(a=>{const an=analiseDaArte(a);return an&&an.residuos&&!a.residuoAceito;}); if(comPontos){const n=analiseDaArte(comPontos).residuos; return {pronto:false, falta:comPontos.f.name+' tem '+n+' ponto'+(n>1?'s':'')+ diff --git a/web/site-upload.js b/web/site-upload.js index 51dbdf5..797d967 100644 --- a/web/site-upload.js +++ b/web/site-upload.js @@ -125,7 +125,7 @@ async function sel(fs){ // On their way at once; a JPG is refused at the order anyway. fs.filter(f=>!/\.jpe?g$/i.test(f.name)).forEach(f=>window.dtfEnvio?.enviar(f)); if(ehFolha()){ - const novas=fs.map(f=>({f, med:null, rep:1, m:0, semAnalise:null})); + const novas=fs.map(f=>({f, med:null, rep:1, m:0, semAnalise:null, analiseInicio:Date.now()})); folhas=folhas.concat(novas); // soma, não substitui pintaFolha(); novas.forEach(x=>{ @@ -219,7 +219,7 @@ async function sel(fs){ }); return; } - const novos=fs.map(f=>({f,px:0,py:0,cm:0,q:1,prop:1,giro:0,esp:false})); + const novos=fs.map(f=>({f,px:0,py:0,cm:0,q:1,prop:1,giro:0,esp:false,analiseInicio:Date.now()})); artes=novos.concat(artes); // a mais recente fica no topo da fila recemChegada=novos[0]; pintaArtes();