1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8708],{65856:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/daily-challenges",function(){return n(20040)}])},20040:function(e,t,n){"use strict";n.r(t);var l=n(82729),a=n(85893),r=n(67294),c=n(11163),i=n(19521),o=n(99428),s=n(62069),u=n(73857),d=n(70933),f=n(4584);function _templateObject(){let e=(0,l._)(["\n margin-top: 80px;\n padding-bottom: 80px;\n min-height: calc(100vh - 80px);\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,l._)(['\n font-family: "PixelGridM", sans-serif;\n font-size: 32px;\n font-weight: 700;\n line-height: 1.4;\n letter-spacing: 0.03em;\n color: ',";\n margin: 0 0 48px 0;\n"]);return _templateObject1=function(){return e},e}function _templateObject2(){let e=(0,l._)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 48px;\n"]);return _templateObject2=function(){return e},e}function _templateObject3(){let e=(0,l._)(["\n display: flex;\n flex-direction: column;\n gap: 32px;\n"]);return _templateObject3=function(){return e},e}function _templateObject4(){let e=(0,l._)(["\n display: flex;\n justify-content: center;\n margin-top: 32px;\n"]);return _templateObject4=function(){return e},e}function _templateObject5(){let e=(0,l._)(['\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 300px;\n font-family: "Mulish", sans-serif;\n font-size: 16px;\n color: ',";\n"]);return _templateObject5=function(){return e},e}function _templateObject6(){let e=(0,l._)(["\n padding: 24px;\n background: ",";\n border: 2px solid ",';\n border-radius: 4px;\n font-family: "Mulish", sans-serif;\n color: ',";\n"]);return _templateObject6=function(){return e},e}let p=i.default.div.withConfig({componentId:"sc-3b824c6d-0"})(_templateObject()),h=i.default.h1.withConfig({componentId:"sc-3b824c6d-1"})(_templateObject1(),e=>{let{theme:t}=e;return t.colors.text.primary}),m=i.default.div.withConfig({componentId:"sc-3b824c6d-2"})(_templateObject2()),g=i.default.div.withConfig({componentId:"sc-3b824c6d-3"})(_templateObject3()),b=i.default.div.withConfig({componentId:"sc-3b824c6d-4"})(_templateObject4()),_=i.default.div.withConfig({componentId:"sc-3b824c6d-5"})(_templateObject5(),e=>{let{theme:t}=e;return t.colors.text.tertiary}),j=i.default.div.withConfig({componentId:"sc-3b824c6d-6"})(_templateObject6(),e=>{let{theme:t}=e;return t.colors.palette.red["100"]},e=>{let{theme:t}=e;return t.colors.palette.red["500"]},e=>{let{theme:t}=e;return t.colors.palette.red["700"]}),x=["January","February","March","April","May","June","July","August","September","October","November","December"];t.default=function(){let e=(0,c.useRouter)(),t=new Date,[n,l]=(0,r.useState)(t.getFullYear()),[i,y]=(0,r.useState)(t.getMonth()+1),[w,O]=(0,r.useState)([]),[C,S]=(0,r.useState)(!0),[N,v]=(0,r.useState)(null),[k,F]=(0,r.useState)(!1),G=(0,r.useCallback)(async()=>{S(!0),v(null);try{let e=await (0,f.xV)({year:n,month:i});O(e.challenges)}catch(e){console.error("Failed to fetch challenges:",e),v("Failed to load challenges. Please try again."),O([])}finally{S(!1)}},[n,i]);(0,r.useEffect)(()=>{G()},[G]);let handleGenerateNew=async()=>{F(!0),v(null);try{let t=new Set(w.map(e=>e.scheduledDate)),l=new Date(n,i,0).getDate(),a=null;for(let e=1;e<=l;e++){let l="".concat(n,"-").concat(String(i).padStart(2,"0"),"-").concat(String(e).padStart(2,"0"));if(!t.has(l)){a=l;break}}if(!a){v("All days in this month already have challenges scheduled."),F(!1);return}let r=await (0,f.ZS)({scheduledDate:a,difficulty:"beginner"});e.push("/admin/daily-challenges/".concat(r.challenge.id))}catch(e){console.error("Failed to generate challenge:",e),v("Failed to generate challenge. Please try again.")}finally{F(!1)}},I=x[i-1];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{}),(0,a.jsx)(s.Z,{children:(0,a.jsxs)(p,{children:[(0,a.jsx)(h,{children:"Daily Challenge Admin"}),(0,a.jsx)(m,{children:(0,a.jsx)(d.a$,{year:n,month:i,onChange:(e,t)=>
1{l(e),y(t)}})}),(0,a.jsxs)(g,{children:[N&&(0,a.jsx)(j,{children:N}),C?(0,a.jsx)(_,{children:"Loading challenges..."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.L8,{challenges:w,monthName:I,year:n,onGenerateNew:handleGenerateNew,isGenerating:k}),w.length>0&&(0,a.jsx)(b,{children:(0,a.jsx)(u.Z,{variant:"blue",onClick:handleGenerateNew,isLoading:k,children:"+ Generate New Challenge"})})]})]})]})})]})}}},function(e){e.O(0,[1272,8700,4153,1622,9280,8649,9428,5270,9774,2888,179],function(){return e(e.s=65856)}),_N_E=e.O()}]);
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.