PageSourceSearch

https://people.october.health/build/assets/achievements-WtwQrZlT.js

js october.health collected 2026-10-01 16:38:19 UTC 12,544 bytes, 1 lines download raw bytes

1import{a as O}from"./rolldown-runtime-DS2seoW7.js";import{O as V}from"./charts-DKxDZnH3.js";import{_ as Z,a as $,i as G,l as M}from"./vendor-05Yv21q1.js";import{t as S}from"./award-CkPpa1bH.js";import{t as J}from"./circle-Do08hYsX.js";import{t as K}from"./clock-C7hq1_ba.js";import{t as A}from"./gift-8LqIUtT0.js";import{t as Q}from"./pin-BlBqsUB4.js";import{t as W}from"./shirt-C6ST7CLT.js";import{t as b}from"./sparkles-DYEOgaN5.js";import{t as U}from"./star-C0edupZB.js";import{t as ee}from"./trophy-CHxCuXzA.js";import{t as P}from"./zap-CYfuQ4fS.js";import{ct as se}from"./app-DpnV7LBm.js";import{t as te}from"./brand-hero-banner-BqCY1UMk.js";import{t as le}from"./avatar-ring-Bw0G4Cod.js";import{t as n}from"./level-badge-CjVMKi5P.js";import{t as X}from"./title-flair-CW62h6D4.js";import{t as re}from"./badge-D3kp24xm.js";import{t as k}from"./trophy-card-SwlcGvYC.js";import{a as ae,i as ie,r as oe,t as ne}from"./page-toolbar-BM_ALgr9.js";import{n as ce,r as de,t as me}from"./avatar-CkjJnuq6.js";import{a as R,n as c,o as I,t as d}from"./card-DQ8kPFJB.js";import{t as m}from"./empty-state-DHPaH1Dw.js";import{c as xe,i as D,n as pe,s as he,t as je}from"./select-D2ThFgXz.js";import{a as x,n as fe,o as ue,r as p,s as H,t as ge}from"./table-Bu92i3TJ.js";import{i as h,n as j,r as ve,t as Ne}from"./tabs-DUA1G4Aa.js";import{t as be}from"./use-initials-DWIJDl9X.js";import{t as _e}from"./app-layout-CMMm1Ial.js";import{RewardsTab as we}from"./rewards-tab-B1TufKkk.js";import{YearInReview as ye}from"./year-in-review-2Q6F8Ch1.js";var z=O(V(),1),e=Z(),Te={circle:J,sparkles:b,star:U,pin:Q,shirt:W},Ce=[{title:"Dashboard",href:"/dashboard"},{title:"Achievements",href:"/achievements"}];function rs({gamification:_,achievements:f,leaderboard:w,recentXp:y,categories:B,rewards:a,nextUnlock:l}){const[u,E]=(0,z.useState)("all"),[q,T]=(0,z.useState)(!1),F=be(),{celebrationHero:Y}=M().props,t=_?.level??null,C=_?.achievements?.total_earned??0,L=t?.total_xp??0,g=a?.titles.find(s=>s.title===a.equipped_title),v=[...f].filter(s=>!s.earned&&s.progress_percent>0).sort((s,r)=>r.progress_percent-s.progress_percent)[0],N=u==="all"?f:f.filter(s=>s.category===u),i=N.filter(s=>s.earned),o=N.filter(s=>!s.earned);return(0,e.jsxs)(_e,{breadcrumbs:Ce,children:[(0,e.jsx)(G,{title:"Achievements"}),(0,e.jsxs)("div",{className:"flex w-full flex-col gap-5 p-4 sm:p-6 lg:gap-7 lg:p-8",children:[(0,e.jsx)(te,{src:Y,className:"h-24 w-full sm:h-28"}),(0,e.jsxs)(ne,{className:"pb-0",children:[(0,e.jsxs)(ie,{children:[(0,e.jsx)(ae,{children:"Achievements"}),(0,e.jsx)(oe,{children:"Earn XP, level up, and collect trophies"})]}),(0,e.jsxs)(se,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[(0,e.jsx)(b,{className:"mr-2 h-4 w-4"}),"Year in Review"]})]}),t&&(0,e.jsx)(d,{children:(0,e.jsx)(c,{className:"p-6",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-6 sm:flex-row sm:items-center",children:[(0,e.jsxs)("div",{className:"relative flex shrink-0 items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 rounded-full opacity-20 blur-2xl",style:{backgroundColor:t.color}}),(0,e.jsx)(n,{level:t.level,levelData:t,size:"xl",showTooltip:!1,className:"relative"})]}),(0,e.jsxs)("div",{className:"min-w-0 flex-1 text-center sm:text-left",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:justify-start",children:[(0,e.jsxs)("h2",{className:"text-2xl font-semibold text-foreground",children:["Level ",t.level," — ",t.title]}),g&&(0,e.jsx)(X,{title:g.title,color:g.color})]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[L.toLocaleString()," XP total · ",C," achievements earned"]}),t.xp_to_next!=null&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsxs)("div",{className:"mb-1 flex justify-between text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{children:[t.xp_required.toLocaleString()," XP"]}),t.next_level_xp&&(0,e.jsxs)("span",{children:[t.next_level_xp.toLocaleString()," XP"]})]}),(0,e.jsx)("div",{className:"h-2.5 w-full rounded-full bg-muted",children:(0,e.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${t.progress_percent}%`,backgroundColor:t.color}})}),(0,e.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[t.xp_to_next?.toLocaleStr
1ing()," XP to"," ",t.next_level_title]})]})]}),(0,e.jsxs)("div",{className:"flex shrink-0 gap-6 text-center",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-2xl font-semibold text-foreground",children:L.toLocaleString()}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total XP"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-2xl font-semibold text-foreground",children:C}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Trophies"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-2xl font-semibold text-foreground",children:t.level}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Level"})]})]})]})})}),l&&(0,e.jsx)(d,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:(0,e.jsxs)(c,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-center",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("div",{className:"relative flex shrink-0 items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 rounded-full opacity-20 blur-lg",style:{backgroundColor:l.color}}),(0,e.jsx)(n,{level:l.level,levelData:t?{...t,level:l.level,color:l.color}:null,size:"lg",showTooltip:!1,className:"relative"})]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"text-xs font-medium tracking-wide text-muted-foreground uppercase",children:"Next unlock"}),(0,e.jsxs)("p",{className:"font-semibold text-foreground",children:["Level ",l.level," ·"," ",l.title]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[l.xp_to_go.toLocaleString()," XP to go",v&&(0,e.jsxs)(e.Fragment,{children:[" · closest trophy: ",(0,e.jsx)("span",{className:"text-foreground",children:v.name})," ","(",v.progress_percent,"%)"]})]})]})]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2 sm:ml-auto",children:l.rewards.map(s=>{const r=Te[s.icon]??A;return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-3 py-1.5 text-xs font-medium",title:s.description,children:[(0,e.jsx)(r,{className:"h-3.5 w-3.5 text-primary"}),s.name]},s.key)})})]})}),(0,e.jsxs)(Ne,{defaultValue:"rewards",className:"space-y-4",children:[(0,e.jsxs)(ve,{children:[(0,e.jsxs)(h,{value:"rewards",className:"gap-1.5",children:[(0,e.jsx)(A,{className:"h-4 w-4"}),"Levels & Rewards"]}),(0,e.jsxs)(h,{value:"achievements",className:"gap-1.5",children:[(0,e.jsx)(ee,{className:"h-4 w-4"}),"Achievements"]}),(0,e.jsxs)(h,{value:"leaderboard",className:"gap-1.5",children:[(0,e.jsx)(S,{className:"h-4 w-4"}),"Leaderboard"]}),(0,e.jsxs)(h,{value:"xp-history",className:"gap-1.5",children:[(0,e.jsx)(P,{className:"h-4 w-4"}),"XP History"]})]}),(0,e.jsxs)(j,{value:"achievements",className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)(je,{value:u,onValueChange:E,children:[(0,e.jsx)(he,{className:"w-48",children:(0,e.jsx)(xe,{placeholder:"All Categories"})}),(0,e.jsxs)(pe,{children:[(0,e.jsx)(D,{value:"all",children:"All Categories"}),B.map(s=>(0,e.jsx)(D,{value:s.key,children:s.label},s.key))]})]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[i.length," earned · ",o.length," remaining"]})]}),i.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("h3",{className:"mb-3 flex items-center gap-2 text-sm font-semibold",children:[(0,e.jsx)(b,{className:"h-4 w-4 text-primary"}),"Earned (",i.length,")"]}),(0,e.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:i.map(s=>(0,e.jsx)(k,{name:s.name,description:s.description,icon:s.icon,tier:s.tier,tierLabel:s.tier_label,tierColor:s.tier_color,trophyUrl:s.trophy_url,earned:!0,earnedAt:s.earned_at,xpReward:s.xp_reward},s.id))})]}),o.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("h3",{className:"mb-3 text-sm font-semibold",children:["Locked (",o.length,")"]}),(0,e.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:o.map(s=>(0,e.jsx)(k,{name:s.name,description:s.description,icon:s.icon,tier:s.tier,tierLabel:s.tier_label,tierColor:s.tier_color,progress:s.progress,target:s.target,progressPercent:s.progress_percent,xpReward:s.xp_reward},s.id))})]}),N.length===0&&(0,e.jsx)(m,{illustration:"empty-search",title:"No achievements here yet",description:"No achievements in this category yet",variant:"dashed"})]}),(0,e.jsx)(j,{value:"rewards",children:a?(0,e.jsx)(we,{rewards:a,levelData:t}):(0,e.jsx)(m,{illustration:"empty-default",title:"Rewards unavailable",description:"Your reward ladder will appear here once your profile is set up."})}),(0,e.jsx)(j,{value:"leaderboard",children:(0,e.jsxs)(d,{className:"gap-0 overflow-hidden py-0",children:[(0,e.jsx)(R,{className:"py-5",children:(0,e.jsxs)(I,{className:"flex items-center gap-2",children:[(0,e.jsx)(S,{className:"h-5 w-5 text-muted-foreground"}),"XP Leaderboard"]})}),(0,e.jsx)(c,{className:"p-0",children:w.length===0?(0,e.jsx)(m,{illustration:"empty-default",title:"No leaderboard data yet",description:"XP standings will appear here as your team earns points"}):(0,e.jsxs)(ge,{children:[(0,e.jsx)(ue,{className:"bg-muted/30",children:(0,e.jsxs)(H,{children:[(0,e.jsx)(x,{className:"w-12",children:"#"}),(0,e.jsx)(x,{children:"Employee"}),(0,e.jsx)(x,{className:"text-right",children:"Level"}),(0,e.jsx)(x,{className:"text-right",children:"XP"})]})}),(0,e.jsx)(fe,{children:w.map((s,r)=>(0,e.jsxs)(H,{children:[(0,e.jsx)(p,{className:"font-medium",children:r===0?(0,e.jsx)("span",{className:"text-lg",children:"🥇"}):r===1?(0,e.jsx)("span",{className:"text-lg",children:"🥈"}):r===2?(0,e.jsx)("span",{className:"text-lg",children:"🥉"}):r+1}),(0,e.jsx)(p,{children:(0,e.jsxs)($,{href:`/employees/${s.id}`,className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(le,{ring:s.ring,
1size:"sm",children:(0,e.jsxs)(me,{className:"h-8 w-8",children:[(0,e.jsx)(de,{src:s.avatar}),(0,e.jsx)(ce,{className:"bg-primary/10 text-xs text-primary",children:F(s.name)})]})}),s.level>1&&(0,e.jsx)("div",{className:"absolute -right-1 -bottom-1",children:(0,e.jsx)(n,{level:s.level,levelData:s.level_data,size:"sm",showTooltip:!1})})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("p",{className:"font-medium",children:s.name}),s.title_flair&&(0,e.jsx)(X,{title:s.title_flair.title,color:s.title_flair.color,icon:!1})]}),s.job_title&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s.job_title})]})]})}),(0,e.jsx)(p,{className:"text-right",children:(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)(n,{level:s.level,levelData:s.level_data,size:"md"})})}),(0,e.jsxs)(p,{className:"text-right font-medium",children:[s.total_xp.toLocaleString()," ","XP"]})]},s.id))})]})})]})}),(0,e.jsx)(j,{value:"xp-history",children:(0,e.jsxs)(d,{children:[(0,e.jsx)(R,{children:(0,e.jsxs)(I,{className:"flex items-center gap-2",children:[(0,e.jsx)(K,{className:"h-5 w-5 text-muted-foreground"}),"Recent XP Activity"]})}),(0,e.jsx)(c,{children:y.length===0?(0,e.jsx)(m,{illustration:"empty-default",title:"No XP activity yet",description:"Earn XP by completing actions across the app"}):(0,e.jsx)("div",{className:"flex flex-col",children:y.map(s=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3.5 border-b border-border py-3 first:pt-0 last:border-b-0 last:pb-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-green-500/10",children:(0,e.jsx)(P,{className:"h-4 w-4 text-green-600 dark:text-green-400"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:s.reason}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleDateString("en-ZA",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),(0,e.jsxs)(re,{variant:"secondary",className:"text-green-600 dark:text-green-400",children:["+",s.xp_amount," XP"]})]},s.id))})})]})})]})]}),(0,e.jsx)(ye,{open:q,onClose:()=>T(!1)})]})}export{rs 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.