PageSourceSearch

https://living-corporate.com/assets/achievements-DB4nzRN0.js

js living-corporate.com collected 2026-10-02 05:00:09 UTC 13,428 bytes, 1 lines download raw bytes

1import{e as D,p as B,r as k,F as K,H as O,d as A,G as E,i as G,j as e,m,af as u,aP as H,an as J,ao as Y,ap as Z,B as p,f as v,u as Q,b as V,o as C}from"./index-QiiZ-xPT.js";import{A as w}from"./AppLayout-DS32LUNS.js";import{M as I}from"./message-square-D5hWyMEX.js";import{S as M}from"./sparkles-C108-045.js";import{C as W}from"./crown-BLKBNINq.js";import{T as P}from"./trending-up-BLnfQQLk.js";import{Z as X}from"./zap-B4LiRMgm.js";import{F as L}from"./flame-DTndDNnn.js";import{S as q}from"./star-DmzWJ34G.js";import{T as d}from"./trophy-DJhYgmDN.js";import{A as R}from"./award-4N1mguI2.js";import{C as T}from"./check-KTa2Xihg.js";import{S as ee}from"./share-2-hqok4cMh.js";import{L as se,T as te}from"./twitter-BzZd48jL.js";import{F as ae}from"./facebook-oj2sjqvT.js";import{T as ie,a as ne,b as S,c as z}from"./tabs-DPcdb2bX.js";import{u as re}from"./useTranslation-XedzLvcK.js";import{L as oe}from"./lock-NaFetfNF.js";import{C as $}from"./clock-Jb0c5sRN.js";import{f as le}from"./formatDistanceToNow-Cgxttm8N.js";import"./chevron-left-BlU_Pgs7.js";import"./chevron-right-f4G5e4zR.js";import"./gift-DGFeQbUI.js";import"./log-out-CqAuLeet.js";import"./library-DGVSHwk6.js";import"./history-Db1-bwk2.js";import"./video-DCxcvy3M.js";import"./index-Bj3iuRQR.js";import"./index-BMyKsIJE.js";import"./en-US-BddybvhD.js";const ce=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]],de=D("milestone",ce),me={GraduationCap:E,BookOpen:A,Award:R,Trophy:d,Star:q,Headphones:O,FileText:K,Flame:L,Zap:X,TrendingUp:P,Crown:W,Sparkles:M,MessageSquare:I};function xe({badge:s,userBadge:t,isEarned:a=!1,onShare:r}){const{toast:b}=B(),[g,f]=k.useState(!1),N=me[s.icon]||R,x=G({mutationFn:async({platform:n})=>{if(t&&!(await fetch(`/api/gamification/badges/${t.id}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:n})})).ok)throw new Error("Failed to record share")}}),j=n=>{const h=`${window.location.origin}/achievements`,o=`I just earned the "${s.name}" badge on Learning Corporate by Living Corporate! 🏆 ${s.description} Join me on my learning journey!`,l={linkedin:{text:o,url:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(h)}`},twitter:{text:`I just earned the "${s.name}" badge on @LivingCorp! 🏆 ${s.description} #LearningCorporate #ProfessionalDevelopment`,url:`https://twitter.com/intent/tweet?text=${encodeURIComponent(`I just earned the "${s.name}" badge on @LivingCorp! 🏆 ${s.description}`)}&url=${encodeURIComponent(h)}&hashtags=LearningCorporate,ProfessionalDevelopment`},facebook:{text:`I just earned the "${s.name}" badge on Learning Corporate!`,url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(h)}&quote=${encodeURIComponent(o)}`}}[n];l&&(window.open(l.url,"_blank","width=600,height=400"),x.mutate({platform:n}),r?.(t?.id||"",n),b({title:"Shared!",description:`Your badge has been shared to ${n}.`})),f(!1)};return e.jsxs(m.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:u("relative p-4 rounded-xl border transition-all duration-300",a?"bg-gradient-to-br from-card to-card/80 border-primary/30 shadow-lg":"bg-muted/30 border-border/50 opacity-60 grayscale"),"data-testid":`badge-card-${s.slug}`,children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:u("w-16 h-16 rounded-full flex items-center justify-center mb-3",a?"bg-gradient-to-br from-primary/20 to-primary/10":"bg-muted"),children:e.jsx(N,{className:u("w-8 h-8",a?s.color:"text-muted-foreground")})}),e.jsx("h3",{className:"font-semibold text-sm mb-1",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2 line-clamp-2",children:s.description}),e.jsx(H,{children:e.jsxs(J,{children:[e.jsx(Y,{asChild:!0,children:e.jsxs("span",{className:"text-xs text-primary font-medium",children:["+",s.pointsAwarded," pts"]})}),e.jsx(Z,{children:e.jsx("p",{children:s.requirement})})]})}),a&&t&&e.jsx("div",{className:"mt-3 w-full",children:t.sharedAt?e.jsxs("div",{className:"flex items-center justify-center gap-1 text-xs text-green-500",children:[e.jsx(T,{size:12}),e.jsx("span",{children:"Shared"})]}):e.jsxs("div",{className:"relative",children:[e.jsxs(p,{variant:"outline",size:"sm",className:"w-full gap-2 text-xs",onClick:()=>f(!g),"data-testid":`share-badge-${s.slug}`,children:[e.jsx(ee,{size:14}),"Share Achievement"]}),g&&e.jsx(m.div,{initial:{opacity:0,y:-10}
1,animate:{opacity:1,y:0},className:"absolute bottom-full left-0 right-0 mb-2 p-2 bg-popover border border-border rounded-lg shadow-lg z-10",children:e.jsxs("div",{className:"flex gap-2 justify-center",children:[e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-blue-500/10 hover:text-blue-500",onClick:()=>j("linkedin"),"aria-label":"Share on LinkedIn","data-testid":"share-linkedin",children:e.jsx(se,{size:16})}),e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-sky-500/10 hover:text-sky-500",onClick:()=>j("twitter"),"aria-label":"Share on Twitter","data-testid":"share-twitter",children:e.jsx(te,{size:16})}),e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-blue-600/10 hover:text-blue-600",onClick:()=>j("facebook"),"aria-label":"Share on Facebook","data-testid":"share-facebook",children:e.jsx(ae,{size:16})})]})})]})}),a&&t?.earnedAt&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-2",children:["Earned ",new Date(t.earnedAt).toLocaleDateString()]})]}),a&&e.jsx("div",{className:"absolute -top-1 -right-1",children:e.jsx("div",{className:"w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx(T,{size:12,className:"text-white"})})})]})}function he({variant:s="compact",className:t}){const{data:a}=v({queryKey:["/api/gamification/points"]});if(!a)return null;const r=a.totalPoints%500/500*100;return s==="compact"?e.jsxs("div",{className:u("flex items-center gap-3",t),"data-testid":"points-display-compact",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(q,{size:16,className:"text-yellow-400 fill-yellow-400"}),e.jsx("span",{className:"font-medium text-sm",children:a.totalPoints})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(d,{size:16,className:"text-primary"}),e.jsxs("span",{className:"font-medium text-sm",children:["Lvl ",a.level]})]}),a.streak>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{size:16,className:"text-orange-500"}),e.jsx("span",{className:"font-medium text-sm",children:a.streak})]})]}):e.jsxs(m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:u("bg-card rounded-xl p-6 border border-border",t),"data-testid":"points-display-full",children:[e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Your Progress"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep learning to level up!"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-3xl font-bold text-primary",children:a.totalPoints}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Points"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx(d,{className:"w-6 h-6 mx-auto mb-1 text-primary"}),e.jsxs("div",{className:"text-lg font-semibold",children:["Level ",a.level]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Rank"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx(L,{className:"w-6 h-6 mx-auto mb-1 text-orange-500"}),e.jsxs("div",{className:"text-lg font-semibold",children:[a.streak," days"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx(P,{className:"w-6 h-6 mx-auto mb-1 text-green-500"}),e.jsx("div",{className:"text-lg font-semibold",children:500-a.totalPoints%500}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"To Next Level"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsxs("span",{children:["Level ",a.level]}),e.jsxs("span",{children:["Level ",a.level+1]})]}),e.jsx("div",{className:"h-3 bg-muted rounded-full overflow-hidden",children:e.jsx(m.div,{initial:{width:0},animate:{width:`${r}%`},transition:{duration:.5,ease:"easeOut"},className:"h-full bg-gradient-to-r from-primary to-primary/70 rounded-full"})}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:[Math.round(r),"% to next level"]})]})]})}const pe=(s,t)=>
1({module_complete:t("achievements.activity.moduleComplete"),article_read:t("achievements.activity.articleRead"),podcast_listen:t("achievements.activity.podcastListen"),rating_given:t("achievements.activity.ratingGiven"),streak_bonus:t("achievements.activity.streakBonus"),badge_earned:t("achievements.activity.badgeEarned"),first_login:t("achievements.activity.firstLogin")})[s]||s,ue={learning:A,engagement:I,milestone:de,special:M};function He(){const{t:s}=re(),{isAuthenticated:t,isLoading:a}=Q(),[,r]=V(),[b,g]=k.useState("badges"),{data:f,isLoading:N}=v({queryKey:["/api/gamification/badges"]}),{data:x,isLoading:j}=v({queryKey:["/api/gamification/my-badges"],enabled:t}),{data:n,isLoading:y}=v({queryKey:["/api/gamification/transactions"],enabled:t});if(k.useEffect(()=>{!a&&!t&&r("/login?redirect=/achievements")},[a,t,r]),a||N)return e.jsx(w,{children:e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(C,{className:"w-8 h-8 animate-spin text-primary"})})});if(!t)return e.jsx(w,{children:e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(oe,{size:48,className:"mx-auto text-muted-foreground mb-4"}),e.jsx("h1",{className:"text-3xl font-bold mb-4",children:s("achievements.loginRequired")}),e.jsx("p",{className:"text-muted-foreground mb-8",children:s("achievements.loginRequiredMessage")}),e.jsx(p,{onClick:()=>r("/login?redirect=/achievements"),"data-testid":"button-login",children:s("achievements.logIn")})]})})});const h=new Set(x?.map(i=>i.badge.id)||[]),o={learning:[],engagement:[],milestone:[],special:[]};return f?.forEach(i=>{o[i.category]&&o[i.category].push(i)}),e.jsx(w,{children:e.jsx("div",{className:"min-h-screen bg-background",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-8",children:e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(d,{className:"w-8 h-8 text-primary"}),e.jsx("h1",{className:"text-3xl font-bold",children:s("achievements.title")})]}),e.jsx("p",{className:"text-muted-foreground mb-8",children:s("achievements.subtitle")}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs(ie,{value:b,onValueChange:g,children:[e.jsxs(ne,{className:"mb-6",children:[e.jsxs(S,{value:"badges",className:"gap-2",children:[e.jsx(d,{size:16}),s("achievements.tabs.badges")]}),e.jsxs(S,{value:"activity",className:"gap-2",children:[e.jsx($,{size:16}),s("achievements.tabs.activity")]})]}),e.jsx(z,{value:"badges",children:Object.entries(o).map(([i,l])=>{if(l.length===0)return null;const _=ue[i]||d;return e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(_,{size:20,className:"text-primary"}),e.jsx("h2",{className:"text-lg font-semibold",children:s(`achievements.categories.${i}`)}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",x?.filter(c=>c.badge.category===i).length||0,"/",l.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(c=>{const F=x?.find(U=>U.badge.id===c.id);return e.jsx(xe,{badge:c,userBadge:F,isEarned:h.has(c.id)},c.id)})})]},i)})}),e.jsx(z,{value:"activity",children:e.jsx("div",{className:"space-y-3",children:y?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(C,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):n&&n.length>0?n.map(i=>e.jsxs(m.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"flex items-center justify-between p-4 bg-card rounded-lg border border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:pe(i.action,s)}),i.contentTitle&&e.jsx("p",{className:"text-sm text-muted-foreground",children:i.contentTitle}),e.jsx("p",{className:"text-xs text-muted-foreground",children:le(new Date(i.createdAt),{addSuffix:!0})})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"text-lg font-semibold text-green-500",children:["+",i.points]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("achievements.activity.points")})]})]},i.id)):e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx($,{size:48,className:"mx-auto mb-4 opacity-50"}),e.jsx("p",{children:s("achievements.activity.noActivity")})]})})})]})}),e.jsx("div",{children:e.jsx(he,{variant:"full",className:"sticky top-6"})})]})]})})})})}export{He 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.