/* global React */ function WhatsAppPreview({ state, user }) { const msg = buildWhatsAppMessage(state); const hasContent = Boolean(state.category); const now = new Date(); const timeStr = now.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); // Render bold **x** as function renderText(txt) { const parts = txt.split(/(\*[^*]+\*)/g); return parts.map((p, i) => { if (p.startsWith("*") && p.endsWith("*") && p.length > 2) { return {p.slice(1, -1)}; } return {p}; }); } const photos = state.photos || []; return (
Garage Sale by Wheelsafar
WhatsApp group · 2,412 members
{!hasContent ? (
💬
Your post will build here as you fill the form.
) : (
{user?.name || "You"} · Wheelsafar
{photos.length > 0 && (
{photos.slice(0, 2).map(p => (
))}
)}
{renderText(msg)}
{timeStr} ✓✓
)}
); } function Tips({ step }) { const tips = { category: { title: "Pick carefully", body: "Category drives the rest of the form — switching it later resets your answers." }, type: { title: "Be specific", body: "The more specific the type, the faster buyers recognize what you're selling." }, size: { title: "Double-check size", body: "Most buyer questions are size mismatches. Match what's actually on the tag." }, details: { title: "Top 3 wins", body: "Year, condition and brand are what scroll-past buyers read first." }, price: { title: "Round, honest pricing", body: "Round numbers get more replies. Add 'negotiable' if you'll flex ±10%." }, photos: { title: "Two photos, well lit", body: "One wide, one tight detail. Avoid flash — daylight works best." }, reason: { title: "Keep it human", body: "A real reason (\"upgrading\", \"moving cities\") builds trust faster than specs." }, seller: { title: "Contact hygiene", body: "Buyers reply fastest to WhatsApp. Keep the number you actually check." }, }; const tip = tips[step]; if (!tip) return null; return (

Tip — {tip.title}

{tip.body}

); } Object.assign(window, { WhatsAppPreview, Tips });