module.exports=[83226,a=>{"use strict";var b=a.i(87924),c=a.i(72131);function d(){let[a,d]=(0,c.useState)([]),[e,f]=(0,c.useState)(""),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{fetch("/api/bots").then(a=>a.json()).then(a=>{d(a),a.length>0&&f(a[0]._id)}).catch(console.error)},[]),(0,c.useEffect)(()=>{e&&(j(!0),fetch(`/api/conversations/${e}`).then(a=>a.json()).then(a=>h(a.conversations||[])).catch(console.error).finally(()=>j(!1)))},[e]),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Conversations"}),(0,b.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Recent conversations"}),(0,b.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"View chat transcripts, leads captured, and channels."})]}),a.length>0&&(0,b.jsx)("select",{value:e,onChange:a=>f(a.target.value),className:"input max-w-xs",children:a.map(a=>(0,b.jsx)("option",{value:a._id,children:a.name},a._id))}),i?(0,b.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading conversations..."}):0===g.length?(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-12 text-center shadow-sm",children:[(0,b.jsx)("p",{className:"text-lg font-semibold",children:"No conversations yet"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Conversations will appear here once visitors start chatting."})]}):(0,b.jsx)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white shadow-sm",children:(0,b.jsx)("div",{className:"divide-y divide-[var(--color-border-light)]",children:g.map(a=>(0,b.jsxs)("div",{className:"flex flex-col gap-2 px-5 py-4 md:flex-row md:items-center md:justify-between",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:`rounded-full px-2 py-0.5 text-xs font-semibold text-white ${"whatsapp"===a.channel?"bg-green-500":"bg-[var(--color-bg-brand)]"}`,children:a.channel}),(0,b.jsxs)("span",{className:"text-xs text-[var(--color-text-secondary)]",children:[a.messageCount," messages"]})]}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:a.lastMessage||"No messages"})]}),(0,b.jsxs)("div",{className:"text-right text-sm",children:[a.lead?.email&&(0,b.jsx)("p",{className:"text-xs text-[var(--color-bg-brand)]",children:a.lead.email}),(0,b.jsx)("p",{className:"text-xs text-[var(--color-text-secondary)]",children:new Date(a.updatedAt).toLocaleString()})]})]},a._id))})})]})}a.s(["default",()=>d])}];

//# sourceMappingURL=src_app_%28app%29_dashboard_conversations_page_tsx_834669c3._.js.map