PageSourceSearch

https://rentgain.ai/assets/Achievements-C7gdprZa.js

js rentgain.ai collected 2026-10-05 12:27:55 UTC 12,315 bytes, 1 lines download raw bytes

1import{r as i,j as e}from"./vendor-react-BmaOEVXd.js";import{M as T}from"./MainLayout-CD8lUdKW.js";import{a as M,G as R}from"./glass-DL169LZi.js";import{C as D,ao as I,ap as $,bj as G,al as W,aq as z,bi as k,bW as O,e as U,T as A}from"./index-DaR3WIIn.js";import{L as H}from"./lock-BggU57ti.js";import{m as u}from"./vendor-motion-2QGaoAUv.js";import{u as X}from"./vendor-i18n-DFLJMoQz.js";import"./vendor-ui-DP4RxKPZ.js";import"./vendor-router-YJ1kuUK4.js";import"./vendor-query-CvUMyKt2.js";import"./vendor-firebase--9_-N0hd.js";import"./vendor-supabase-B_SzD5j0.js";const b=t=>!!(t.status==="COMPLETED"||t.status==="EARNED"||t.status==="DONE"||t.isDone||t.progressTarget>0&&t.progress>=t.progressTarget),_=["#5B5CE2","#39BFCB","#25B67A","#E262A8"],q=({achievement:t,index:s})=>{const a=b(t),l=!a&&t.progressTarget>1,o=l?Math.min(Math.max(t.progress/t.progressTarget,0),1)*100:0;return e.jsxs("div",{className:`relative flex h-full flex-col items-center rounded-[20px] px-3 pb-3.5 pt-4 text-center ${a?"earning-method-tile":"bg-white/45 dark:bg-white/[0.035] home-elev"}`,style:a?{"--tile-accent":_[s%_.length],contain:"layout paint"}:{contain:"layout paint"},children:[e.jsx("span",{className:`absolute right-2.5 top-2.5 flex h-6 w-6 items-center justify-center rounded-full ${a?"bg-[#25B67A] text-white shadow-[0_4px_10px_-4px_rgba(37,182,122,0.8)]":"bg-[#E9EDF5] text-[#8B96A9] dark:bg-white/[0.08] dark:text-[#9EA9BC]"}`,children:a?e.jsx(D,{className:"h-3.5 w-3.5",strokeWidth:3}):e.jsx(H,{className:"h-3 w-3",strokeWidth:2.4})}),e.jsx("div",{className:"flex h-[64px] w-[64px] shrink-0 items-center justify-center",children:t.icon?e.jsx("img",{src:t.icon,alt:"",width:64,height:64,loading:"lazy",decoding:"async",draggable:!1,className:`h-full w-full object-contain ${a?"drop-shadow-[0_6px_10px_rgba(20,30,60,0.18)]":"opacity-55"}`,style:a?void 0:{filter:"grayscale(1) blur(1px)",transform:"translateZ(0)"}}):e.jsx("span",{className:`text-3xl ${a?"":"opacity-50 grayscale"}`,children:"🏆"})}),e.jsx("h3",{className:`mt-2.5 line-clamp-2 w-full break-words text-[13px] font-bold leading-tight ${a?"text-[#14171F] dark:text-white":"text-[#4A5568] dark:text-[#AFB9CF]"}`,children:t.name}),t.description&&e.jsx("p",{className:"mt-1 line-clamp-2 w-full break-words text-[11px] leading-snug text-[#7B879B] dark:text-[#9EA9BC]",children:t.description}),e.jsxs("div",{className:"mt-auto w-full pt-3",children:[l&&e.jsxs("div",{className:"mb-2.5",children:[e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-white/75 dark:bg-white/[0.06]",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#6D70F1] to-[#39BFCB]",style:{width:`${o}%`}})}),e.jsxs("p",{className:"mt-1 text-[10px] font-semibold tabular-nums text-[#7B879B] dark:text-[#9EA9BC]",children:[t.progress.toLocaleString()," / ",t.progressTarget.toLocaleString()]})]}),e.jsxs("span",{className:`inline-flex rounded-full px-2.5 py-1 text-[11px] font-extrabold tabular-nums ${a?"bg-[#25B67A]/[0.12] text-[#15925E] dark:bg-[#25B67A]/15 dark:text-[#5FE0A6]":"pill-soft"}`,children:["+",t.reward," XP"]})]})]})},K=i.memo(q,(t,s)=>t.index===s.index&&t.achievement.id===s.achievement.id&&t.achievement.status===s.achievement.status&&t.achievement.progress===s.achievement.progress),E=({index:t})=>e.jsxs(u.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3,delay:t*.03},className:"flex h-[212px] animate-pulse flex-col items-center rounded-[20px] bg-white/45 px-3 pb-3.5 pt-4 dark:bg-white/[0.035] home-elev",children:[e.jsx("div",{className:"h-16 w-16 rounded-[18px] bg-white/70 dark:bg-white/[0.06]"}),e.jsx("div",{className:"mt-3 h-3 w-24 rounded-full bg-white/70 dark:bg-white/[0.06]"}),e.jsx("div",{className:"mt-2 h-2.5 w-16 rounded-full bg-white/60 dark:bg-white/[0.05]"}),e.jsx("div",{className:"mt-auto h-6 w-16 rounded-full bg-white/70 dark:bg-white/[0.06]"})]}),V=$,Y=t=>{let s;if(t.statistics){let a;t.statistics.last_played&&(typeof t.statistics.last_played=="number"?a=new Date(t.statistics.last_played*1e3):a=new Date(t.statistics.last_played)),s={bestScore:t.statistics.best_score??0,games:t.statistics.games??0,lastPlayed:a}}return{id:t.id??0,name:k(t.header,t.name??"No name"),description:k(t.description,"No description"),icon:t.icon??"",reward:t.reward??0,taskKey:t.task_key??"",isActive:t.is_active??!1,isDone:t.is_done??!1,role:t.role??"",progressTarget:t.progress_target??0,progress:t.progress??0,status:t.status??"PROGRESS",statistics:s}},Z=t=>t.map(s=>Y(s)),J=t=>({page:t?.page??0,limit:t?.limit??10,total:t?.total??0,totalPages:t?.total_pages??0}),Q=()=>{const t={"Content-Type":"application/json",Accept:"application/json",Platform:z()},s=W.getToken();return s&&(t.Authorization=`Bearer ${s}`),t},ee={viewAwards:async(t=0,s=50)=>{try{const a=new URLSearchParams({role:"RG_GAMES_ACHIEVEMENT",page:t.toString(),limit:s.toString()}),o=await(await I(`${V}${G("view_awards")}?${a}`,{method:"GET",headers:Q()})).json();return o.status==="OK"&&o.data?{achievements:Z(o.data.rows||[]),pagination:J(o.data.pagination)}:{achievements:[],pagination:{page:0,limit:s,total:0,totalPages:0}}}catch(a){return console.error("Error fetching achievements:",a),{achievements:[],pagination:{page:0,limit:s,total:0,totalPages:0}}}}};function B({label:t,value:s}){return e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-white/[0.075] px-4 py-3 backdrop-blur-sm home-elev-on-hero",children:[e.jsx("p",{className:"truncate text-[11px] font-bold uppercase tracking-[0.08em] text-white/[0.68]",children:t}),e.jsx("p",{className:"mt-1 truncate text-[24px] font-semibold leading-tight tracking-[-0.03em] tabular-nums sm:text-[26px]",children:s})]})}const C="grid grid-cols-2 gap-3 sm:[grid-template-columns:repeat(auto-fill,minmax(160px,1fr))]";function pe(){const{t}=X(),[s,a]=i.useState([]),[l,o]=i.useState(null),[x,w]=i.useState(!0),[m,v]=i.useState(!1),[g,F]=i.useState(0),P=50,p=i.useCallback(async(r=0,n=!1)=>{try{n?v(!0):w(!0);const c=await ee.viewAwards(r,P);a(n?j=>[...j,...c.achievements]:c.achievements),o(c.pagination),F(r)}catch(c){console.error("Failed to load achievements:",c)}finally{w(!1),v(!1)}},[]);i.useEffect(()=>{p(0)},[p]);const d=l?g<l.totalPages-1:!1,f=i.useCallback(()=>{!m&&d&&p(g+1,!0)},[m,d,g,p]),N=i.useRef(null);i.useEffect(()=>{const r=N.current;if(!r||!d)return;const n=new IntersectionObserver(c=>{c.some(j=>j.isIntersecting)&&f()},{root:document.querySelector("[data-app-scroll-container]"),rootMargin:"0px 0px 400px 0px"});return n.observe(r),()=>n.disconnect()},[d,f]);const h=s.filter(r=>b(r)).length,L=s.reduce((r,n)=>r+(b(n)?n.reward:0),0),y=s.length>0?Math.round(h/s.length*100):0,S=!x&&s.length>0;return e.jsx(T,{children:e.jsx(M,{children:e.jsxs("div",{className:"home-dashboard-grid",children:[x?e.jsx("div",{className:"glass-card h-[220px] animate-pulse !rounded-[26px] lg:col-span-12"}):S&&e.jsxs(u.section,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.45,ease:[.22,1,.36,1]},className:"glass-hero home-hero relative isolate overflow-hidden rounded-[26px] p-5 text-white sm:p-6 lg:col-span-12",children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -right-[96px] -top-[132px] -z-10 h-[290px] w-[290px] rounded-full bg-[#6F72FF]/[0.32] blur-[58px]"}),e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -bottom-[176px] -left-[138px] -z-10 h-[330px] w-[330px] rounded-full bg-[#2AB8C6]/[0.22] blur-[58px]"}),e.jsxs("div",{className:"relative z-10 grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.15fr)] lg:items-center",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs("div",{className:"relative h-[104px] w-[104px] shrink-0 rounded-full home-elev-on-hero sm:h-[116px] sm:w-[116px]",children:[e.jsxs("svg",{viewBox:"0 0 48 48",className:"h-full w-full -rotate-90",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"rgb(255 255 255 / 0.14)",strokeWidth:"4",fill:"none"}
1),e.jsx(u.circle,{cx:"24",cy:"24",r:"20",stroke:"url(#achievementsRing)",strokeWidth:"4",fill:"none",strokeLinecap:"round",initial:{pathLength:0},animate:{pathLength:y/100},transition:{duration:1.1,delay:.15,ease:[.22,1,.36,1]}}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"achievementsRing",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:"#E1E1FF"}),e.jsx("stop",{offset:"100%",stopColor:"#76EFF1"})]})})]}),e.jsx("span",{className:"absolute inset-0 flex flex-col items-center justify-center",children:e.jsxs("span",{className:"text-[26px] font-semibold leading-none tracking-[-1px] tabular-nums sm:text-[30px]",children:[y,"%"]})})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/10 home-elev-on-hero",children:e.jsx(O,{className:"h-4 w-4 text-white/90",strokeWidth:2})}),e.jsx("span",{className:"text-sm font-semibold text-white/[0.76]",children:t("achievements.completionRate")})]}),e.jsxs("p",{className:"mt-3 text-[40px] font-semibold leading-none tracking-[-1.3px] tabular-nums sm:text-[46px]",children:[h,e.jsxs("span",{className:"text-[24px] font-medium tracking-[-0.5px] text-white/[0.6] sm:text-[28px]",children:[" / ",s.length]})]}),e.jsx("p",{className:"mt-1.5 text-sm text-white/[0.68]",children:t("achievements.completed")})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[e.jsx(B,{label:t("achievements.achievementsUnlocked"),value:h}),e.jsx(B,{label:t("achievements.remaining"),value:s.length-h}),e.jsxs("div",{className:"col-span-2 flex items-center gap-3 rounded-[18px] bg-white/[0.12] px-3.5 py-3 backdrop-blur-sm home-elev-on-hero",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-[#FFD76A] to-[#FF8A3D] shadow-[0_8px_18px_-8px_rgba(255,138,61,0.7)]",children:e.jsx(U,{className:"h-4 w-4 text-white",fill:"white"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[11px] font-bold uppercase tracking-[0.08em] text-white/[0.72]",children:t("achievements.totalXpEarned")}),e.jsxs("p",{className:"truncate text-lg font-bold tabular-nums",children:[L.toLocaleString()," XP"]})]})]})]})]})]}),e.jsx(u.section,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.45,delay:.1},className:"min-w-0 lg:col-span-12",children:e.jsxs(R,{accent:"indigo",className:"!rounded-[24px] p-4 sm:p-5",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-[12px] bg-[#F4B740]/15 text-[#CB8A00]",children:e.jsx(A,{className:"h-[18px] w-[18px]",strokeWidth:1.9})}),e.jsx("h2",{className:"text-base font-bold text-[#14171F] dark:text-white",children:t("achievements.allAchievements")})]}),l&&e.jsx("span",{className:"pill-soft rounded-full px-3 py-1.5 text-xs font-bold tabular-nums",children:t("common.showing",{current:s.length,total:l.total})})]}),x?e.jsx("div",{className:C,children:Array.from({length:12}).map((r,n)=>e.jsx(E,{index:n},n))}):s.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("span",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-[20px] bg-[#F4B740]/15 text-[#CB8A00]",children:e.jsx(A,{className:"h-8 w-8",strokeWidth:1.8})}),e.jsx("h3",{className:"text-lg font-bold text-[#14171F] dark:text-white",children:t("achievements.noAchievementsYet")}),e.jsx("p",{className:"mt-1 max-w-sm text-sm text-[#7B879B] dark:text-[#9EA9BC]",children:t("achievements.startPlayingAchievements")})]}):e.jsxs("div",{className:C,style:{contain:"layout"},children:[s.map((r,n)=>e.jsx(K,{achievement:r,index:n},r.id)),m&&Array.from({length:6}).map((r,n)=>e.jsx(E,{index:n},`loading-${n}`))]}),e.jsx("div",{ref:N,"aria-hidden":!0}),!x&&d&&!m&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{type:"button",onClick:f,className:"pill-primary rounded-full px-7 py-3 text-sm font-bold shadow-[0_10px_22px_-12px_rgba(91,92,226,0.85)] transition-transform hover:-translate-y-0.5",children:t("achievements.loadMoreAchievements")})})]})})]})})})}export{pe 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.