1import{p as u,a as j,r as f,j as e,l as w,L as l,A as n,S as y}from"./index-BFFk04XV.js";import{H as d}from"./Header-D4U5S10n.js";import{F as m}from"./Footer-CLvo1RXe.js";import{P as N}from"./PageBreadcrumbs-0_C4QbPK.js";import{S as v}from"./ShareBadgeButtons-uiT3r2RN.js";import{T as k}from"./trophy-7kMhkU-k.js";import"./index-C-xp_jBJ.js";import"./check-CZdowEkf.js";import"./index-BO_e3yrk.js";import"./badge-DA7NgHtS.js";import"./Normal_(1)_1770767936075-DWlfSefL.js";import"./arrow-left--9rVT4MG.js";import"./video-DC5x35JX.js";import"./index-Cc4Iucdk.js";import"./mail-DD4jMvTo.js";function x(r){return r===1?{emoji:"ð¥",label:"1st Place",g:"from-yellow-400 via-amber-400 to-orange-500",ring:"ring-amber-300"}:r===2?{emoji:"ð¥",label:"2nd Place",g:"from-slate-400 via-slate-300 to-gray-400",ring:"ring-slate-300"}:r===3?{emoji:"ð¥",label:"3rd Place",g:"from-orange-400 via-amber-500 to-yellow-500",ring:"ring-orange-300"}:r<=10?{emoji:"ð",label:"Top 10",g:"from-violet-500 via-fuchsia-500 to-purple-600",ring:"ring-violet-300"}:{emoji:"â",label:"Top 25",g:"from-teal-500 via-cyan-500 to-sky-500",ring:"ring-teal-300"}}function V(){const{id:r}=u(),o=parseInt(r||"0"),{data:a,isLoading:h,isError:p}=j({queryKey:["/api/badges",o],queryFn:async()=>{const c=await fetch(`/api/badges/${o}`);if(!c.ok)throw new Error("Not found");return c.json()},enabled:!!o});if(f.useEffect(()=>{a?.award&&a?.user&&(document.title=`${a.user.displayName} earned ${x(a.award.rank).label} - AI Educator Tools`)},[a]),h)return e.jsxs(e.Fragment,{children:[e.jsx(d,{}),e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx(w,{className:"w-8 h-8 animate-spin text-gray-400"})}),e.jsx(m,{})]});if(p||!a)return e.jsxs(e.Fragment,{children:[e.jsx(d,{}),e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-16 text-center",children:[e.jsx(k,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-800",children:"Badge not found"}),e.jsx("p",{className:"text-gray-500 mt-1",children:"The badge you're looking for might have been removed."}),e.jsxs(l,{href:"/community/leaderboard",className:"inline-flex items-center gap-1 mt-6 text-blue-600 hover:underline",children:["View the community leaderboard ",e.jsx(n,{size:14})]})]}),e.jsx(m,{})]});const{award:t,user:s}=a,i=x(t.rank),b=typeof window<"u"?window.location.href:`/badges/${t.id}`,g=`${s.displayName} earned the ${i.label} badge on the AI Educator Tools community leaderboard for ${t.periodLabel}! ð`;return e.jsxs(e.Fragment,{children:[e.jsx(d,{}),e.jsx("main",{className:"bg-slate-50 min-h-screen",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 py-6 sm:py-10",children:[e.jsx(N,{items:[{label:"Home",href:"/"},{label:"Community",href:"/community"},{label:"Leaderboard",href:"/community/leaderboard"},{label:"Badge"}],className:"mb-4"}),e.jsxs("div",{className:"relative overflow-hidden rounded-3xl border border-slate-200 shadow-lg bg-white",children:[e.jsx("div",{className:`absolute inset-x-0 top-0 h-44 bg-gradient-to-br ${i.g}`}),e.jsx("div",{className:"absolute inset-x-0 top-0 h-44 bg-[radial-gradient(circle_at_top_right,rgba(255,255,255,0.45),transparent_60%)]"}),e.jsxs("div",{className:"relative pt-8 pb-8 px-6 sm:px-10 text-center",children:[e.jsxs("p",{className:"inline-flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-white bg-white/20 backdrop-blur px-3 py-1 rounded-full",children:[e.jsx(y,{size:12})," AI Educator Tools community badge"]}),e.jsx("div",{className:"mt-4 mx-auto inline-flex items-center justify-center w-28 h-28 rounded-3xl bg-white shadow-xl ring-4 ring-white",children:e.jsx("span",{className:"text-6xl leading-none",children:i.emoji})}),e.jsxs("h1",{className:"mt-6 text-2xl sm:text-3xl font-bold text-slate-900","data-testid":"badge-headline",children:[s.displayName," earned ",i.label]}),e.jsxs("p",{className:"mt-1 text-slate-600",children:[t.periodLabel,e.jsxs("span",{className:"capitalize",children:[" · ",t.period,"ly leaderboard"]})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-6 text-center",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-3xl font-bold text-slate-900",children:["#",t.rank]}),e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-slate-500 font-semibold",children:"Rank"})]}),e.jsx("div",{className:"w-px h-10 bg-slate-200"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl font-bold text-slate-900",children:t.totalPoints??0}),e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-slate-500 font-semibold",children:"Points"})]}),e.jsx("div",{className:"w-px h-10 bg-slate-200"}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(l,{href:`/community/member/${s.id}`,className:"text-sm font-medium text-blue-600 hover:underline",children:"View profile"})})]}),s.profileImageUrl&&e.jsxs(l,{href:`/community/member/${s.id}`,className:"mt-5 inline-flex items-center gap-2 text-sm text-slate-600 hover:text-slate-900",children:[e.jsx("img",{src:s.profileImageUrl,alt:"",className:`w-8 h-8 rounded-full object-cover ring-2 ${i.ring}`}),"Awarded to ",s.displayName]})]}),e.jsx("div",{className:"border-t border-slate-100 bg-slate-50/60 px-6 sm:px-10 py-4",children:e.jsx(v,{shareUrl:b,shareText:g,size:"md",align:"between"})})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mt-6",children:[e.jsxs(l,{href:"/community",className:"block rounded-2xl border border-slate-200 bg-white p-5 hover:border-blue-300 hover:shadow-md transition","data-testid":"cta-join-community",children:[e.jsx("p",{className:"font-semibold text-slate-800",children:"Earn
1your own badge"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Start a thread, post a reply, or share what you're trying. Top 25 each week win a badge."}),e.jsxs("span",{className:"inline-flex items-center gap-1 mt-3 text-blue-600 text-sm font-medium",children:["Join the community ",e.jsx(n,{size:14})]})]}),e.jsxs(l,{href:"/community/leaderboard",className:"block rounded-2xl border border-slate-200 bg-white p-5 hover:border-blue-300 hover:shadow-md transition",children:[e.jsx("p",{className:"font-semibold text-slate-800",children:"See the leaderboard"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Discover this week's top contributors and how points are scored."}),e.jsxs("span",{className:"inline-flex items-center gap-1 mt-3 text-blue-600 text-sm font-medium",children:["View leaderboard ",e.jsx(n,{size:14})]})]})]})]})}),e.jsx(m,{})]})}export{V 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.