PageSourceSearch

https://everythrow.com/assets/actions-m5d712uL.js

js everythrow.com collected 2026-10-06 16:30:21 UTC 7,064 bytes, 1 lines download raw bytes

1import{r as f,j as t}from"./vendor-react-B-kF5cAy.js";import{z as W,G as k,J as O,K as V,bc as F,bd as T,be as D,bf as Q,bg as Z,a7 as w,b5 as Y,m as G,F as K,bh as q,aY as z,aZ as J,O as U}from"./index-CzHRsatk.js";import{E as X,A as $}from"./explore-loading-skeleton-hVDEuJ8M.js";import{C as ee}from"./campaign-page-intro-DECemEWX.js";import{P as te}from"./page-title-CxVafghH.js";import{C as re}from"./campaign-separator-BkBdE1hD.js";import{P as se}from"./page-shell-FL8muQ5p.js";import{u as P}from"./use-hydration-stable-query-mUMcYLPT.js";import{c as H}from"./action-ordering-DTChQ2mj.js";import{g as ie}from"./activity-display-groups-DdHSc0Ur.js";import{a as oe}from"./app-i18n-DUL5iWur.js";import{A as ae}from"./activity-category-tabs-CEVPgTmN.js";import{A as B}from"./activity-card-B-WRfJlm.js";import"./vendor-motion-Cc1CmEAp.js";import"./vendor-utils-Ct12j0u0.js";import"./vendor-zod-BdcIrOrR.js";import"./workspace-core-DG8pee_8.js";import"./index-BAfuosZA.js";import"./action-cards-B1NRKiew.js";import"./landing-primitives-CCpWHhrP.js";import"./activity-goals-badge-6vJX8jf8.js";import"./activity-cadence-indicator-DKxaijwP.js";import"./activity-CcRPZPAE.js";const ne={energy:Z,food:Q,recycling:D,stadium:T,"host-city":T,"world-cup-matches":T,"healthy-lifestyle":F,travel:F},L=["all","coca-cola","energy","food","healthy-lifestyle","lifestyle","recycling","reduce","football","outdoors","travel","home","world-cup-matches","mexico-only","mascot-challenge","one-offs"],ce=new Set(L);function le(h){const o=W(),a=k(),c=P(O(o.activity.listForViewer.queryOptions())),I=P(O(o.activity.categories.queryOptions())),A=P(O(o.activity.ordering.queryOptions())),l=I.data??[],u=c.data??[],y=f.useMemo(()=>ie(u),[u]),m=A.data,N=f.useMemo(()=>[{id:"all",name:`All ${V(a.action.plural)}`,slug:"all"},...l],[l,a.action.plural]),S=f.useMemo(()=>{const r=m?.actionCategoryIds??[],g=r.length>0,v=new Set(r),j=new Map(r.map((e,s)=>[e,s]));return N.map(e=>({id:e.id,label:e.name,slug:e.slug})).filter(e=>e.id==="all"||(g?v.has(e.id):ce.has(e.slug))).sort((e,s)=>{if(e.id==="all")return-1;if(s.id==="all")return 1;const x=j.get(e.id),C=j.get(s.id);return x!==void 0&&C!==void 0?x-C:x!==void 0?-1:C!==void 0?1:L.indexOf(e.slug)-L.indexOf(s.slug)})},[N,m?.actionCategoryIds]),i=f.useMemo(()=>{const r=h?.activeCategorySlug??"all";return S.find(g=>g.slug===r)?.id??"all"},[h?.activeCategorySlug,S]),R=r=>{const g=S.find(v=>v.id===r)?.slug??"all";h?.onActiveCategorySlugChange?.(g)},n=f.useMemo(()=>{const r=y.filter(g=>i==="all"||g.categories.some(v=>v.id===i));return i==="all"?r:[...r].sort(H(u,m?.actionCategoryActivityIds?.[i]))},[y,u,i,m?.actionCategoryActivityIds]),p=i==="all",E=f.useMemo(()=>{const r=m?.actionCategoryIds??[],g=r.length>0,v=new Set(r),j=new Map(r.map((e,s)=>[e,s]));return l.filter(e=>g?v.has(e.id):!0).map((e,s)=>({category:e,originalIndex:s})).sort((e,s)=>{const x=j.get(e.category.id),C=j.get(s.category.id);if(x!==void 0&&C!==void 0)return x-C;if(x!==void 0)return-1;if(C!==void 0)return 1;const b={"world-cup-matches":0,recycling:1},M=b[e.category.slug]??Number.POSITIVE_INFINITY,_=b[s.category.slug]??Number.POSITIVE_INFINITY;return M!==_?M-_:e.originalIndex-s.originalIndex}).map(({category:e})=>{const s=ne[e.slug]??Q,x=y.filter(C=>C.categories.some(b=>b.id===e.id)).sort(H(u,m?.actionCategoryActivityIds?.[e.id]));return{id:e.id,slug:e.slug,title:e.name,icon:s,activities:x}}).filter(e=>e.activities.length>0)},[l,y,u,m]),d=N.find(r=>r.id===i)?.name??V(a.action.plural);return{categories:l,allActivities:y,filteredActivities:n,categoryFilters:S,activeCategory:i,setActiveCategory:R,isLoading:c.isLoading||I.isLoading,isError:c.isError||I.isError||A.isError,showCarousels:p,categoryCarousels:E,activeCategoryName:d}}const de=6,ge=6,ue="960px 0px",me=360;function pe({title:h,activities:o,deferUntilVisible:a=!1,presentation:c="standard",variant:I="square"}){const A=f.useRef(null),[l,u]=f.useState(!a),[y,m]=f.useState(()=>Math.min(de,o.length));f.useEffect(()=>{if(!a||l)return;const n=A.current;if(!n)return;if(typeof IntersectionObserver>"u"){u(!0);return}const p=new IntersectionObserver(E=>{E.some(d=>d.isIntersecting)&&(u(!0),p.disconnect())},{rootMargin:ue});return p.observe(n),()=>p.disconnect()},[a,l]);const N=()=>{m(n=>Math.min(o.length,n+ge))},S=n=>{if(y>=o.length)return;const p=n.currentTarget;p.scrollWidth-p.clientWidth-p.scrollLeft<=me&&N()},i=Math.min(y,o.length),R=l?o.slice(0,i):[];return t.jsx("div",{ref:A,children:t.jsxs(w,{className:"gap-4",spacing:"compact",children:[t.jsx(Y,{title:h,titleClassName:"text-2xl leading-8 tracking-heading-tight"}),l?t.jsx("div",{className:"-my-4 py-4 scrollbar-hide flex gap-4 overflow-x-auto",onScroll:S,children:R.map(n=>t.jsx(B,{activity:n,presentation:c,variant:I},n.id))}):t.jsx("div",{"aria-hidden":"true",className:"h-68"})]})})}function fe({activeCategorySlug:h,onActiveCategorySlugChange:o}){const a=oe(),c=G(),I=K("actions"),A=c.programUiKey==="every-throw",{categoryFilters:l,activeCategory:u,setActiveCategory:y,showCarousels:m,allActivities:N,filteredActivities:S,categoryCarousels:i,activeCategoryName:R,isLoading:n,isError:p}=le({activeCategorySlug:h,onActiveCategorySlugChange:o});if(n)return t.jsx(X,{});if(p)return t.jsx(w,{as:"div",className:"text-muted-foreground",children:a.app.explore.failed});if(N.length===0)return t.jsx(w,{as:"div",className:"text-muted-foreground",children:a.app.explore.empty});const E=m&&i.length>0&&N.every(d=>d.categories.length>0);return t.jsx(se,{contentClassName:"gap-0 md:gap-5",children:t.jsx("div",{className:"mx-auto flex w-full flex-col",children:t.jsxs("div",{className:"flex flex-col gap-5 pt-5 md:gap-8 md:pt-8",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[I?t.jsx(ee,{content:I}):t.jsx(w,{spacing:"compact",children:t.jsx(te,{children:a.app.explore.title})}),t.jsx($,{children:t.jsx(ae,{items:l,staggerSecondRowStart:!0,value:u,onValueChange:y})})]}),E?t.jsx("div",{className:"flex flex-col gap-8",children:i.map((d,r)=>{const g=["square","portrait"],v=g[r%g.length],j=A&&(r+1)%2===0&&r<i.length-1;return t.jsxs(f.Fragment,{children:[t.jsx(pe,{title:d.title,activities:d.activities,deferUntilVisible:r>1,presentation:"score-cta",variant:v}),j?t.jsx(w,{spacing:"compact",children:t.jsx(re,{className:"max-w-none"})}):null]},d.id)})}):t.jsx("div",{className:"flex flex-col gap-8",children:t.jsxs(w,{className:"gap-4",spacing:"compact",children:[t.jsx(Y,{title:R,titleClassName:"text-2xl leading-8 tracking-heading-tight"}),t.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 sm:gap-4",children:S.map(d=>t.jsx(B,{activity:d,cardClassName:"aspect-[2/3] h-auto w-full max-w-[180px]",containerClassName:"w-full min-w-0 sm:flex sm:justify-center",presentation:A?"score-cta":"standard"},d.id))})]})})]})})})}function He(){const h=q.useSearch(),o=q.useNavigate(),a=z({select:c=>c.location.pathname});return J(a)!=="/actions"?t.jsx(U,{}):t.jsx(fe,{activeCategorySlug:h.category,onActiveCategorySlugChange:c=>{o({search:()=>c==="all"?{category:void 0}:{category:c},replace:!0})}})}
1export{He 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.