PageSourceSearch

https://eisenhowertodoist.netlify.app/assets/Achievements-DpW-_NoR.js

js eisenhowertodoist.netlify.app collected 2026-10-03 10:41:45 UTC 14,012 bytes, 1 lines download raw bytes

1import{j as e,c as b,O as P,ba as J,Q as V,aA as K,cr as W,b8 as Y,M as Z,cq as ee}from"./vendor-1kUQ7zn2.js";import{d as T}from"./vendor-supabase-Dh2gyaRa.js";import{C as A,L as w,x as te,p as se,y as ae,z as re,A as ne,F as le,G as k,c as i,H as C,I as ie,J as oe,B as de,E as ce}from"./index--kdl1ae9.js";import{m as L}from"./vendor-motion-BX-jsy7E.js";import"./vendor-date-en1IyhsK.js";const me=()=>e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:[...Array(4)].map((s,r)=>e.jsx(L.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.5,delay:r*.1,ease:[.4,0,.2,1]},children:e.jsx(A,{className:"p-4 overflow-hidden relative shadow-md hover:shadow-lg transition-shadow duration-300",children:e.jsxs("div",{className:"h-40 space-y-4 flex flex-col",children:[e.jsx(w,{height:"3rem",width:"3rem",rounded:"9999px",className:"mx-auto",animate:"breathe",staggerDelay:r%5+1,withShadow:!0}),e.jsx(w,{height:"1.5rem",width:"80%",className:"mx-auto",animate:"shimmer",staggerDelay:r%5+2}),e.jsx("div",{className:"mt-2",children:e.jsx(w,{height:"0.5rem",animate:"pulse",staggerDelay:r%5+3})}),e.jsx(w,{height:"1rem",width:"90%",className:"mx-auto",animate:"shimmer",staggerDelay:r%5+4})]})})},r))}),xe=[{key:"all",label:"All"},{key:"inprogress",label:"In progress"},{key:"earned",label:"Earned"},{key:"locked",label:"Locked"}],ue=(s,r)=>(s.level||0)-(r.level||0)||(s.display_order||0)-(r.display_order||0)||s.achievement_name.localeCompare(r.achievement_name),he=({a:s})=>e.jsxs("div",{className:"flex gap-2.5 rounded-xl border border-amber-500/25 bg-gradient-to-br from-amber-500/[0.12] to-amber-500/[0.04] px-3 py-2.5",children:[e.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-amber-400 to-amber-600 text-white shadow-sm shadow-amber-500/30",children:e.jsx(C,{iconName:s.icon_name})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-semibold truncate text-amber-700 dark:text-amber-300",children:s.achievement_name}),s.points>0&&e.jsxs("span",{className:"text-[10px] font-semibold text-amber-600/70 dark:text-amber-400/70 tabular-nums flex-shrink-0",children:["+",s.points]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug line-clamp-2 mt-0.5",children:s.description}),e.jsx("span",{className:"text-[10px] text-amber-600/70 dark:text-amber-400/70",children:s.earned_at?`Earned · ${new Date(s.earned_at).toLocaleDateString()}`:"Earned"})]})]}),ge=({a:s})=>{const r=Math.round(ie(s)*100),x=oe(s),j=Math.max(0,s.target-x),o=s.state==="next",m=s.state==="locked";return e.jsxs("li",{className:i("relative flex gap-4 rounded-xl p-3 transition-colors",o&&"bg-violet-500/[0.06] ring-1 ring-violet-500/20"),children:[e.jsx("span",{className:i("relative z-10 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border-2",o?"bg-violet-500 border-violet-500 text-white ring-4 ring-violet-500/20":m?"bg-muted border-border text-muted-foreground/50":"bg-card border-border text-muted-foreground"),children:m?e.jsx(W,{className:"h-3.5 w-3.5"}):o?e.jsx(Y,{className:"h-4 w-4"}):e.jsx(C,{iconName:s.icon_name})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:i("text-sm font-semibold truncate",m&&"text-muted-foreground"),children:s.achievement_name}),s.points>0&&e.jsxs("span",{className:"text-[10px] font-semibold text-muted-foreground tabular-nums flex-shrink-0",children:["+",s.points]})]}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description})]}),e.jsx("span",{className:i("flex-shrink-0 text-[10px] font-semibold px-2 py-0.5 rounded-full",o?"bg-violet-500/15 text-violet-600 dark:text-violet-400":m?"bg-muted text-muted-foreground/70":"bg-muted text-muted-foreground"),children:o?"Up next":m?"Locked":"In progress"})]}),m?e.jsx("div",{className:"mt-1.5 text-[11px] text-muted-foreground",children:"Unlock earlier achievements to reveal this"}):s.target>0&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground mb-1 tabular-nums",children:[e.jsxs("span",{children:[x,"/",s.target]}),e.jsxs("span",{children:[j," to go"]})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:i("h-full rounded-full transition-[width] duration-500",o?"bg-gradient-to-r from-violet-500 to-fuchsia-500":"bg-muted-foreground
1/40"),style:{width:`${r}%`}})})]})]})]})},pe=()=>{const{data:s,isLoading:r}=te(),{data:x}=se(),{total:j,level:o,toNext:m,intoLevel:D,pointsPerLevel:B,levelProgressPct:F,breakdown:M}=ae(),{session:I}=T.useSessionContext(),{data:_}=re(I?.user?.id),{data:E}=ne(I?.user?.id),[u,O]=b.useState("all"),[R,$]=b.useState(new Set),N=b.useMemo(()=>{const d=le(s?.achievements??[],{matrixMinded:typeof _=="number"?_:void 0,focusMaster:typeof E=="number"?E:void 0}).filter(a=>!a.is_hidden||k(a)),c=new Set(d.filter(k).map(a=>a.achievement_type)),p=a=>k(a)?"earned":(a.prerequisites??[]).some(h=>!c.has(h))?"locked":"inprogress",f=new Map,v=new Map;(s?.categories??[]).forEach((a,n)=>{f.set(a.name,a.display_order??n),v.set(a.name,{description:a.description,icon_name:a.icon_name})});const l=new Map;for(const a of d){const n=a.category_name||"Other",h=l.get(n)??[];h.push({...a,state:p(a)}),l.set(n,h)}const z=Array.from(l.entries()).map(([a,n])=>{n.sort(ue);const h=n.findIndex(g=>g.state==="inprogress");h>=0&&(n[h].state="next");const y=n.filter(g=>g.state==="earned"),Q=n.filter(g=>g.state!=="earned"),U=y.reduce((g,G)=>g+(G.points||0),0);return{name:a,items:n,earnedItems:y,activeItems:Q,earned:y.length,total:n.length,points:U,complete:y.length===n.length,order:f.get(a)??999,meta:v.get(a)}}).sort((a,n)=>a.order-n.order||a.name.localeCompare(n.name)),H=d.filter(k).length;return{categories:z,totalEarned:H,total:d.length}},[s,_,E]);if(r)return e.jsx(me,{});if(!s||N.total===0)return null;const S=[{key:"tasks",label:"Tasks",value:M.tasks,bar:"bg-emerald-500",dot:"bg-emerald-500"},{key:"logins",label:"Logins",value:M.logins,bar:"bg-sky-500",dot:"bg-sky-500"},{key:"achievements",label:"Achievements",value:M.achievements,bar:"bg-violet-500",dot:"bg-violet-500"}].filter(t=>t.value>0),X=Math.max(1,j),q=t=>$(d=>{const c=new Set(d);return c.has(t)?c.delete(t):c.add(t),c});return e.jsxs(L.section,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.4},className:"space-y-5",children:[e.jsx(A,{className:"overflow-hidden border-border/60",children:e.jsxs("div",{className:"relative p-5 sm:p-6 bg-gradient-to-br from-violet-500/12 via-fuchsia-500/[0.06] to-transparent",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-violet-500 to-fuchsia-500 text-white shadow-lg shadow-violet-500/30",children:[e.jsx(P,{className:"h-8 w-8"}),e.jsx("span",{className:"absolute -bottom-1.5 -right-1.5 flex h-6 min-w-6 items-center justify-center rounded-full bg-background px-1 text-xs font-bold text-violet-600 dark:text-violet-400 ring-1 ring-border",children:o})]}),e.jsxs("div",{className:"leading-none",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-violet-600 dark:text-violet-400",children:"Level"}),e.jsx("div",{className:"text-4xl font-extrabold tabular-nums leading-none mt-0.5",children:o}),e.jsxs("div",{className:"mt-1.5 text-xs text-muted-foreground tabular-nums",children:[j.toLocaleString()," total XP"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("div",{className:"rounded-xl border border-border/50 bg-background/40 px-3 py-2 text-center min-w-[72px]",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 font-semibold tabular-nums",children:[e.jsx(J,{className:"h-4 w-4 text-violet-500"}),N.totalEarned,"/",N.total]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"achievements"})]}),e.jsxs("div",{className:"rounded-xl border border-border/50 bg-background/40 px-3 py-2 text-center min-w-[72px]",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 font-semibold tabular-nums",children:[e.jsx(V,{className:i("h-4 w-4",x?.activeToday?"text-orange-500":"text-amber-500/70")}),x?.current??0]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"day streak"})]})]})]}),e.jsxs("div",{className:"mt-5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1.5",children:[e.jsxs("span",{className:"font-semibold text-foreground
1/90",children:[m," XP to Level ",o+1]}),e.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[D," / ",B]})]}),e.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-violet-500 to-fuchsia-500 transition-[width] duration-700",style:{width:`${F}%`}})})]}),S.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"How you earned your XP"}),e.jsx("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:S.map(t=>e.jsx("div",{className:i("h-full transition-[width] duration-500",t.bar),style:{width:`${t.value/X*100}%`}},t.key))}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1",children:S.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:i("h-2 w-2 rounded-full",t.dot)}),t.label,e.jsx("span",{className:"tabular-nums font-semibold text-foreground/80",children:t.value.toLocaleString()})]},t.key))})]}),e.jsx("div",{className:"mt-4 inline-flex rounded-lg border border-border/70 bg-background/60 p-0.5",children:xe.map(t=>e.jsx("button",{onClick:()=>O(t.key),className:i("px-3 py-1 text-xs font-medium rounded-md transition-colors",u===t.key?"bg-violet-500 text-white":"text-muted-foreground hover:text-foreground"),children:t.label},t.key))})]})}),N.categories.map(t=>{const d=u==="all"||u==="earned",c=u!=="earned",p=t.activeItems.filter(l=>u==="all"?!0:u==="inprogress"?l.state==="inprogress"||l.state==="next":u==="locked"?l.state==="locked":!1),f=R.has(t.name),v=t.complete&&!f?[]:t.earnedItems;return p.length===0&&(!d||t.earnedItems.length===0)?null:e.jsx(A,{className:"border-border/60",children:e.jsxs("div",{className:"p-5 sm:p-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("span",{className:i("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl",t.complete?"bg-gradient-to-br from-amber-400 to-amber-600 text-white":"bg-violet-500/10 text-violet-600 dark:text-violet-400"),children:e.jsx(C,{iconName:t.meta?.icon_name||"target"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"text-base font-semibold tracking-tight truncate flex items-center gap-2",children:[t.name,t.complete&&e.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"Complete"})]}),t.meta?.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.meta.description})]})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-sm font-semibold tabular-nums",children:[t.earned,"/",t.total]}),e.jsxs("div",{className:"text-[11px] text-muted-foreground tabular-nums",children:[t.points," pts"]})]})]}),c&&p.length>0&&e.jsxs("ol",{className:"relative space-y-1",children:[e.jsx("span",{"aria-hidden":!0,className:"absolute left-[15px] top-2 bottom-2 w-px bg-border"}),p.map(l=>e.jsx(ge,{a:l},l.id))]}),d&&t.earnedItems.length>0&&e.jsxs("div",{className:i(c&&p.length>0?"mt-5 pt-4 border-t border-border/50":""),children:[e.jsxs("button",{onClick:()=>t.complete&&q(t.name),className:i("flex items-center gap-2 text-xs font-semibold text-muted-foreground mb-3",t.complete&&"hover:text-foreground transition-colors"),children:[e.jsx(P,{className:"h-3.5 w-3.5 text-amber-500"}),"Collected (",t.earnedItems.length,")",t.complete&&e.jsx(K,{className:i("h-3.5 w-3.5 transition-transform",f&&"rotate-180")})]}),v.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-2",children:v.map(l=>e.jsx(he,{a:l},l.id))}),t.complete&&!f&&e.jsx("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:"Every achievement here unlocked, nicely done."})]})]})},t.name)})]})},fe=b.memo(()=>{const s=Z(),{session:r}=T.useSessionContext();b.useEffect(()=>{r||s("/")},[r,s]);const x=b.useCallback(()=>{s("/",{replace:!0})},[s]);return r?e.jsx(L.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},className:"min-h-screen bg-gradient-to-b from-background/90 to-background/95 backdrop-blur-sm",children:e.jsxs("div",{className:"max-w-5xl mx-auto p-6 md:p-8",children:[e.jsx(L.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},children:e.jsxs(de,{variant:"outline",className:"mb-6 gap-2 group hover:bg-primary/10 transition-all duration-300",onClick:x,children:[e.jsx(ee,{className:"h-4 w-4 group-hover:-translate-x-1 transition-transform"}),e.jsx("span",{className:"font-medium",children:"Back to Matrix"})]})}),e.jsx("div",{className:"mb-6",children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight",children:"Achievements"})}),e.jsx(ce,{children:e.jsx(pe,{})})]})}):null});fe.displayName="Achievements";export{fe 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.