PageSourceSearch

https://flyzone.ai/assets/EventCheckInPage-uTu1Jlfg.js

js flyzone.ai collected 2026-10-05 14:02:12 UTC 6,158 bytes, 1 lines download raw bytes

1import{j as e}from"./query-vendor-kxTUL8xS.js";import{i as Y,u as $,r as c,L as m}from"./react-vendor-khT9Z53Y.js";import{u as z,E as w}from"./events-DfCr8P-V.js";import{u as U}from"./useEventRSVPs-DQ2kOJSU.js";import{u as J,s as d,C as l,w as o,B as i,a2 as y,l as k,a3 as C,a4 as b,J as E}from"./index-BbOD_7nn.js";import{c as O}from"./confetti.module-B5JVzsfH.js";import{L as I,Q as H,q as _,g as S,n as K,ao as Q,bu as L}from"./icons-BiI5kjMG.js";import{K as P}from"./date-sYG5kfAo.js";import"./supabase-vendor-C5ZKNp5m.js";import"./three-vendor-BtPU5qJZ.js";import"./ui-vendor-CKjFZaXr.js";import"./charts-BgRsSA2X.js";import"./animation-UXgLsWqg.js";import"./maps-BturGVvf.js";import"./form-D94rrrgd.js";import"./i18n-CVQZWYkC.js";function he(){const{eventId:t}=Y(),D=$(),{user:r,loading:M}=J(),{fetchEvent:R}=z(),{createRSVP:q}=U(t),[a,V]=c.useState(null),[B,h]=c.useState(!0),[x,u]=c.useState(!1),[F,f]=c.useState(!1),[j,v]=c.useState(null);c.useEffect(()=>{T()},[t,r]);const T=async()=>{if(!t){console.error("[EventCheckIn] No eventId provided"),h(!1);return}console.log("[EventCheckIn] Loading event:",t),h(!0);try{const s=await R(t);if(console.log("[EventCheckIn] Event data:",s?"found":"not found"),V(s),r&&s){const{data:n,error:N}=await d.from("event_rsvps").select("*").eq("event_id",t).eq("user_id",r.id).maybeSingle();N&&console.error("[EventCheckIn] Error fetching RSVP:",N),v(n),n!=null&&n.checked_in_at&&f(!0)}}catch(s){console.error("[EventCheckIn] Error loading event:",s)}finally{h(!1)}},A=async()=>{if(!(!r||!t)){u(!0);try{if(j){const{error:s}=await d.from("event_rsvps").update({checked_in_at:new Date().toISOString()}).eq("id",j.id);if(s)throw s}else{await q("going");const{data:s}=await d.from("event_rsvps").select("*").eq("event_id",t).eq("user_id",r.id).maybeSingle();if(!s)throw new Error("Failed to create RSVP");v(s);const{error:n}=await d.from("event_rsvps").update({checked_in_at:new Date().toISOString()}).eq("id",s.id);if(n)throw n}f(!0),E.success("You're checked in!"),O({particleCount:100,spread:70,origin:{y:.6}})}catch(s){E.error(s.message||"Failed to check in")}finally{u(!1)}}};if(B||M)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(l,{className:"w-full max-w-md mx-4",children:e.jsxs(o,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(I,{className:"h-10 w-10 animate-spin text-primary mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!a)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(l,{className:"w-full max-w-md mx-4",children:e.jsxs(o,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(H,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Event Not Found"}),e.jsx("p",{className:"text-muted-foreground text-center mb-6",children:"This event doesn't exist or has been removed."}),e.jsx(i,{onClick:()=>D("/getsocial/events"),children:"Browse Events"})]})})});const g=a.timezone||"America/New_York",p=new Date(a.start_date);return r?F?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsx(l,{className:"w-full max-w-md",children:e.jsxs(o,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"h-20 w-20 rounded-full bg-green-100 flex items-center justify-center mb-6",children:e.jsx(L,{className:"h-12 w-12 text-green-600"})}),e.jsx("h2",{className:"text-2xl font-bold mb-2",children:"You're Checked In!"}),e.jsxs("p",{className:"text-muted-foreground text-center mb-6",children:["Welcome to ",a.title]}),e.jsx(i,{asChild:!0,children:e.jsx(m,{to:`/getsocial/events/${t}`,children:"View Event Details"})})]})})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(l,{className:"w-full max-w-md",children:[e.jsxs(y,{className:"text-center",children:[e.jsx(k,{variant:"secondary",className:"w-fit mx-auto mb-2",children:w[a.event_type]}),e.jsx(C,{className:"text-2xl",children:a.title}),e.jsxs(b,{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(_,{className:"h-4 w-4"}),P(p,g,"MMMM d, yyyy h:mm a")]}),a.location&&e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(S,{className:"h-4 w-4"}),a.location]})]})]}),e.jsxs(o,{className:"space-y-4",children:[e.jsx(i,{onClick:A,disabled:x,className:"w-full",size:"lg",children:x?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"h-4 w-4 mr-2 animate-spin"}),"Checking In..."]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 mr-2"}),"Check In Now"]})}),e.jsx(i,{variant:"ghost",asChild:!0,className:"w-full",children:e.jsx(m,{to:`/getsocial/events/${t}`,children:"View Event Details"})})]})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(l,{className:"w-full max-w-md",children:[e.jsxs(y,{className:"text-center",children:[e.jsx(k,{variant:"secondary",className:"w-fit mx-auto mb-2",children:w[a.event_type]}),e.jsx(C,{className:"text-2xl",children:a.title}),e.jsxs(b,{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(_,{className:"h-4 w-4"}),P(p,g,"MMMM d, yyyy h:mm a")]}),a.location&&e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(S,{className:"h-4 w-4"}),a.location]})]})]}),e.jsxs(o,{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-muted-foreground",children:"Please log in to check in to this event"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(i,{asChild:!0,className:"w-full",children:e.jsxs(m,{to:`/auth/login?redirect=/getsocial/events/${t}/checkin`,children:[e.jsx(K,{className:"h-4 w-4 mr-2"}),"Log In"]})}),e.jsx(i,{variant:"outline",asChild:!0,className:"w-full",children:e.jsxs(m,{to:`/auth/signup?redirect=/getsocial/events/${t}/checkin`,children:[e.jsx(Q,{className:"h-4 w-4 mr-2"}),"Sign Up"]})})]})]})]})})}export{he 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.