PageSourceSearch

https://unitedkenyaclub.com/assets/events-C4FdxUie.js

js unitedkenyaclub.com collected 2026-09-28 23:58:40 UTC 7,599 bytes, 1 lines download raw bytes

1import{R as S,r as o,j as e,s as C,X as _,v as M,b as f}from"./index-A6wiMamB.js";import{i as D,C as z}from"./calendar-D9zWQtoa.js";import{O as g}from"./optimized-image-C517KwtZ.js";import{N as A}from"./NewsNavigation-nC8Bm9pi.js";import{f as p}from"./format-BS8Ay9AX.js";import{C as L}from"./clock-o_T0qMZJ.js";import{M as T}from"./map-pin-CQl0DHKE.js";import"./chevron-right-mLcomy6b.js";const B=[f("events","events-events-eventfallback").src,f("events","events-events-eventfallbackdining").src,f("events","events-events-eventfallbackgrounds").src],c=(s,t,n="")=>{for(const r of t){const l=s[r];if(typeof l=="string"&&l.trim())return l.trim();if(typeof l=="number")return String(l)}return n},I=s=>Array.isArray(s)?s:Array.isArray(s?.data)?s.data:[],R=s=>{const t=s.tags??s.categories??s.category??s.event_tags;return Array.isArray(t)?t.map(String).map(n=>n.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(n=>n.trim()).filter(Boolean):[]},O=(s,t,n=!0)=>{for(const r of t){const l=s[r];if(l!=null){if(typeof l=="boolean")return l;if(typeof l=="number")return l!==0;if(typeof l=="string")return!["0","false","hidden","no"].includes(l.trim().toLowerCase())}}return n},y=s=>I(s).map((t,n)=>{const r=t,l=c(r,["date","event_date","start_date","starts_at","startDate"]),i=new Date(l);if(Number.isNaN(i.getTime()))return null;const d=c(r,["title","name","event_name"],"Club Event"),m=c(r,["blurb","summary","short_description","description"]);return{id:c(r,["id","_id","event_id"],`${i.toISOString()}-${n}`),date:i,title:d,tags:R(r),img:c(r,["img","image","image_url","cover_image"],B[n%3]),time:c(r,["time","event_time","start_time"],p(i,"h:mm a")),loc:c(r,["loc","location","venue","room"],"United Kenya Club"),blurb:m,details:c(r,["details","body","description"],m),isDisplayed:O(r,["is_displayed","isDisplayed","is_published","isPublished"],!0)}}).filter(t=>!!t).filter(t=>t.isDisplayed).sort((t,n)=>t.date.getTime()-n.date.getTime());function q(){const s=S.useLoaderData(),[t,n]=o.useState(new Date),[r,l]=o.useState(()=>y(s.data)),[i,d]=o.useState(null),[m,b]=o.useState(!1),[h,v]=o.useState(s.error),[j,k]=o.useState(0);o.useEffect(()=>{if(j===0)return;(async()=>{b(!0),v(null);const u=await M();l(y(u.data)),v(u.error),b(!1)})()},[j]),o.useEffect(()=>{if(!i)return;const a=u=>{u.key==="Escape"&&d(null)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[i]);const x=t?r.filter(a=>D(a.date,t)):r,N=x.length?x:r;return e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"pt-40 pb-12 bg-cream",children:e.jsxs("div",{className:"mx-auto max-w-[1320px] px-6 lg:px-10 text-center",children:[e.jsx("p",{className:"text-gold text-xs tracking-[0.4em] uppercase mb-5",children:"The Calendar"}),e.jsx("h1",{className:"font-serif text-forest text-5xl md:text-7xl",children:"Where evenings become memory."})]})}),e.jsx(A,{}),e.jsx("section",{id:"upcoming-events",className:"bg-cream pb-32 pt-16 scroll-mt-32",children:e.jsxs("div",{className:"mx-auto grid max-w-[1320px] grid-cols-12 gap-6 overflow-x-clip px-6 lg:gap-10 lg:px-10",children:[e.jsx("aside",{className:"col-span-12 min-w-0 lg:col-span-4",children:e.jsxs("div",{className:"lg:sticky lg:top-28 bg-card border border-border p-6",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-gold mb-4",children:"Browse by date"}),e.jsx("h3",{className:"font-serif text-forest text-2xl mb-6",children:p(t??new Date,"MMMM yyyy")}),e.jsx("div",{className:"responsive-calendar",children:e.jsx(z,{mode:"single",selected:t,onSelect:n,className:C("p-0 pointer-events-auto"),modifiers:{marked:r.map(a=>a.date)},modifiersClassNames:{marked:"relative after:content-[''] after:absolute after:bottom-1 after:left-1/2 after:-translate-x-1/2 after:w-1 after:h-1 after:rounded-full after:bg-[var(--gold)]"}})}),e.jsxs("div",{className:"mt-6 text-xs text-muted-foreground",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-gold mr-2 align-middle"}),"Days with events"]})]})}),e.jsxs("div",{className:"col-span-12 min-w-0 space-y-6 lg:col-span-8",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[e.jsx("h2",{className:"min-w-0 font-serif text-3xl text-forest",children:t&&x.length?p(t,"EEEE, MMM d"):"All upcoming events"}),t&&!x.length&&r.length>0&&e.jsx("button",{onClick:()=>n(void 0),className:"text-xs uppercase tracking-[0.2em] text-gold",children:"Show all"})]}),m?e.jsxs("div",{className:"bg-card border border-border p-10 text-center",children:[e.jsx("div",{className:"inline-block h-7 w-7 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading events..."})]}):h?e.jsxs("div",{className:"bg-card border border-border p-10 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:h}),e.jsx("button",{onClick:()=>k(a=>a+1),className:"btn-gold mt-6",children:"Try Again"})]}):N.length===0?e.jsx("div",{className:"bg-card border border-border p-10 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No events are currently sc
1heduled."})}):N.map(a=>e.jsxs("button",{type:"button",onClick:()=>d(a),className:"group grid w-full min-w-0 grid-cols-12 gap-0 overflow-hidden border border-border bg-card text-left hover-glow sm:gap-6",children:[e.jsxs("div",{className:"relative col-span-12 aspect-[4/3] overflow-hidden bg-secondary sm:col-span-4 sm:aspect-auto",children:[e.jsx(g,{src:a.img,alt:"","aria-hidden":"true",optimizeWidth:560,className:"absolute inset-0 h-full w-full scale-110 object-cover opacity-50 blur-xl transition duration-700 group-hover:scale-115"}),e.jsx(g,{src:a.img,alt:a.title,optimizeWidth:560,className:"relative h-full w-full object-contain transition duration-700 group-hover:scale-[1.02]"})]}),e.jsxs("div",{className:"col-span-12 min-w-0 p-6 sm:col-span-8 sm:py-7 sm:pr-7",children:[e.jsx(w,{tags:a.tags}),e.jsx("h3",{className:"font-serif text-forest text-2xl mb-3",children:a.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-5 leading-relaxed",children:a.blurb}),e.jsx(E,{event:a})]})]},a.id))]})]})}),i&&e.jsxs("div",{className:"fixed inset-0 z-[60] flex",children:[e.jsx("div",{className:"flex-1 bg-forest/60 backdrop-blur-sm",onClick:()=>d(null)}),e.jsx("aside",{className:"w-full max-w-md bg-cream h-full overflow-y-auto fade-up",children:e.jsxs("div",{className:"p-10",children:[e.jsx("button",{onClick:()=>d(null),className:"text-forest mb-8 hover:text-gold",children:e.jsx(_,{size:22})}),e.jsx(g,{src:i.img,alt:i.title,optimizeWidth:720,className:"w-full aspect-[4/5] object-cover mb-8"}),e.jsx(w,{tags:i.tags}),e.jsx("h3",{className:"font-serif text-forest text-3xl mb-5 mt-3",children:i.title}),e.jsx("div",{className:"gold-rule w-16 mb-6"}),e.jsx(E,{event:i}),e.jsx("p",{className:"mt-6 text-muted-foreground leading-relaxed",children:i.details||i.blurb})]})})]})]})}function w({tags:s}){return s.length?e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:s.map(t=>e.jsxs("span",{className:"text-[10px] uppercase tracking-[0.2em] text-gold border border-gold/40 px-2 py-1",children:["#",t]},t))}):null}function E({event:s}){return e.jsxs("div",{className:"flex flex-wrap gap-5 text-xs text-forest",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(L,{size:12,className:"text-gold"}),"Event date:",p(s.date,"MMM d")," - ",s.time]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(T,{size:12,className:"text-gold"}),s.loc]})]})}export{q as component};

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.