// Brisas do Lago — fluxo do comprador (visitante)
// Mapa → Detalhe → Simulador → Reservar → Cadastro → Assinatura → Pagamento
const { useState, useEffect, useRef, useMemo } = React;
// ─── Hero / Landing antes do mapa ─────────────────────────────────
function BuyerHero({onExplore}) {
return (
{variation === 'A' ?
: }
);
}
function LoteDetailA({lote, onContinue, onSimular}) {
// Variação 1: hero + side panel (mais editorial)
return (
◇ O que está incluso
{window.BL.EMPREENDIMENTO.amenidades.map((a,i) => (
{a.nome}
))}
◐ Quadra {lote.quadra}
Lote {lote.numero}
{lote.vistaLago && Vista para o lago}
Valor à vista
{fmtBRL(lote.valorTotal)}
ou 48× {fmtBRL(lote.valorTotal * 0.8 / 48)}
{lote.status === 'disponivel' ? (
<>
>
) : (
Este lote está {window.STATUS_LABELS[lote.status].toLowerCase()}. Deixe seu interesse e avisaremos se voltar a ficar disponível.
)}
Reserva online (24h)
Sem custo
Assinatura digital
D4Sign
Pagamento entrada
PIX ou cartão
);
}
function LoteDetailB({lote, onContinue, onSimular}) {
// Variação 2: layout horizontal, mais "ficha técnica" minimalista
return (
◇ Brisas do Lago / Quadra {lote.quadra}
Lote{' '}
{String(lote.numero).padStart(2,'0')}
À vista
{fmtBRL(lote.valorTotal)}
ou 48× {fmtBRL(lote.valorTotal * 0.8 / 48)}
{[
['Área', `${lote.area.toFixed(0)} m²`],
['Frente', `${lote.frente.toFixed(1)} m`],
['Fundo', `${lote.fundo.toFixed(1)} m`],
['R$/m²', `R$ ${lote.precoM2}`],
].map(([k, v]) => (
))}
◇ Inclusões
{window.BL.EMPREENDIMENTO.amenidades.map((a,i) => (
{a.nome}
))}
);
}
function DimRow({label, value, highlight}) {
return (
{label}
{value}
);
}
function LotePolygon({lote}) {
// Desenha um polígono representando o lote com cotas
// Aproxima como trapézio: frente em baixo, fundo em cima, com laterais esq/dir
const f = lote.frente, fu = lote.fundo, e = lote.esq, d = lote.dir;
const maxDim = Math.max(f, fu, e, d);
const scale = 180 / maxDim;
const W = 260, H = 260, cx = W/2, cy = H/2;
const fW = f * scale, fuW = fu * scale, eH = (e + d) / 2 * scale;
// Vértices: tl, tr, br, bl
const tl = [cx - fuW/2, cy - eH/2];
const tr = [cx + fuW/2, cy - eH/2];
const br = [cx + fW/2, cy + eH/2];
const bl = [cx - fW/2, cy + eH/2];
return (
);
}
// ─── Simulador ──────────────────────────────────────────────
function BuyerSimulador({lote, onBack, onContinue}) {
const [entradaPct, setEntradaPct] = useState(10);
const [parcelas, setParcelas] = useState(48);
const entrada = lote.valorTotal * entradaPct / 100;
const saldoRestante = lote.valorTotal - entrada;
const parcela = saldoRestante / parcelas;
return (
◇ Configurar entrada
setEntradaPct(+e.target.value)}
style={{flex:1, accentColor:'var(--green)'}}/>
{entradaPct}%
{fmtBRL(entrada)}
◇ Número de parcelas
{[12, 24, 36, 48].map(n => (
))}
◇ Você pagará
{fmtBRL(parcela)}
× {parcelas} meses
após entrada de {fmtBRL(entrada)} · sem juros · IGPM anual
◇ Resumo
Valor do lote
{fmtBRL(lote.valorTotal)}
Entrada ({entradaPct}%)
{fmtBRL(entrada)}
Saldo financiado
{fmtBRL(saldoRestante)}
{parcelas} parcelas de
{fmtBRL(parcela)}
Total
{fmtBRL(lote.valorTotal)}
);
}
Object.assign(window, {
BuyerHero, BuyerMap, BuyerLoteDetail, BuyerSimulador,
});