1import{r as y,W as b,j as e,B as i,C as c,a as n,a4 as D,aM as F,O as t,E as v,M as w,L as I,a8 as L,U as R}from"./index-tc5-nNLC.js";import{L as x}from"./label-MwGx_WS4.js";import{S,a as C,b as T,c as k,d}from"./select-Bsa-6vNv.js";import{F as U}from"./filter-DmG6gd0Q.js";import{f as m}from"./format-D3jHS6VA.js";import{E as V}from"./external-link-wMXh6D17.js";import"./index-C-y5wYFI.js";import"./chevron-down-DOFZ7rzv.js";import"./chevron-up-1gTexUQn.js";import"./differenceInCalendarDays-YJe1lx93.js";const h=[{value:"basketball",label:"Basketball",icon:"ð"},{value:"football",label:"Football",icon:"ð"},{value:"volleyball",label:"Volleyball",icon:"ð"},{value:"baseball",label:"Baseball",icon:"â¾"},{value:"soccer",label:"Soccer",icon:"â½"}],O=["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"],z=[{value:"tournament",label:"Tournament"},{value:"showcase",label:"Showcase"},{value:"camp",label:"Camp"},{value:"combine",label:"Combine"},{value:"tryout",label:"Tryout"},{value:"league",label:"League"}];function J(){var N;const[a,r]=y.useState({sport:"",state:"",city:"",eventType:""}),[p,M]=y.useState(!1),u=new URLSearchParams(Object.entries(a).filter(([s,l])=>l!=="")).toString(),{data:o=[],isLoading:A}=b({queryKey:["/api/youth-sports/events",u],queryFn:async()=>{const s=await fetch(`/api/youth-sports/events?${u}`);if(!s.ok)throw new Error("Failed to fetch events");return s.json()}}),{data:j=[]}=b({queryKey:["/api/youth-sports/featured"]}),g=s=>{var l;return((l=h.find(E=>E.value===s))==null?void 0:l.icon)||"ð"},f=s=>({basketball:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-100",football:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",volleyball:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-100",baseball:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100",soccer:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-100"})[s]||"bg-gray-100 text-gray-800";return e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Discover Events"}),e.jsx("p",{className:"text-muted-foreground",children:"Find tournaments, showcases, camps, and more"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(i,{variant:a.sport===""?"default":"outline",size:"sm",onClick:()=>r({...a,sport:""}),"data-testid":"filter-all-sports",children:"All Sports"}),h.map(s=>e.jsxs(i,{variant:a.sport===s.value?"default":"outline",size:"sm",onClick:()=>r({...a,sport:s.value}),"data-testid":`filter-${s.value}`,children:[e.jsx("span",{className:"mr-1",children:s.icon}),s.label]},s.value)),e.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>M(!p),"data-testid":"toggle-filters",children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"More Filters"]})]}),p&&e.jsx(c,{children:e.jsx(n,{className:"pt-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{children:"State"}),e.jsxs(S,{value:a.state,onValueChange:s=>r({...a,state:s}),children:[e.jsx(C,{"data-testid":"state-filter",children:e.jsx(T,{placeholder:"All States"})}),e.jsxs(k,{children:[e.jsx(d,{value:"",children:"All States"}),O.map(s=>e.jsx(d,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{children:"City"}),e.jsx(D,{placeholder:"Enter city name",value:a.city,onChange:s=>r({...a,city:s.target.value}),"data-testid":"city-filter"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{children:"Event Type"}),e.jsxs(S,{value:a.eventType,onValueChange:s=>r({...a,eventType:s}),children:[e.jsx(C,{"data-testid":"type-filter",children:e.jsx(T,{placeholder:"All Types"})}),e.jsxs(k,{children:[e.jsx(d,{value:"",children:"All Types"}),z.map(s=>e.jsx(d,{value:s.value,children:s.label},s.value))]})]})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(i,{variant:"outline",onClick:()=>r({sport:"",state:"",city:"",eventType:""}),"data-testid":"clear-filters",children:"Clear Filters"})})]})})}),j.length>0&&a.sport===""&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(F,{className:"w-5 h-5 text-yellow-500"}),"Featured Events"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:j.slice(0,3).map(s=>e.jsx(c,{className:"border-2 border-yellow-200 dark:border-yellow-800","data-testid":`featured-${s.id}`,children:e.jsx(n,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:g(s.sport)}),e.jsx(t,{className:f(s.sport),children:s.sport}),e.jsx(t,{variant:"outline",children:s.eventType})]}),e.jsx("h3",{className:"font-semibold",children:s.eventName}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(v,{className:"w-4 h-4"}),m(new Date(s.startDate),"MMM d, yyyy")]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(w,{className:"w-4 h-4"}),s.city,", ",s.state]})]})]})})},s.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:a.sport?`${(N=h.find(s=>s.value===a.sport))==null?void 0:N.label} Events`:"All Events"}),e.jsxs("span",{className:"text-muted-foreground",children:[o.length," events found"]}
1)]}),A?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(I,{className:"w-8 h-8 animate-spin"})}):o.length===0?e.jsx(c,{children:e.jsxs(n,{className:"py-12 text-center text-muted-foreground",children:[e.jsx(L,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg",children:"No events found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters or check back later"})]})}):e.jsx("div",{className:"grid gap-4",children:o.map(s=>e.jsx(c,{className:"hover:shadow-md transition-shadow","data-testid":`event-${s.id}`,children:e.jsx(n,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[e.jsxs("div",{className:"space-y-3 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-2xl",children:g(s.sport)}),e.jsx(t,{className:f(s.sport),children:s.sport.charAt(0).toUpperCase()+s.sport.slice(1)}),e.jsx(t,{variant:"outline",children:s.eventType}),s.organizingBody&&e.jsx(t,{variant:"secondary",children:s.organizingBody}),s.scoutAttendanceConfirmed&&e.jsx(t,{className:"bg-green-100 text-green-800",children:"Scouts Attending"})]}),e.jsx("h3",{className:"font-semibold text-lg",children:s.eventName}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(v,{className:"w-4 h-4"}),m(new Date(s.startDate),"MMM d, yyyy"),s.endDate&&s.endDate!==s.startDate&&e.jsxs(e.Fragment,{children:[" - ",m(new Date(s.endDate),"MMM d, yyyy")]})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(w,{className:"w-4 h-4"}),s.venue&&`${s.venue}, `,s.city,", ",s.state]}),s.expectedTeams&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"w-4 h-4"}),s.expectedTeams," teams expected"]})]}),s.ageDivisions&&s.ageDivisions.length>0&&e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Divisions:"}),s.ageDivisions.map(l=>e.jsx(t,{variant:"outline",className:"text-xs",children:l},l))]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.description})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[s.costRange&&e.jsx(t,{variant:"outline",className:"justify-center",children:s.costRange==="free"?"Free":s.costRange}),s.registrationUrl&&e.jsx(i,{size:"sm",asChild:!0,"data-testid":`register-${s.id}`,children:e.jsxs("a",{href:s.registrationUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(V,{className:"w-4 h-4 mr-1"}),"Register"]})}),s.websiteUrl&&e.jsx(i,{size:"sm",variant:"outline",asChild:!0,children:e.jsx("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",children:"More Info"})})]})]})})},s.id))})]})]})}export{J 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.