1import{x as M,r as n,q as u,w as R}from"./chunk-JZWAC4HX-DvFdmerS.js";import{j as e}from"./jsx-runtime-CuP2xq57.js";import{o as S,c as A,a as D,q as B,l as q,e as I,i as T,b as E}from"./firebase-YQaWUxJx.js";import{C as l,a as m,b as H,c as U}from"./card-D1_QtV8K.js";import{B as $}from"./button-CWAhXAIH.js";import{U as g}from"./users-ByX8iUs2.js";import{C as F}from"./circle-check-big-zaoChCKS.js";import{c as b}from"./createLucideIcon-C9NiWNpo.js";import"./utils-BQHNewu7.js";import"./index-CYashi4K.js";const O=b("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const _=b("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);function z(){const o=M(),[r,y]=n.useState({totalLeads:0,completedLeads:0,thisMonth:0,conversionRate:0}),[x,j]=n.useState([]),[f,v]=n.useState(!0);if(n.useEffect(()=>{const t=S(E,s=>{if(!s){o("/login");return}const w=A(D,"users",s.uid,"leads"),L=B(w,I("createdAt","desc"),q(5)),C=T(L,h=>{const i=h.docs.map(a=>({id:a.id,...a.data()}));j(i);const c=h.size,p=i.filter(a=>a.completedAt).length,d=new Date;d.setDate(1),d.setHours(0,0,0,0);const k=i.filter(a=>(a.createdAt?.toDate?.()||new Date(0))>=d).length;y({totalLeads:c,completedLeads:p,thisMonth:k,conversionRate:c>0?Math.round(p/c*100):0}),v(!1)});return()=>C()});return()=>t()},[o]),f)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});const N=[{label:"Total Leads",value:r.totalLeads,icon:g,color:"bg-blue-50 text-blue-600"},{label:"Completed",value:r.completedLeads,icon:F,color:"bg-green-50 text-green-600"},{label:"This Month",value:r.thisMonth,icon:O,color:"bg-purple-50 text-purple-600"},{label:"Conversion Rate",value:`${r.conversionRate}%`,icon:_,color:"bg-orange-50 text-orange-600"}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx(l,{className:"bg-gradient-to-r from-primary to-cyan-700 border-0",children:e.jsxs(m,{className:"p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"Welcome to BidHawk"}),e.jsx("p",{className:"text-white/80 mb-4",children:"Get started by creating your first embed widget to capture leads."}),e.jsx($,{asChild:!0,variant:"secondary",className:"bg-white text-primary hover:bg-gray-100",children:e.jsx(u,{to:"/dashboard/embeds/new",children:"Create Your First Embed"})})]})}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:N.map(t=>{const s=t.icon;return e.jsx(l,{children:e.jsxs(m,{className:"p-4",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg ${t.color} flex items-center justify-center mb-3`,children:e.jsx(s,{className:"w-5 h-5"})}),e.jsx("p",{className:"text-2xl font-bold text-dark",children:t.value}),e.jsx("p",{className:"text-sm text-gray",children:t.label})]})},t.label)})}
1),e.jsxs(l,{children:[e.jsxs(H,{className:"flex-row items-center justify-between pb-3",children:[e.jsx(U,{className:"text-base",children:"Recent Leads"}),e.jsx(u,{to:"/dashboard/leads",className:"text-sm text-primary hover:underline",children:"View All"})]}),e.jsx(m,{className:"p-0",children:x.length===0?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(g,{className:"w-6 h-6 text-gray-400"})}),e.jsx("p",{className:"text-gray-500",children:"No leads yet"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Create an embed and add it to your website to start capturing leads."})]}):e.jsx("div",{className:"divide-y divide-gray-100",children:x.map((t,s)=>e.jsxs("div",{className:"px-6 py-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-dark",children:t.contact?.name||"Anonymous"}),e.jsx("p",{className:"text-sm text-gray-500",children:t.address})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-medium text-dark",children:["$",t.priceRange?.min?.toLocaleString()," - $",t.priceRange?.max?.toLocaleString()]}),e.jsxs("p",{className:"text-xs text-gray-500",children:[t.estimatedSqFt?.toLocaleString()," sq ft"]})]})]},t.embedId+s))})})]})]})}const te=()=>[{title:"Dashboard | BidHawk"}];async function se(){return{}}const ae=R(function(){return e.jsx(z,{})});export{se as clientLoader,ae as default,te as meta};
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.