feat: the upload bar says how long is left, not a notice before it
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 2m42s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m2s
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 2m42s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m2s
The product page's notice about the upload time is gone. The cart's upload bar now reads "Enviando seus arquivos · faltam cerca de 6 min", measured from the upload's own speed (a range from the size for the first seconds), with a line saying the time depends on the internet and to keep the page open. The header and the pay button show the same time instead of a percentage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -124,22 +124,13 @@ const destinoApi=()=>entrega.tipo!=='frete' ? null : {
|
||||
// Tempo de envio antes de medir a internet de quem compra: uma faixa entre um
|
||||
// upload lento (10 Mbps) e um rápido (150 Mbps). O arquivo vai direto para o
|
||||
// armazenamento, então é o upload do cliente que manda.
|
||||
const ENVIO_LENTO=10e6/8, ENVIO_RAPIDO=150e6/8, ENVIO_AVISA_S=120;
|
||||
const ENVIO_LENTO=10e6/8, ENVIO_RAPIDO=150e6/8;
|
||||
const duracao=s=>{
|
||||
const min=Math.ceil(s/60);
|
||||
return s<60 ? 'menos de 1 min' : min<60 ? min+' min' : Math.floor(min/60)+' h'+(min%60? ' '+min%60+' min' : '');
|
||||
};
|
||||
const faixaEnvio=bytes=>bytes/ENVIO_RAPIDO<60 ? 'até '+duracao(bytes/ENVIO_LENTO)
|
||||
: 'de '+duracao(bytes/ENVIO_RAPIDO)+' a '+duracao(bytes/ENVIO_LENTO);
|
||||
// Só enquanto há arquivos no produto aberto: sai quando o item vai para o carrinho.
|
||||
function pintaAvisoEnvio(){
|
||||
const el=$('avisoEnvio'); if(!el) return;
|
||||
const total=modo ? (ehFolha()?folhas:artes).reduce((t,x)=>t+(x.f?.size||0),0) : 0;
|
||||
el.hidden = total/ENVIO_LENTO < ENVIO_AVISA_S;
|
||||
if(el.hidden) return;
|
||||
el.innerHTML='<b>Envio: '+faixaEnvio(total)+'</b> ('+fmt(total)+'), conforme sua internet. '+
|
||||
'Mantenha a página aberta.';
|
||||
}
|
||||
const larguraFilme=()=>MODOS[modo].larg;
|
||||
// cobrança proporcional: arredonda para cima em 10 cm · 2,75 m vira 2,80 m
|
||||
const cobrar=m=>Math.max(MINIMO_M, Math.ceil(m*10)/10);
|
||||
|
||||
Reference in New Issue
Block a user