PageSourceSearch

https://wrconstrutora.com/assets/corretor.empreendimentos-B0aYXzqi.js

js wrconstrutora.com collected 2026-10-06 03:56:05 UTC 7,226 bytes, 2 lines download raw bytes

1import{r as l,u as C,s as p,j as e,d as y,t as k}from"./index-DhQNXiYj.js";import{B as q}from"./BrandLoader-6HzuoZ6C.js";import{u as S}from"./useAuth-BsGR3FHz.js";import{D,a as $,b as E,c as L}from"./dialog-Cee-H8KD.js";import{S as M,C as Q}from"./search-Ch2UMVyX.js";import{C as R}from"./check-COcDb481.js";import{C as F,Q as U,F as h}from"./qr-code-DpWjTOFD.js";import{E as A}from"./external-link-B12zP95Q.js";import{M as B}from"./message-circle-CfqJnUTw.js";import{C as T}from"./chevron-down-2acf9UiO.js";import{P as I}from"./play-DJIdw_rL.js";import{C as O}from"./camera-DM_f3atb.js";import"./index-BUGDDV-e.js";import"./index-B0u37dQf.js";import"./index-CCi4rOmv.js";import"./index-DHkW9zr7.js";import"./index-CXtZvc56.js";import"./utils-BQHNewu7.js";function ie(){const{user:n}=S(),[i,u]=l.useState(null),[g,x]=l.useState(null),[d,b]=l.useState(""),[j,v]=l.useState(null),{data:a}=C({queryKey:["corretor","emps",n?.id],enabled:!!n?.id,queryFn:async()=>{const{data:r}=await p.from("corretores").select("id, slug").eq("user_id",n.id).maybeSingle();if(!r)return null;const{data:s}=await p.from("empreendimentos").select("id, nome, slug, cidade, bairro, cover_image_url, fachada_image_url, status, pdf_memorial_url, video_url, tour_virtual_url").eq("is_published",!0).order("ordem"),{data:o}=await p.from("lead_clicks").select("empreendimento_id").eq("corretor_id",r.id),t={};return(o??[]).forEach(c=>{c.empreendimento_id&&(t[c.empreendimento_id]=(t[c.empreendimento_id]??0)+1)}),{corr:r,emps:s??[],counts:t}}}),f=l.useMemo(()=>{if(!a)return[];const r=d.trim().toLowerCase();return r?a.emps.filter(s=>s.nome.toLowerCase().includes(r)||s.cidade?.toLowerCase().includes(r)||(s.bairro??"").toLowerCase().includes(r)):a.emps},[a,d]);if(!a)return e.jsx(q,{});const w=typeof window<"u"?window.location.origin:"",m=r=>`${w}/empreendimentos/${r}?ref=${a.corr.slug}`;async function N(r){const s=m(r);await navigator.clipboard.writeText(s),x(r),setTimeout(()=>x(null),1500),k.success("Link copiado!")}function _(r,s){const o=m(r),t=encodeURIComponent(`Confira este empreendimento da WR Construtora: ${s}
2${o}`);window.open(`https://wa.me/?text=${t}`,"_blank")}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-4xl text-deep",children:"Empreendimentos"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Copie seu link exclusivo, compartilhe e acesse os materiais de cada empreendimento."})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(M,{className:"pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-deep/50"}),e.jsx("input",{type:"search",value:d,onChange:r=>b(r.target.value),placeholder:"Buscar por nome, cidade ou bairro…",className:"w-full rounded-full border border-deep/15 bg-cream pl-11 pr-4 py-3 text-sm text-deep placeholder:text-deep/40 focus:border-deep focus:outline-none focus:ring-2 focus:ring-lime/50"})]}),e.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[f.map(r=>{const s=m(r.slug),o=!!(r.pdf_memorial_url||r.video_url||r.tour_virtual_url),t=j===r.id;return e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-deep/10 bg-cream shadow-soft hover:shadow-elevated transition",children:[e.jsxs("div",{className:"aspect-[4/3] overflow-hidden bg-muted relative",children:[e.jsx("img",{src:y(r.cover_image_url||r.fachada_image_url),alt:r.nome,className:"h-full w-full object-cover"}),e.jsxs("div",{className:"absolute top-3 right-3 rounded-full bg-deep/90 px-3 py-1 text-[10px] font-semibold text-lime backdrop-blur",children:[a.counts[r.id]??0," clique(s)"]})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-deep/60",children:[r.cidade,r.bairro?` · ${r.bairro}`:""]}),e.jsx("h3",{className:"mt-1 font-display text-xl text-deep",children:r.nome}),e.jsx("div",{className:"mt-4 rounded-lg bg-lime/15 px-3 py-2 text-xs text-deep/80 break-all font-mono",children:s}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>N(r.slug),className:"inline-flex items-center gap-1.5 rounded-full bg-deep px-3 py-2 text-xs font-medium text-lime hover:bg-deep/90",children:[g===r.slug?e.jsx(R,{className:"h-3.5 w-3.5"}):e.jsx(F,{className:"h-3.5 w-3.5"})," Copiar"]}),e.jsxs("a",{href:s,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-full border border-deep/15 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/20",children:[e.jsx(A,{className:"h-3.5 w-3.5"})," Abrir"]}),e.jsxs("button",{onClick:()=>_(r.slug,r.nome),className:"inline-flex items-center gap-1.5 rounded-full border border-deep/15 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/20",children:[e.jsx(B,{className:"h-3.5 w-3.5"})," WhatsApp"]}),e.jsxs("button",{onClick:()=>u(s),className:"inline-flex items-center gap-1.5 rounded-full border border-deep/15 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/20",children:[e.jsx(U,{className:"h-3.5 w-3.5"})," QR"]})]}),e.jsxs("button",{onClick:()=>
2v(t?null:r.id),className:"mt-4 flex w-full items-center justify-between rounded-lg border border-dashed border-deep/15 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/10",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(h,{className:"h-3.5 w-3.5"})," Materiais"]}),t?e.jsx(Q,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"})]}),t&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[r.pdf_memorial_url&&e.jsxs("a",{href:r.pdf_memorial_url,download:!0,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-full bg-lime/30 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/50",children:[e.jsx(h,{className:"h-3.5 w-3.5"})," Baixar memorial PDF"]}),r.video_url&&e.jsxs("a",{href:r.video_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-full bg-lime/30 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/50",children:[e.jsx(I,{className:"h-3.5 w-3.5"})," Vídeo"]}),r.tour_virtual_url&&e.jsxs("a",{href:r.tour_virtual_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-full bg-lime/30 px-3 py-2 text-xs font-medium text-deep hover:bg-lime/50",children:[e.jsx(O,{className:"h-3.5 w-3.5"})," Tour 360°"]}),!o&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Sem materiais cadastrados."})]})]})]},r.id)}),f.length===0&&e.jsx("div",{className:"col-span-full rounded-xl border border-dashed border-deep/15 p-12 text-center text-muted-foreground",children:a.emps.length===0?"Nenhum empreendimento publicado.":"Nenhum empreendimento encontrado para essa busca."})]}),e.jsx(D,{open:!!i,onOpenChange:r=>!r&&u(null),children:e.jsxs($,{className:"max-w-sm",children:[e.jsx(E,{children:e.jsx(L,{children:"QR Code do seu link"})}),i&&e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("img",{alt:"QR Code",className:"h-64 w-64",src:`https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=${encodeURIComponent(i)}`}),e.jsx("p",{className:"text-xs text-muted-foreground break-all text-center",children:i})]})]})})]})}export{ie as component};

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.