PageSourceSearch

https://tutorbuddi.ai/assets/WaitlistAdmin-D3Xa9eR5.js

js tutorbuddi.ai collected 2026-10-05 13:59:56 UTC 4,047 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-Dqaq1iaa.js";import{r as t}from"./vendor-D_xiAuUj.js";import{s as i,t as s,B as a}from"./index-BnJJh0He.js";import{C as n}from"./card-Bv8W4Zw2.js";import{B as r}from"./badge-DsrVKE-e.js";import{T as l,a as c,b as d,c as o,d as m,e as x}from"./table-CEfOg2Z4.js";import{L as j}from"./loader-circle-Cc0eb4Pc.js";import"./supabase-XAR8dl0U.js";function h(){const[h,p]=t.useState([]),[g,v]=t.useState(!0);t.useEffect(()=>{b()},[]);const b=async()=>{const{data:e,error:t}=await i.from("waitlist").select("*").order("created_at",{ascending:!1});t?s({title:"Error loading waitlist",description:t.message,variant:"destructive"}):p(e||[]),v(!1)},f={total:h.length,invited:h.filter(e=>e.invited).length,waiting:h.filter(e=>!e.invited).length};return g?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(j,{className:"w-8 h-8 animate-spin text-navy"})}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Waitlist Management"}),e.jsxs("div",{className:"space-x-2",children:[e.jsxs(a,{onClick:()=>{const e=h.filter(e=>!e.invited).map(e=>e.email).join(", ");e?(navigator.clipboard.writeText(e),s({title:"📋 Emails copied!",description:`${e.split(",").length} emails copied to clipboard`})):s({title:"No emails to copy",description:"All waitlist members have been invited"})},variant:"outline",disabled:0===f.waiting,children:["📋 Copy Emails (",f.waiting,")"]}),e.jsx(a,{onClick:()=>{const e=[["Name","Email","Joined","Status","Invited Date"],...h.map(e=>[e.name||"",e.email,new Date(e.created_at).toLocaleDateString(),e.invited?"Invited":"Waiting",e.invited_at?new Date(e.invited_at).toLocaleDateString():""])].map(e=>e.join(",")).join("\n"),t=new Blob([e],{type:"text/csv"}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=`tutorbuddi-waitlist-${(new Date).toISOString().split("T")[0]}.csv`,a.click(),URL.revokeObjectURL(i),s({title:"✅ CSV exported!"})},disabled:0===h.length,children:"📥 Export CSV"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsxs(n,{className:"p-6",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"Total Signups"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900",children:f.total})]}),e.jsxs(n,{className:"p-6",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"Invited"}),e.jsx("p",{className:"text-3xl font-bold text-green-600",children:f.invited})]}),e.jsxs(n,{className:"p-6",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"Waiting"}),e.jsx("p",{className:"text-3xl font-bold text-orange-600",children:f.waiting})]})]}),e.jsx(n,{children:e.jsxs(l,{children:[e.jsx(c,{children:e.jsxs(d,{children:[e.jsx(o,{children:"Name"}),e.jsx(o,{children:"Email"}),e.jsx(o,{children:"Joined"}),e.jsx(o,{children:"Status"}),e.jsx(o,{children:"Actions"})]})}),e.jsxs(m,{children:[h.map(t=>e.jsxs(d,{children:[e.jsx(x,{className:"font-medium",children:t.name||e.jsx("span",{className:"text-gray-400",children:"—"})}),e.jsx(x,{className:"font-mono text-sm",children:t.email}),e.jsx(x,{className:"text-sm text-gray-600",children:new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(x,{children:t.invited?e.jsx(r,{className:"bg-green-500 hover:bg-green-600",children:"✓ Invited"}):e.jsx(r,{variant:"secondary",children:"⏳ Waiting"})}),e.jsx(x,{children:!t.invited&&e.jsx(a,{size:"sm",onClick:()=>(async e=>{const{error:t}=await i.from("waitlist").update({invited:!0,invited_at:(new Date).toISOString()}).eq("id",e);t?s({title:"Error updating status",description:t.message,variant:"destructive"}):(s({title:"✅ Marked as invited"}),b())})(t.id),variant:"outline",children:"Mark Invited"})})]},t.id)),0===h.length&&e.jsx(d,{children:e.jsx(x,{colSpan:5,className:"text-center py-8 text-gray-500",children:"No waitlist signups yet"})})]})]})})]})}export{h as WaitlistAdmin};

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.