PageSourceSearch

https://bowtiesports.com/assets/FanCourtManagement-Dtyf-O17.js

js bowtiesports.com collected 2026-10-07 02:28:45 UTC 8,767 bytes, 1 lines download raw bytes

1import{r as y,j as e}from"./react-vendor-DUhHROXo.js";import{P as E}from"./PortalLayout-BUxGSFei.js";import{C as r,b as n,c as m,a as l}from"./card-9IoFUltb.js";import{_ as Q,J as D,Z as K,o as d}from"./index-BLtzf0SR.js";import{B as g}from"./badge-BsE4KYIf.js";import{T as L,a as V,b as x}from"./tabs-B9G-WuXr.js";import{S as I,a as H,b as J,c as O,d as C}from"./select-CMAo_7oa.js";import{u as b}from"./useMutation-BXp6BKyU.js";import{s as N}from"./client-DTel1CZI.js";import{u as p}from"./index-Cx0UdoxP.js";import{C as S}from"./clock-DK72Hop1.js";import{C as _}from"./circle-check-big-DjewDTKr.js";import{S as u}from"./star-DkFa3J6y.js";import{M as F}from"./message-square-BDdDilNB.js";import{F as U}from"./filter-Cq5B9N9E.js";import{C as X}from"./circle-x-NbN4zGTu.js";import{T as Z}from"./trash-2-cCh6Q5cl.js";import{f as G}from"./format-DGzj7MEM.js";import"./AdminLayout-4AAuHeAU.js";import"./router-vendor-Dz9PdDzH.js";import"./NavLink-CsyG-eHO.js";import"./scroll-area-BdyOmc9o.js";import"./index-BdQq_4o_.js";import"./collapsible-BAD8kbtc.js";import"./index-CMI-ZfmW.js";import"./arrow-left-CRb8P6iH.js";import"./globe-CQ83QW2m.js";import"./users-CIwSfVhi.js";import"./activity-CwFToTs3.js";import"./list-todo-BR3jv1RJ.js";import"./calendar-BDETTnfZ.js";import"./users-round-CCw5yxW7.js";import"./radio-BQgeDg5T.js";import"./clapperboard-BvstouST.js";import"./clipboard-list-CQJ-vJ2y.js";import"./image-arBWrt3y.js";import"./folder-open-CIWhCFhy.js";import"./pencil-C2cyk8cg.js";import"./ticket-l9bl0kcm.js";import"./megaphone-DpQsxotQ.js";import"./package-DKB1lvtO.js";import"./circle-user-BeB3uaA1.js";import"./folder-kanban-B8jlMC6s.js";import"./settings-Baim_Eei.js";import"./briefcase-CdSp4ViD.js";import"./chart-line-ohAz7u_s.js";import"./HostOwnerLayout-PM2-LrXf.js";import"./layers-CvbkNa7J.js";import"./dollar-sign-D3lTBfQm.js";import"./index-O12prPmO.js";import"./chevron-up-B89bkR-F.js";import"./en-US-Bfz1jvxT.js";import"./differenceInCalendarDays-D4nmWE3G.js";import"./getTimezoneOffsetInMilliseconds-DsfBWtEI.js";const T={pending:{color:"bg-yellow-500/10 text-yellow-600",label:"Pending"},approved:{color:"bg-green-500/10 text-green-600",label:"Approved"},rejected:{color:"bg-red-500/10 text-red-600",label:"Rejected"},featured:{color:"bg-purple-500/10 text-purple-600",label:"Featured"}};function We(){const v=Q(),[i,q]=y.useState("pending"),[h,M]=y.useState("all"),{data:t,isLoading:k}=D({queryKey:["fan-court-submissions",i],queryFn:async()=>{let s=N.from("fan_court_submissions").select("*").order("created_at",{ascending:!1});i!=="all"&&(s=s.eq("status",i));const{data:a,error:c}=await s;if(c)throw c;return a}}),o=b({mutationFn:async({id:s,status:a,is_featured:c})=>{const j={reviewed_at:new Date().toISOString()};a&&(j.status=a),c!==void 0&&(j.is_featured=c);const{error:w}=await N.from("fan_court_submissions").update(j).eq("id",s);if(w)throw w},onSuccess:()=>{v.invalidateQueries({queryKey:["fan-court-submissions"]}),p.success("Submission updated")},onError:()=>p.error("Failed to update submission")}),A=b({mutationFn:async s=>{const{error:a}=await N.from("fan_court_submissions").delete().eq("id",s);if(a)throw a},onSuccess:()=>{v.invalidateQueries({queryKey:["fan-court-submissions"]}),p.success("Submission deleted")},onError:()=>p.error("Failed to delete submission")}),R=(t==null?void 0:t.filter(s=>s.status==="pending").length)||0,z=(t==null?void 0:t.filter(s=>s.status==="approved").length)||0,B=(t==null?void 0:t.filter(s=>s.is_featured).length)||0,f=h==="all"?t:t==null?void 0:t.filter(s=>s.category===h),P=[...new Set(t==null?void 0:t.map(s=>s.category).filter(Boolean))];return e.jsx(E,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Fan Court"}),e.jsx("p",{className:"text-muted-foreground",children:"Review and manage fan submissions"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Pending Review"}),e.jsx(S,{className:"h-4 w-4 text-yellow-500"})]}),e.jsx(l,{children:e.jsx("div",{className:"text-2xl font-bold",children:R})})]}),e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Approved"}),e.jsx(_,{className:"h-4 w-4 text-green-500"})]}),e.jsx(l,{children:e.jsx("div",{className:"text-2xl font-bold",children:z})})]}),e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Featured"}),e.jsx(u,{className:"h-4 w-4 text-purple-500"})]}),e.jsx(l,{children:e.jsx("div",{className:"text-2xl font-bold",children:B})})]}),e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(m,{className:"text-sm font-medium",children:"Total"}),e.jsx(F,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(l,{children:e.jsx("div",{className:"text-2xl font-bold",children:(t==null?void 0:t.length)||0})})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(L,{value:i,onValueChange:q,className:"flex-1",children:e.jsxs(V,{children:[e.jsx(x,{value:"pending",children:"Pending"}),e.jsx(x,{value:"approved",children:"Approved"}),e.jsx(x,{value:"rejected",children:"Rejected"}),e.jsx(x,{value:"all",children:"All"})]})}
1),e.jsxs(I,{value:h,onValueChange:M,children:[e.jsxs(H,{className:"w-40",children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),e.jsx(J,{placeholder:"Category"})]}),e.jsxs(O,{children:[e.jsx(C,{value:"all",children:"All Categories"}),P.map(s=>e.jsx(C,{value:s,children:s},s))]})]})]}),k?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx(r,{className:"animate-pulse",children:e.jsxs(l,{className:"p-6",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 mb-2"}),e.jsx("div",{className:"h-4 bg-muted rounded w-full mb-2"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"})]})},s))}):f&&f.length>0?e.jsx("div",{className:"space-y-4",children:f.map(s=>e.jsx(r,{className:"overflow-hidden",children:e.jsx(l,{className:"p-6",children:e.jsx("div",{className:"flex items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold",children:s.name}),e.jsx(g,{className:T[s.status||"pending"].color,children:T[s.status||"pending"].label}),s.is_featured&&e.jsxs(g,{className:"bg-purple-500 text-white",children:[e.jsx(u,{className:"h-3 w-3 mr-1"}),"Featured"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"h-3 w-3"}),s.email]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"}),G(new Date(s.created_at),"MMM d, yyyy h:mm a")]}),s.category&&e.jsx(g,{variant:"outline",children:s.category})]})]})}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm",children:s.question})}),s.voice_message_url&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:s.voice_message_url,className:"h-8"})}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(d,{size:"sm",onClick:()=>o.mutate({id:s.id,status:"approved"}),children:[e.jsx(_,{className:"h-4 w-4 mr-1"}),"Approve"]}),e.jsxs(d,{size:"sm",variant:"destructive",onClick:()=>o.mutate({id:s.id,status:"rejected"}),children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),"Reject"]})]}),s.status==="approved"&&!s.is_featured&&e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>o.mutate({id:s.id,is_featured:!0}),children:[e.jsx(u,{className:"h-4 w-4 mr-1"}),"Feature"]}),s.is_featured&&e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>o.mutate({id:s.id,is_featured:!1}),children:[e.jsx(u,{className:"h-4 w-4 mr-1"}),"Unfeature"]}),e.jsx(d,{size:"sm",variant:"ghost",onClick:()=>{confirm("Delete this submission?")&&A.mutate(s.id)},children:e.jsx(Z,{className:"h-4 w-4 text-destructive"})})]})]})})})},s.id))}):e.jsxs(r,{className:"p-12 text-center",children:[e.jsx(F,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No submissions found"}),e.jsx("p",{className:"text-muted-foreground",children:i==="pending"?"No pending submissions to review":"No submissions match your filters"})]})]})})}export{We as default};

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.