(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[663],{8646:(e,t,s)=>{Promise.resolve().then(s.bind(s,93526))},84001:(e,t,s)=>{"use strict";s.d(t,{l:()=>l});var a=s(86689),r=s(59362);let l={getAllCompetitions:async()=>(await a.F.get("/competitions")).data,getActiveCompetitions:async()=>(await a.F.get("/competitions")).data,getCompetition:async e=>(await a.F.get("/competitions/".concat(e))).data,joinCompetition:async(e,t)=>{await a.F.post("/competitions/".concat(e,"/join"),{portfolioId:t})},getLeaderboard:async e=>(await a.F.get("/competitions/".concat(e,"/leaderboard"))).data,getUserPortfolio:async e=>{try{return(await a.F.get("/competitions/".concat(e,"/portfolio"))).data}catch(e){var t;if(e instanceof r.pe&&(null===(t=e.response)||void 0===t?void 0:t.status)===404)return null;throw e}}}},86689:(e,t,s)=>{"use strict";s.d(t,{F:()=>i});var a=s(88783),r=s(23464);let l=(0,a.$_)("production","NEXT_PUBLIC_API_URL")+"/api/v1",i=r.A.create({baseURL:l,headers:{"Content-Type":"application/json"}});i.interceptors.request.use(e=>{let t=localStorage.getItem("token");return t&&e.headers&&(e.headers.Authorization="Bearer ".concat(t)),e}),i.interceptors.response.use(e=>e,e=>{var t;return(null===(t=e.response)||void 0===t?void 0:t.status)===401&&(localStorage.removeItem("token"),window.location.href="/login"),Promise.reject(e)})},88482:(e,t,s)=>{"use strict";s.d(t,{BT:()=>n,Wu:()=>c,ZB:()=>d,Zp:()=>i,aR:()=>o});var a=s(95155),r=s(12115),l=s(53999);let i=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...r})});i.displayName="Card";let o=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...r})});o.displayName="CardHeader";let d=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",s),...r})});d.displayName="CardTitle";let n=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",s),...r})});n.displayName="CardDescription";let c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",s),...r})});c.displayName="CardContent",r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",s),...r})}).displayName="CardFooter"},93526:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(95155),r=s(12115),l=s(84001),i=s(88482),o=s(97168),d=s(35695),n=s(28184),c=s(18186),m=s(9685);function p(){let[e,t]=(0,r.useState)([]),[s,p]=(0,r.useState)(!0),x=(0,d.useRouter)();(0,r.useEffect)(()=>{u()},[]);let u=async()=>{try{let e=await l.l.getActiveCompetitions();t(e)}catch(e){console.error("Failed to load competitions:",e)}finally{p(!1)}};return s?(0,a.jsxs)("div",{className:"flex min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",children:[(0,a.jsx)(m.Bx,{}),(0,a.jsx)("main",{className:"flex-1 p-4 md:p-6 ml-0 md:ml-64",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto space-y-6",children:(0,a.jsx)("div",{className:"flex justify-center items-center h-[calc(100vh-200px)]",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500"})})})})]}):(0,a.jsxs)("div",{className:"flex min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",children:[(0,a.jsx)(m.Bx,{}),(0,a.jsx)("main",{className:"flex-1 p-4 md:p-6 ml-0 md:ml-64",children:(0,a.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 mb-6 md:mb-8",children:[(0,a.jsx)("div",{className:"p-2 bg-gradient-to-r from-purple-500 to-blue-500 rounded-lg",children:(0,a.jsx)(c.A,{className:"h-5 w-5 md:h-6 md:w-6 text-white"})}),(0,a.jsx)("h1",{className:"text-2xl md:text-3xl font-bold bg-gradient-to-r from-purple-400 to-blue-400 bg-clip-text text-transparent",children:"Active Trading Competitions"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6",children:null==e?void 0:e.map(e=>(0,a.jsxs)(i.Zp,{className:"bg-slate-900/50 border-slate-800 hover:border-purple-500/50 transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10",children:[(0,a.jsxs)(i.aR,{className:"pb-3",children:[(0,a.jsx)(i.ZB,{className:"text-white text-lg md:text-xl",children:e.name}),(0,a.jsxs)(i.BT,{className:"text-gray-400 text-sm",children:[(0,n.GP)(new Date(e.startDate),"MMM d, yyyy")," - ",(0,n.GP)(new Date(e.endDate),"MMM d, yyyy")]})]}),(0,a.jsxs)(i.Wu,{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sm text-gray-400 leading-relaxed",children:e.description}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 border border-slate-700/50",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-purple-400 mb-1",children:"Prize Pool"}),(0,a.jsxs)("p",{className:"text-lg font-bold text-white",children:["$",e.prizeMoney.toLocaleString()]})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 border border-slate-700/50",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-purple-400 mb-1",children:"Max Stocks"}),(0,a.jsx)("p",{className:"text-lg font-bold text-white",children:e.maxStocks})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-purple-400",children:"Rules:"}),(0,a.jsx)("div",{className:"bg-slate-800/30 rounded-lg p-3 border border-slate-700/30",children:(0,a.jsx)("ul",{className:"text-sm text-gray-400 space-y-1",children:e.rules.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start space-x-2",children:[(0,a.jsx)("span",{className:"text-purple-400 mt-0.5 flex-shrink-0",children:"•"}),(0,a.jsx)("span",{children:e})]},t))})})]}),(0,a.jsx)(o.$,{className:"w-full bg-gradient-to-r from-purple-500 to-blue-500 hover:from-purple-600 hover:to-blue-600 text-white font-medium transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/25",onClick:()=>x.push("/competitions/".concat(e.id)),children:"View Details"})]})]},e.id))}),(null==e?void 0:e.length)===0&&(0,a.jsx)("div",{className:"text-center py-12 md:py-16",children:(0,a.jsxs)("div",{className:"bg-slate-800/30 rounded-2xl p-8 md:p-12 border border-slate-700/50 max-w-md mx-auto",children:[(0,a.jsx)("div",{className:"w-16 h-16 bg-gradient-to-r from-purple-500/20 to-blue-500/20 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,a.jsx)(c.A,{className:"h-8 w-8 text-purple-400"})}),(0,a.jsx)("p",{className:"text-gray-400 text-base",children:"No active competitions at the moment."})]})})]})})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[49,478,362,184,685,441,684,358],()=>t(8646)),_N_E=e.O()}]);