From 1b5731349612e36222c0be6fec5dcba152de7233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 29 Sep 2026 17:49:22 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20give=20Artes=20avulsas=20the=20file=20c?= =?UTF-8?q?ard=20of=20Folha=20j=C3=A1=20montada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each artwork gets the same card as a finished sheet: "Suas artes" with the count of artworks and copies, a thumbnail, the size in cm with pixels, format and weight, a DPI chip and how many fit per row, the resolution or width hint, then width in cm, a copies stepper, rotate and mirror, and the usual sizes. Packing, pricing and the hints are unchanged. Co-Authored-By: Claude Opus 5.5 --- web/site-pdf.js | 81 ++++++++++++++++++++++++++++------------------ web/site-upload.js | 5 +-- web/site-v2.css | 13 ++++++++ 3 files changed, 66 insertions(+), 33 deletions(-) diff --git a/web/site-pdf.js b/web/site-pdf.js index 26a1b01..611eb05 100644 --- a/web/site-pdf.js +++ b/web/site-pdf.js @@ -521,7 +521,7 @@ const n1=v=>v.toFixed(1).replace('.',','); // Moves one artwork's progress in place, without repainting the list. function pintaProgressoArte(a){ - const el=$('lista').querySelector('.art[data-arte="'+artes.indexOf(a)+'"]'); + const el=$('lista').querySelector('[data-arte="'+artes.indexOf(a)+'"]'); const barra=el && el.querySelector('.prog i'), texto=el && el.querySelector('.progT'); if(!barra){ pintaArtes(); return; } barra.style.width=a.lendo+'%'; if(texto) texto.textContent='arquivo grande · gerando a prévia… '+a.lendo+'%'; @@ -529,26 +529,30 @@ function pintaProgressoArte(a){ function pintaArtes(){ invalidaItemAtual(); $('zona').classList.toggle('compacta', artes.length>0); - $('lista').innerHTML=artes.map((a,i)=>{ - let barra='', dica='', calc='informe a largura para ver a qualidade'; + // The same card as a finished sheet: thumbnail, size, a DPI chip, then the + // width (with the usual sizes), copies, rotation and mirroring. + const copiasTot=artes.reduce((t,a)=>t+(a.q||1),0); + $('lista').innerHTML=(artes.length? '

Suas artes

'+ + artes.length+' arte'+(artes.length>1?'s':'')+' · '+copiasTot+' cópia'+(copiasTot>1?'s':'')+'
' : '')+ + artes.map((a,i)=>{ + let barra='', dica='', chips='', aviso='', medida='Informe a largura'; if(a.lendo!=null){ - barra='
'; - calc='arquivo grande · gerando a prévia… '+a.lendo+'%'; + barra='
'+ + 'arquivo grande · gerando a prévia… '+a.lendo+'%'; }else if(a.decodeError==='grande'){ - calc='Arquivo grande em JPG ou WebP: exporte em PNG para montar a folha'; + aviso='

Arquivo grande em JPG ou WebP. Exporte em PNG para montar a folha.

'; }else if(a.decodeError){ - calc='Não conseguimos ler esta imagem; exporte novamente em PNG ou JPG'; + aviso='

Não conseguimos ler esta imagem. Exporte novamente em PNG ou JPG.

'; }else if(a.cm>larguraFilme()){ - calc='Largura maior que o filme de '+n1(larguraFilme())+' cm'; + aviso='

Largura maior que o filme. O filme aqui tem '+n1(larguraFilme())+' cm.

'; }else if(a.cm>0 && a.src){ - const dpi=Math.round(dpiDe(a)), n=Math.max(6,Math.min(100,Math.round(dpi/300*100))); - barra='
'; - const fila=cabemNaLinha(a.cm); - calc=''+n+'% · '+dpi+' DPI'+ - a.q+' × '+n1(a.cm)+' × '+n1(a.cm*propDe(a))+' cm · '+fila+' por fileira'; + const dpi=Math.round(dpiDe(a)); + medida=''+n1(a.cm)+' × '+n1(a.cm*propDe(a))+' cm'; + chips=''; const sug=sugestao(a); - // One hint per row, on the row it is about: resolution first, since it - // changes the price; otherwise a width that saves sheet. + // One hint per artwork: resolution first, since it changes the price; + // otherwise a width that saves sheet. const maxCm=Math.floor(a.px/DPI_AVISA*2.54*10)/10; dica = dpi0 && maxCmPequena para '+n1(a.cm)+' cm. Em '+DPI_AVISA+' DPI ela sai com até '+ @@ -558,23 +562,38 @@ function pintaArtes(){ n1(sug.cm)+' cm.' : ''; } - return '
'+escapeHTML(a.f.name)+''+ - ''+ - (a.px>0?a.px+' × '+a.py+' px':'a ler')+''+ - '
'+ - '
'+ - '
'+ - '
'+ - (TAMANHOS[larguraFilme()]||[]).map(t=>'').join('')+ - ''+ - ''+ - ''+ - '
'+barra+'
'+calc+'
'+dica+'
'; + const mini = a.miniSrc ? '' : ''+escapeHTML(extDe(a.f.name))+''; + const sub = a.cm>0 && a.src ? (a.q>1? a.q+' × ' : '')+''+n1(a.cm)+' × '+n1(a.cm*propDe(a))+' cm' : ''; + return '
'+ + '
'+mini+'
'+ + '
'+escapeHTML(a.f.name)+''+(a===recemChegada?'nova':'')+ + '
'+ + '
'+medida+''+(a.px>0? a.px+' × '+a.py+' px · ' : '')+ + escapeHTML(extDe(a.f.name))+' · '+fmt(a.f.size)+'
'+ + barra+chips+aviso+dica+ + '
'+ + '
'+ + '
'+ + 'cm
'+ + '
'+ + ''+ + ''+ + '
'+ + ''+ + ''+ + ''+ + (sub? '
'+sub+'
' : '')+ + '
'+(TAMANHOS[larguraFilme()]||[]).map(t=>'').join('')+'
'+ + '
'+ + '
'; }).join(''); + $('lista').querySelectorAll('[data-passoa]').forEach(b=>b.addEventListener('click',()=>{ + const el=$('q'+b.dataset.i); + el.value=Math.max(1,Math.min(200,(+el.value||1)+(+b.dataset.passoa))); + el.dispatchEvent(new Event('change')); + })); $('lista').querySelectorAll('[data-rm]').forEach(b=>b.addEventListener('click',()=>{artes.splice(+b.dataset.rm,1);pintaArtes();})); $('lista').querySelectorAll('[data-cm]').forEach(i=>i.addEventListener('change',()=>{artes[+i.dataset.cm].cm=+i.value||0;pintaArtes();})); $('lista').querySelectorAll('[data-q]').forEach(i=>i.addEventListener('change',()=>{artes[+i.dataset.q].q=Math.max(1,Math.min(200,Math.floor(+i.value||1)));pintaArtes();})); diff --git a/web/site-upload.js b/web/site-upload.js index 77fea3b..e272b51 100644 --- a/web/site-upload.js +++ b/web/site-upload.js @@ -136,12 +136,13 @@ function medir(a){ if(pct-mostrado>=1){ mostrado=pct; a.lendo=pct; pintaProgressoArte(a); } }).catch(()=>null); a.lendo=null; - if(cv && artes.includes(a)) a.src=cv.toDataURL('image/webp',0.9); else if(!cv) a.decodeError=true; + if(cv && artes.includes(a)){ a.src=cv.toDataURL('image/webp',0.9); a.miniSrc=miniatura(cv); } + else if(!cv) a.decodeError=true; return a; }).catch(()=>{ a.decodeError=true; return a; }); } return carregarImagem(a.f).then(img=>{ - if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height; a.src=img.src; } + if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height; a.src=img.src; a.miniSrc=miniatura(img); } else a.decodeError=true; return a; }); diff --git a/web/site-v2.css b/web/site-v2.css index 681079f..252c834 100644 --- a/web/site-v2.css +++ b/web/site-v2.css @@ -436,3 +436,16 @@ html:is([data-rota="pagamento"],[data-rota="pix"]) .pagGrid{display:grid;grid-te .skelLinha{height:14px;margin:8px 0} .skelLinha.curta{width:40%} .skelBloco{height:160px;margin-top:8px} + +/* Artes avulsas: the file card of a finished sheet, plus width, rotation and sizes */ +.rep.nova{box-shadow:0 0 0 2px rgba(255,168,26,.45)} +.novaT{margin-left:8px;padding:2px 7px;border-radius:999px;background:#FFF1DB;color:#8A4B00;font-size:11px;font-style:normal;font-weight:800;text-transform:uppercase;letter-spacing:.04em} +.repMed .pede{font-size:16px;color:var(--texto2)} +.art2 .giros{display:inline-flex;gap:6px} +.art2 .giros .gr{width:44px;height:44px;border:1px solid #D6D6D6;border-radius:10px;background:#fff;font-size:16px;cursor:pointer} +.art2 .giros .gr.on{border-color:var(--laranja);background:var(--aviso-fundo)} +.art2 .atalhos{flex-basis:100%;display:flex;flex-wrap:wrap;gap:8px;margin:0} +.art2 .atalhos .tm{height:34px;padding:0 12px;border:1px solid #D6D6D6;border-radius:8px;background:#fff;font-size:13px;font-weight:600;cursor:pointer} +.art2 .atalhos .tm.on{border-color:var(--verde);background:var(--verde-fundo);color:var(--verde)} +.art2 .dica{margin-top:4px} +.rep .l1 .novaT{margin-right:auto}