1import{p as e,w as U,A as q,a as c}from"./chunk-BV7QT456-DdeNQK3V.js";import{H as R}from"./highlight-Bf3vZFRU.js";import{u as V}from"./AuroraHeightContext-Du1RimSR.js";import{u as $,B as I,c as S}from"./css-CtSQ2U0U.js";import{I as H,C as P}from"./clock-DhYr3QgP.js";import{L as K}from"./LocalizedLink-CABVC1eZ.js";import{C as G}from"./CollapsibleTags-BaYQewd5.js";import{N as J}from"./NewLabel-CizDXIIZ.js";import{i as W,a as X}from"./date-Cu3IqPnA.js";import{u as z}from"./useTranslation-BujEXuts.js";import{L as E}from"./LoadingLottie-CDiFwgti.js";import{u as Y}from"./Seo-B4NcTgFc.js";import{i as Z}from"./i18n-routing-CyUnpHmq.js";import{u as ee}from"./useInfiniteQuery-fv54uzjx.js";import{g as te}from"./activity-DN10uSrQ.js";import"./useCountdown-ihuQnlWl.js";import"./arrow_up-Tx3DtFcy.js";import"./i18nInstance-DFZXkL9T.js";import"./preload-helper-ckwbz45p.js";import"./useBaseQuery-CyR1GZb_.js";import"./infiniteQueryBehavior-D7RFZ_Qh.js";import"./auth-7Bakg_EV.js";function F({activity:t,className:r=""}){const{t:a,i18n:m}=z(),u=new Date(t.endTime)<new Date,l=!u,x=new Date(t.startTime)<=new Date&&l,g=$(),f=W(t.publishDate);return e.jsx(K,{to:`/activity/${t.key}`,className:S("block py-10 transition-all duration-300 cursor-pointer group",r),style:{background:"transparent"},onMouseEnter:o=>{o.currentTarget.style.background="linear-gradient(to right, #ECEFFF , #FAFFE7)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent"},children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start gap-y-2 gap-x-10 px-4 md:container-x-padding",children:[e.jsx("div",{className:`w-full md:w-auto mb-4 md:mb-0 relative aspect-7/3 ${u?"before:bg-black before:w-full before:absolute before:inset-0 before:rounded-lg before:opacity-50":""}`,children:e.jsx("img",{src:t.imageUrl,alt:t.title,className:"w-full md:w-xs aspect-7/3 object-cover rounded-lg"})}
1),e.jsxs("div",{className:"flex-1 min-w-0 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[f&&e.jsx(J,{}),e.jsx("span",{className:"text-[18px] text-gray-500",children:X(new Date(t.startTime))})]}),e.jsx("h3",{className:"text-md md:text-[18px] font-medium text-gray-900 mb-2.5 leading-tight",children:t.title}),e.jsx("div",{className:"text-lg md:text-[20px] font-medium mb-0 md:mb-3",children:t.eventCategory}),g!==I.Desktop&&x&&l&&e.jsxs("div",{className:"my-2 flex items-center flex-row flex-wrap sm:gap-x-2 gap-y-1",children:[e.jsx("img",{src:H,alt:"Clock icon",className:"inline-block"}),e.jsx("span",{className:"text-md text-gray-600 ",children:a("activity.until_deadline")}),e.jsx(P,{targetDate:t.endTime,className:"text-xl text-gray-800 font-medium"})]}),e.jsx("div",{className:S(x?"":"mt-2"),children:e.jsx(G,{tags:t.tags})})]}),g==I.Desktop&&x&&l&&e.jsxs("div",{className:"flex-shrink-0 text-right flex flex-col pl-9 border-l-1 border-gray-300 h-36 justify-center",children:[e.jsx("div",{className:"mb-2.5 flex text-center justify-center",children:e.jsx("span",{className:"inline-flex px-3 py-1 text-[18px] font-medium text-gray-600",children:u?"":e.jsxs(e.Fragment,{children:[e.jsx("img",{src:H,alt:"Clock icon",className:"inline-block mr-1"}),a("activity.until_deadline")]})})}),e.jsx("div",{className:"text-right",children:e.jsx(P,{targetDate:t.endTime,className:"text-xl text-gray-800 font-medium mb-1"})})]})]})})}function se(t){const r=t==null?void 0:t.limit;return ee({queryKey:["activities","infinite",t==null?void 0:t.time,t==null?void 0:t.search],queryFn:({pageParam:a=0})=>te({skip:a,limit:r,time:t==null?void 0:t.time,search:t==null?void 0:t.search}),getNextPageParam:(a,m)=>{if(!(a.length<r))return m.length*r},initialPageParam:0})}async function Te({params:t}){return Z(t.lang)?{}:q("/activity")}const b=()=>e.jsx("div",{className:"w-full h-px flex",children:e.jsx("div",{className:"grow bg-black opacity-30 block mx-4 md:container-x-margin"})}),Ce=U(function(){var T;const{t:r,i18n:a}=z(),[m,u]=c.useState(""),{data:l,isLoading:x,error:g,fetchNextPage:f,hasNextPage:o,isFetchingNextPage:v}=se({limit:10}),{setOuterHeightClass:_,setBottomHeightClass:O}=V(),k=c.useRef(null),y=c.useMemo(()=>(l==null?void 0:l.pages.flat())??[],[l]);c.useMemo(()=>{_("h-50"),O("h-50")},[]),c.useEffect(()=>{const s=new IntersectionObserver(d=>{d[0].isIntersecting&&o&&!v&&f()},{threshold:.1}),i=k.current;return i&&s.observe(i),()=>{i&&s.unobserve(i)}},[o,v,f]);const n=(T=a.language)!=null&&T.includes("zh")?"zh-Hant":"en",D=s=>{var i,d;return{title:s.title[n]??s.title.en,imageUrl:s.imageUrl,startTime:new Date(s.startTime).toISOString(),endTime:new Date(s.endTime).toISOString(),publishDate:new Date(s.publishDate).toISOString(),status:"PUBLISHED",key:s.id,eventCategory:((i=s.category)==null?void 0:i[n])??((d=s.category)==null?void 0:d.en)??"",tags:(s.tags||[]).map(p=>p.name[n]??p.name.en),createdAt:new Date,updatedAt:new Date}},h=c.useMemo(()=>{if(!m.trim())return y;const s=m.toLowerCase();return y.filter(i=>{var C,L,A,M;const d=(i.title[n]??i.title.en).toLowerCase(),p=(((C=i.category)==null?void 0:C[n])??((L=i.category)==null?void 0:L.en)??"").toLowerCase(),B=(((A=i.description)==null?void 0:A[n])??((M=i.description)==null?void 0:M.en)??"").toLowerCase(),Q=(i.tags||[]).map(j=>(j[n]??j.en).toLowerCase());return d.includes(s)||p.includes(s)||B.includes(s)||Q.some(j=>j.includes(s))})},[y,m,n]),N=c.useMemo(()=>h.filter(s=>new Date(s.endTime)>new Date).slice(0,6).map(D),[h,n]),w=c.useMemo(()=>h.filter(s=>new Date(s.endTime)<=new Date).map(D),[h,n]);return Y({title:n==="zh-Hant"?"æ´»åè³è¨ï½The Makers by MakerVille":"Activityï½The Makers by MakerVille"}),x?e.jsx(E,{}):g?e.jsx("div",{className:"min-h-screen w-full bg-transparent",children:e.jsx("div",{className:"flex justify-center items-center py-20",children:e.jsx("p",{className:"text-red-500",children:"Error loading activities"})})}):e.jsxs("div",{className:"min-h-screen w-full bg-transparent",children:[e.jsx("div",{children:e.jsx("div",{className:"flex justify-center w-full py-6 px-4 md:container-x-padding",children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative flex flex-col items-center justify-center",children:[e.jsx("img",{src:R,alt:"highlight",className:"absolute top-6 md:top-12 w-full z-0"}),e.jsx("h1",{className:"relative z-10 text-4xl md:text-[72px] font-bold text-black leading-none mb-2",children:r("activity.title")})]}),a.language=="zh-Hant"&&e.jsx("h2",{className:"text-3xl md:text-[32px] font-medium text-black mt-1 md:mt-4 text-center",children:r("activity.subtitle")})]})})}),e.jsxs("div",{className:"pt-4 pb-25 md:pt-8 lg:pb-40",children:[e.jsxs("section",{className:"mb-20 md:mb-12 ",children:[e.jsx("h2",{className:"text-xl md:text-[24px] font-semibold text-black mb-5 px-4 c
1ontainer-x-margin",children:r("activity.upcoming_activities")}),e.jsx(b,{}),N.length>0?e.jsx("div",{children:N.map((s,i)=>e.jsxs("div",{children:[e.jsx(F,{activity:s},s.key),i!==N.length-1&&e.jsx(b,{})]},s.key))}):e.jsx("div",{className:"text-center py-2 md:py-8 text-gray-500",children:r(m?"activity.no_matching_activities":"activity.no_activities")})]}),e.jsx("section",{children:w.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl md:text-[24px] font-semibold text-black mb-5 px-4 container-x-margin",children:r("activity.past_activities")}),e.jsx(b,{}),w.map((s,i)=>e.jsx("div",{children:e.jsxs("div",{children:[e.jsx(F,{activity:s},s.key),i!==w.length-1&&e.jsx(b,{})]},s.key)}))]})}),e.jsx("div",{ref:k,className:"h-10 flex justify-center items-center",children:v&&e.jsx(E,{})})]})]})});export{Te as clientLoader,Ce 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.