PageSourceSearch

https://www.growthconf.com.br/assets/FichaDoPatrocinador-jfVLu2Ui.js

js growthconf.com.br collected 2026-10-04 13:34:22 UTC 6,946 bytes, 1 lines download raw bytes

1import{k as D,i as T,b as P,r as l,j as a}from"./react-daO8XSXc.js";import{C as E}from"./contentService-D-YtiaGk.js";import{p as I,A as O}from"./traducaoService-DuRCLS-G.js";import{S as L,F as V,a as M,b as S,c as C,d as b,e as R,f as _}from"./Ficha-MR5k4piD.js";import{S as q,B as g}from"./Button-8-UveMcL.js";import{F as i}from"./Field-3GimFoRS.js";import{I as p,S as z,T as B}from"./Input-BWXNKslz.js";import{C as J}from"./CampoImagem-DywrfTeF.js";import{a as G}from"./Exibicao-BET41dMP.js";import{E as Q}from"./EmptyState-DyDBtv_o.js";import{u as U}from"./Avisos-DoJY8zcA.js";import{E as Z,a as $}from"./EscolhaDeEdicoes-BpNGqI3d.js";import{j as H,k as K}from"./colecaoService-UhktsMSO.js";import{C as W}from"./cotas-D2QYV2Mr.js";import{F as X}from"./TrashIcon-CSgk2SLQ.js";import"./index-B58ZFblL.js";import"./supabase-CWGMQrOR.js";import"./framer-CJI0BPWU.js";import"./lucide-DgiROqw5.js";import"./Dialog-pcGZL7JV.js";import"./index-Bx8Owg57.js";import"./index-BkA-a7YQ.js";import"./XMarkIcon-BbNpXEGa.js";import"./basicos-CJBwiWJx.js";import"./ChevronDownIcon-C1xiHESR.js";import"./PhotoIcon-DseYEjsp.js";import"./ArrowUpTrayIcon-DfXeXRJ4.js";import"./InformationCircleIcon-BuxHKy4m.js";import"./ExclamationTriangleIcon-CYNpIWW5.js";import"./Escolhas-BH21sbXZ.js";import"./index-BSdpKbQ6.js";import"./index-Be0SzB96.js";import"./colecoes-CLKtnAwb.js";import"./vinculos-ejCNwAw8.js";const Y={id:0,name:"",logo:"",tier:"business",socials:{}};function La(){const{patrocinadores:f,carregando:j,recarregar:u}=D(),{id:n}=T(),v=P(),[c,r]=l.useState(!0),x=n===void 0,d=x?null:f.find(m=>String(m.id)===n)||null,h=l.useCallback(()=>r(!1),[]);return l.useEffect(()=>{if(c)return;const m=setTimeout(()=>v("..",{replace:!0}),L);return()=>clearTimeout(m)},[c,v]),a.jsx(V,{open:c,onOpenChange:m=>!m&&r(!1),children:a.jsx(M,{children:!x&&!d&&j?a.jsxs(a.Fragment,{children:[a.jsx(S,{children:a.jsx(C,{children:"Carregando…"})}),a.jsx(b,{className:"flex items-center justify-center",children:a.jsx(q,{className:"size-7 text-painel-texto-3"})})]}):!x&&!d?a.jsxs(a.Fragment,{children:[a.jsx(S,{children:a.jsx(C,{children:"Patrocinador não encontrado"})}),a.jsx(b,{children:a.jsx(Q,{titulo:"Esta ficha não existe",descricao:"O patrocinador pode ter sido excluído. Volte para a lista e escolha outro.",acao:a.jsx(g,{variant:"secondary",onClick:h,children:"Voltar para a lista"})})})]}):a.jsx(aa,{original:d,recarregar:u,fechar:h},d?d.id:"novo")})})}function aa({original:f,recarregar:j,fechar:u}){const{avisar:n,confirmar:v}=U(),c=f===null,[r,x]=l.useState(()=>f??{...Y,id:Date.now()}),[d,h]=l.useState({}),[m,F]=l.useState(!1),N=l.useRef(null),[A,y]=l.useState([]);l.useEffect(()=>{if(c)return;let o=!1;return H(r.id).then(e=>!o&&y(e)),()=>{o=!0}},[c,r.id]);const s=(o,e)=>x(t=>({...t,[o]:e})),k=async o=>{if(o.preventDefault(),!r.name.trim()){h({nome:"O nome é obrigatório."}),requestAnimationFrame(()=>{var t;const e=(t=N.current)==null?void 0:t.querySelector('[aria-invalid="true"]');e==null||e.scrollIntoView({block:"center"}),e==null||e.focus()});return}h({}),F(!0);try{await E.saveSponsor({...r,descriptionEn:"",offerTextEn:""}),I({patrocinador:r.id}).then(t=>{t||n(O,"erro")});const e=await K(r.id,A);if(await j(),!e){n("Patrocinador salvo, mas as edições não. Abra de novo e tente marcar outra vez.","erro"),u();return}n(c?"Patrocinador cadastrado. Já está no site.":"Alterações salvas.","sucesso"),u()}catch(e){console.error("Falha ao salvar o patrocinador",e),n("Não conseguimos salvar. Se a mensagem falar em permissão, saia e entre de novo.","erro")}finally{F(!1)}},w=async()=>{if(await v({titulo:`Excluir ${r.name||"esta marca"}?`,descricao:"Ela sai do site imediatamente. Não dá para desfazer.",confirmar:"Excluir",perigo:!0}))try{await E.deleteSponsor(r.id),await j(),n("Patrocinador excluído.","sucesso"),u()}catch(e){console.error("Falha ao excluir o patrocinador",e),n("Não conseguimos excluir. Tente de novo.","erro")}};return a.jsxs(a.Fragment,{children:[a.jsxs(S,{children:[a.jsx(C,{children:c?"Novo patrocinador":r.name||"Patrocinador"}),a.jsx(R,{children:"A cota define em qual faixa do site a marca aparece."})]}),a.jsxs("form",{ref:N,onSubmit:k,className:"flex min-h-0 flex-1 flex-col",children:[a.jsxs(b,{className:"space-y-5",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsx(i,{rotulo:"Nome",obrigatorio:!0,erro:d.nome,children:o=>a.jsx(p,{...o,value:r.name,onChange:e=>s("name",e.target.value)})}),a.jsx(i,{rotulo:"Cota",children:o=>
1a.jsx(z,{...o,value:r.tier,onChange:e=>s("tier",e.target.value),children:W.map(e=>a.jsx("option",{value:e.valor,children:e.rotulo},e.valor))})})]}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-1.5 text-[13px] font-medium text-painel-texto-2",children:"Logo"}),a.jsx(J,{valor:r.logo,aoMudar:o=>s("logo",o),enviar:o=>E.uploadImage(o,"sponsors"),formato:"logo",rotuloDoBotao:"Enviar logo"}),a.jsx("p",{className:"mt-2 text-xs text-painel-texto-3",children:"Prefira a versão clara (branca), em PNG ou SVG com fundo transparente."})]}),a.jsx(i,{rotulo:"Descrição",ajuda:"Aparece no modal da marca, no site.",children:o=>a.jsx(B,{...o,rows:3,value:r.description||"",onChange:e=>s("description",e.target.value)})}),a.jsx(i,{rotulo:"Site",children:o=>a.jsx(p,{...o,type:"url",placeholder:"https://",value:r.website||"",onChange:e=>s("website",e.target.value)})}),a.jsx(G,{}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsx(i,{rotulo:"Texto da oferta",ajuda:"Vira o botão no modal da marca.",children:o=>a.jsx(p,{...o,value:r.offerText||"",onChange:e=>s("offerText",e.target.value),placeholder:"Ex.: 30 dias grátis"})}),a.jsx(i,{rotulo:"Link da oferta",children:o=>a.jsx(p,{...o,type:"url",placeholder:"https://",value:r.offerLink||"",onChange:e=>s("offerLink",e.target.value)})})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsx(i,{rotulo:"LinkedIn",children:o=>{var e;return a.jsx(p,{...o,value:((e=r.socials)==null?void 0:e.linkedin)||"",onChange:t=>s("socials",{...r.socials,linkedin:t.target.value})})}}),a.jsx(i,{rotulo:"Instagram",children:o=>{var e;return a.jsx(p,{...o,value:((e=r.socials)==null?void 0:e.instagram)||"",onChange:t=>s("socials",{...r.socials,instagram:t.target.value})})}})]}),a.jsx(i,{rotulo:"Edições",ajuda:"Quais edições esta marca patrocinou.",children:()=>a.jsx(Z,{escolhidas:A,aoMudar:y})}),a.jsx(i,{rotulo:"Onde aparece",ajuda:"Em que páginas esta marca sai.",children:()=>a.jsx($,{escolhidos:r.apareceEm??[],aoMudar:o=>s("apareceEm",o),daMarca:!0})})]}),a.jsxs(_,{className:"sm:justify-between",children:[c?a.jsx("span",{}):a.jsxs(g,{type:"button",variant:"destructive",onClick:w,children:[a.jsx(X,{"aria-hidden":!0}),"Excluir"]}),a.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row",children:[a.jsx(g,{type:"button",variant:"secondary",onClick:u,children:"Cancelar"}),a.jsx(g,{type:"submit",loading:m,children:"Salvar"})]})]})]})]})}export{La as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.