PageSourceSearch

https://edgemxtiming.com/assets/OrgEvents-3SqZYfpN.js

js edgemxtiming.com collected 2026-09-24 14:43:29 UTC 12,028 bytes, 1 lines download raw bytes

1import{l as E,s as L,r as v,j as e,B as f,M as q,u as C,a as I,L as O,V as R,Y,Z as A,_ as H,E as Z,bh as X,k as z,bj as N,d as S}from"./index-BCH4IFx8.js";import{C as K,a as V}from"./card-DaE3Hwfn.js";import{S as W}from"./scroll-area-hNK22iDX.js";import{g as Q,C as G}from"./RegistrationClosedMessage-qwyFFN8q.js";import{P as J,a as ee,b as te}from"./popover-BVAS7-gK.js";import{u as se,w as _}from"./useEventShareLink-BuFD548V.js";import{S as M}from"./share-2-BRqKvXQJ.js";import{C as re}from"./copy-CIGjrFWu.js";import{g as ae}from"./baseUrl-1OnSOMcw.js";import{C as w}from"./calendar-BcfRHKCP.js";import{M as ne}from"./map-pin-Eqsqtagn.js";import{D as oe}from"./dollar-sign-DZ3kPgTb.js";import{C as ie}from"./clock-DEKHqbRJ.js";import{d as le,f as m}from"./format-ybceeo2k.js";import{t as $,h as ce}from"./en-US-CGO0aXMi.js";import{d as de,g as me}from"./differenceInMilliseconds-CVPzdaho.js";import{u as ue}from"./useOrganizationSlug-DcRVJD25.js";import"./collapsible-xcd2iWHA.js";import"./index-DKPz-1vL.js";import"./calendar-check-D98g4nlx.js";import"./key-round-DESqIiUD.js";function D(t,s){const r=$(t),n=$(s),a=T(r,n),c=Math.abs(le(r,n));r.setDate(r.getDate()-a*c);const p=+(T(r,n)===-a),u=a*(c-p);return u===0?0:u}function T(t,s){const r=t.getFullYear()-s.getFullYear()||t.getMonth()-s.getMonth()||t.getDate()-s.getDate()||t.getHours()-s.getHours()||t.getMinutes()-s.getMinutes()||t.getSeconds()-s.getSeconds()||t.getMilliseconds()-s.getMilliseconds();return r<0?-1:r>0?1:r}function k(t,s,r){const n=de(t,s)/ce;return me(r==null?void 0:r.roundingMethod)(n)}function he(){return new Intl.DateTimeFormat("en-CA",{timeZone:"America/Denver",year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}function pe(t){return E({queryKey:["next-round",t],queryFn:async()=>{if(!t)return null;const s=he(),{data:r,error:n}=await L.from("events").select("id, name, event_date, location").eq("parent_event_id",t).eq("is_published",!0).is("archived_at",null).gte("event_date",s).order("event_date",{ascending:!0}).limit(50);if(n)throw n;if(!r||r.length===0)return null;const a=r[0];return{id:a.id,name:a.name,event_date:a.event_date,location:a.location??null,roundsRemaining:r.length}},enabled:!!t,staleTime:5*60*1e3})}function xe({eventId:t,eventName:s,targetUrl:r,eventDate:n,location:a,className:c,variant:p="icon"}){const[u,l]=v.useState(!1),[y,o]=v.useState(!1),{data:i}=se({eventId:t,targetUrl:r,eventName:s,create:!1}),d=(i==null?void 0:i.shortUrl)??r,h=n?new Date(`${n.split("T")[0]}T12:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"",g=`🏁 ${s}${h?` — ${h}`:""}${a?` at ${a}`:""}. Sign up here:`,F=typeof navigator<"u"&&typeof navigator.share=="function",b=(j,U)=>{window.open(U(_(d,j)),"_blank","noopener,noreferrer,width=680,height=680"),l(!1)},B=async()=>{try{await navigator.share({title:s,text:g,url:_(d,"direct")}),l(!1)}catch{}},P=async()=>{try{await navigator.clipboard.writeText(`${g} ${_(d,"copy")}`),o(!0),C.success("Link copied — paste it anywhere!"),setTimeout(()=>o(!1),2e3)}catch{C.error("Could not copy link")}};return e.jsxs(J,{open:u,onOpenChange:l,children:[e.jsx(ee,{asChild:!0,children:p==="icon"?e.jsx(f,{variant:"secondary",size:"icon",className:c,"aria-label":`Share ${s}`,title:"Share this event",children:e.jsx(M,{className:"h-4 w-4"})}):e.jsxs(f,{variant:"outline",className:c,children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"Share"]})}),e.jsxs(te,{className:"w-56 p-2 space-y-1",align:"end",children:[F&&e.jsxs(f,{variant:"ghost",className:"w-full justify-start",onClick:B,children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"Share…"]}),e.jsx(f,{variant:"ghost",className:"w-full justify-start",onClick:()=>b("facebook",j=>`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(j)}&quote=${encodeURIComponent(g)}`),children:"Facebook"}),e.jsx(f,{variant:"ghost",className:"w-full justify-start",onClick:()=>b("x",j=>`https://twitter.com/intent/tweet?text=${encodeURIComponent(g)}&url=${encodeURIComponent(j)}`),children:"X (Twitter)"}),e.jsxs(f,{variant:"ghost",className:"w-full justify-start",onClick:P,children:[y?e.jsx(q,{className:"h-4 w-4 mr-2"}):e.jsx(re,{className:"h-4 w-4 mr-2"}),"Copy link ","(for Instagram)"]})]})]})}const x=t=>{if(t.length===10){const[c,p,u]=t.split("-").map(Number);return new Date(c,p-1,u)}const s=t.split("T")[0],[r,n,a]=s.split("-").map(Number);return new Date(r,n-1,a)};function ge({event:t,linkPrefix:s="/events"}){const r=Q(t.registration_start_date,t.registration_deadline),{data:n}=pe(t.id),a=o=>m(x(o),"MMM d, yyyy"),c=o=>m(x(o),"MMM d"),p=o=>
1{const i=x(o),d=new Date(new Date().toLocaleString("en-US",{timeZone:"America/Denver"})),h=D(i,d),g=k(i,d);return g<1?"Opens soon!":g<24?`Opens in ${g}h`:h<=7?`Opens in ${h}d`:`Opens ${c(o)}`},l=r==="not_started"?{text:t.registration_start_date?p(t.registration_start_date):"Opens Soon",icon:e.jsx(ie,{className:"h-4 w-4 mr-2"}),tooltip:t.registration_start_date?`Registration opens ${a(t.registration_start_date)}`:"Registration has not started yet"}:r==="closed"?{text:"Registration Closed",icon:e.jsx(G,{className:"h-4 w-4 mr-2"}),tooltip:t.registration_deadline?`Registration closed on ${a(t.registration_deadline)}`:"Registration is closed"}:null,y=()=>{if(!t.registration_start_date)return"Coming Soon";const o=x(t.registration_start_date),i=new Date(new Date().toLocaleString("en-US",{timeZone:"America/Denver"})),d=D(o,i),h=k(o,i);return h<24?`Opens in ${h}h`:d<=3?`Opens in ${d}d`:`Opens ${c(t.registration_start_date)}`};return e.jsxs(K,{className:"group overflow-hidden bg-card border-border hover:border-primary/50 transition-all duration-300 hover:shadow-glow",children:[e.jsxs("div",{className:"relative h-48 overflow-hidden bg-muted",children:[t.image_url?e.jsx("img",{src:t.image_url,alt:t.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):e.jsx("div",{className:"w-full h-full bg-gradient-metallic flex items-center justify-center",children:e.jsx("span",{className:"font-display text-4xl text-muted-foreground/50",children:"MX"})}),r==="not_started"&&e.jsx("div",{className:"absolute top-3 right-3 bg-amber-500 text-white px-3 py-1 rounded-full text-sm font-semibold",children:y()}),r==="closed"&&e.jsx("div",{className:"absolute top-3 right-3 bg-muted text-muted-foreground px-3 py-1 rounded-full text-sm font-semibold",children:"Closed"}),r==="open"&&e.jsxs("div",{className:"absolute top-3 right-3 bg-emerald-600 text-white px-3 py-1 rounded-full text-sm font-semibold flex items-center gap-1.5",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),"Registration Open"]}),e.jsx(xe,{eventId:t.id,eventName:t.name,eventDate:(n==null?void 0:n.event_date)??t.event_date,location:(n==null?void 0:n.location)??t.location,targetUrl:`${ae()}${s}/${t.slug||t.id}`,className:"absolute top-3 left-3 h-9 w-9 shadow-md"})]}),e.jsxs(V,{className:"p-6",children:[e.jsx("h3",{className:"font-display text-2xl text-foreground mb-3 group-hover:text-primary transition-colors",children:t.name}),e.jsxs("div",{className:"space-y-2 mb-4",children:[n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground font-semibold",children:[e.jsx(w,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{children:["Next: ",n.name," — ",m(x(n.event_date),"EEE, MMM d")]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground pl-6",children:[n.roundsRemaining," round",n.roundsRemaining===1?"":"s"," remaining · Series"," ",m(x(t.event_date),"MMM d"),t.end_date?`–${m(x(t.end_date),"MMM d, yyyy")}`:""]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(w,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:(()=>{const o=x(t.event_date),i=t.end_date?x(t.end_date):null;if(!i||i.getTime()<=o.getTime())return m(o,"EEEE, MMMM d, yyyy");const d=o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth(),h=o.getFullYear()===i.getFullYear();return d?`${m(o,"MMMM d")}–${m(i,"d, yyyy")}`:h?`${m(o,"MMM d")} – ${m(i,"MMM d, yyyy")}`:`${m(o,"MMM d, yyyy")} – ${m(i,"MMM d, yyyy")}`})()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(ne,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:(n==null?void 0:n.location)||t.location})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(oe,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm",children:"Pricing based on selections"})]})]}),t.description&&e.jsx(W,{className:"h-24 mb-4",children:e.jsx("p",{className:"text-muted-foreground text-sm pr-3 whitespace-pre-wrap",children:t.description})}),r==="open"?e.jsx(f,{asChild:!0,className:"w-full org-cta-button hover:opacity-90 transition-opacity font-semibold",children:e.jsx(O,{to:`${s}/${t.slug||t.id}`,children:"Register Now"})}):e.jsx(R,{children:e.jsxs(Y,{children:[e.jsx(A,{asChild:!0,children:e.jsxs(f,{variant:"secondary",className:"w-full cursor-not-allowed opacity-70",disabled:!0,children:[l==null?void 0:l.icon,l==null?void 0:l.text]})}),e.jsx(H,{side:"top",className:"max-w-xs",children:e.jsx("p",{children:l==null?void 0:l.tooltip})})]})})]})]})}const Ue=()=>{const{orgSlug:t}=Z(),{data:s,isLoading:r}
1=ue(t),{setOrganizationFromSlug:n,branding:a,contentColors:c}=X(),p=z();v.useEffect(()=>{t&&n(t)},[t,n]);const{data:u,isLoading:l}=E({queryKey:["org-events",s==null?void 0:s.id],queryFn:async()=>{if(!(s!=null&&s.id))return[];const{data:i,error:d}=await L.from("events").select("*").eq("organization_id",s.id).eq("is_published",!0).is("archived_at",null).is("parent_event_id",null).order("event_date",{ascending:!0});if(d)throw d;return i},enabled:!!(s!=null&&s.id)}),y=r||l,o=c?{backgroundColor:c.cardBg,color:c.cardFg}:{};return r?e.jsx(N,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(S,{className:"h-8 w-8 animate-spin",style:{color:(a==null?void 0:a.primary_color)||"hsl(var(--primary))"}})})}):s?e.jsxs(N,{children:[e.jsx("section",{className:"relative py-20 overflow-hidden",style:{backgroundColor:"rgba(0,0,0,0.05)"},children:e.jsxs("div",{className:"container mx-auto px-4 relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(w,{className:"h-6 w-6",style:{color:(a==null?void 0:a.primary_color)||"hsl(var(--primary))"}}),e.jsx("span",{className:"font-semibold uppercase tracking-wider",style:{color:(a==null?void 0:a.primary_color)||"hsl(var(--primary))"},children:p.eventCalendar})]}),e.jsxs("h1",{className:"font-display text-3xl sm:text-5xl md:text-6xl",children:[s.name.toUpperCase()," EVENTS"]}),e.jsxs("p",{className:"mt-4 max-w-xl opacity-70",children:["Browse upcoming events from ",s.name," and secure your spot."]})]})}),e.jsx("section",{className:"py-16",children:e.jsx("div",{className:"container mx-auto px-4",children:y?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(S,{className:"h-8 w-8 animate-spin",style:{color:(a==null?void 0:a.primary_color)||"hsl(var(--primary))"}})}):u&&u.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(i=>e.jsx(ge,{event:i,linkPrefix:`/org/${t}/events`},i.id))}):e.jsxs("div",{className:"text-center py-20 rounded-lg border",style:{...o,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsx(w,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("h3",{className:"font-display text-2xl mb-2",children:"No Events Scheduled"}),e.jsx("p",{className:"opacity-70",children:"Check back soon for upcoming events!"})]})})})]}):e.jsx(N,{children:e.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold mb-4",children:"Organization Not Found"}),e.jsx("p",{className:"opacity-70 mb-6",children:"The organization you're looking for doesn't exist or is no longer active."}),e.jsx(O,{to:"/",style:{color:(a==null?void 0:a.primary_color)||"hsl(var(--primary))"},className:"hover:underline",children:"Return to Main Site"})]})})};export{Ue 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.