1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[987],{37184:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/community/monthly-challenge/create-challenge",function(){return t(52303)}])},27936:function(n,e,t){"use strict";var r=t(82729),i=t(85893),a=t(19521);function _templateObject(){let n=(0,r._)(["\n position: absolute;\n width: 30vw;\n height: 0px;\n z-index: 10;\n overflow: hidden;\n\n h1,\n p {\n height: 10rem;\n }\n"]);return _templateObject=function(){return n},n}let o=a.default.main.withConfig({componentId:"sc-e8309d9d-0"})(_templateObject());e.Z=function(n){let{h1:e,description:t="",canonical:r=""}=n;return e?(0,i.jsxs)(o,{children:[(0,i.jsx)("h1",{children:e}),t?(0,i.jsx)("p",{className:"description",children:t}):null,r?(0,i.jsx)("link",{rel:"canonical",href:r}):null]}):null}},34909:function(n,e,t){"use strict";var r=t(85893),i=t(41664),a=t.n(i),o=t(11163);e.Z=function(){let n=(0,o.useRouter)();return(0,r.jsxs)("div",{className:"btn-container",children:[(0,r.jsx)(a(),{href:"/admin/community",legacyBehavior:!0,children:(0,r.jsx)("button",{className:"nes-pointer",children:(0,r.jsx)("p",{children:"All Reports"})})}),(0,r.jsx)("input",{type:"search",placeholder:"Search user",onKeyDown:e=>{if("Enter"===e.key){var t;t=e.target.value,n.push("/admin/community/profile/@".concat(t))}}}),(0,r.jsx)("input",{type:"search",placeholder:"Paste post link",onKeyDown:e=>{"Enter"===e.key&&function(e){let t=e.includes("://")?new URL(e).pathname:e,r=t.split("/").filter(Boolean);if("admin"===r[0]&&"community"===r[1]&&"post"===r[2]&&r[3]){n.push(t);return}let i=r.indexOf("community");if(-1===i)return;let a="general"===r[i+1]?"main":r[i+1],o="monthly-challenge"===r[i+1]&&"submission"===r[i+2]?r[i+3]:r[i+2];a&&"post"!==a&&o&&n.push("/admin/community/post/".concat(o,"?communityName=").concat(a))}(e.target.value)}}),(0,r.jsx)(a(),{href:"/admin/community/monthly-challenge",legacyBehavior:!0,children:(0,r.jsx)("button",{className:"nes-pointer",style:{marginTop:"5rem"},children:(0,r.jsx)("p",{children:"Monthly Challenge"})})})]})}},73664:function(n,e,t){"use strict";t.d(e,{oH:function(){return getUserPostCommentsRef},x:function(){return getUserPostsRef}});var r=t(39828),i=t(92369);function getUserPostsRef(n){let{uid:e}=n,{firestore:t}=(0,i.UM)(),a=(0,r.JU)((0,r.hJ)(t,"users"),e,"community","posts");return a}function getUserPostCommentsRef(n){let{uid:e}=n,{firestore:t}=(0,i.UM)(),a=(0,r.JU)((0,r.hJ)(t,"users"),e,"community","comments");return a}},52303:function(n,e,t){"use strict";t.r(e),t.d(e,{default:function(){return create_challenge}});var r=t(82729),i=t(85893),a=t(19521),o=t(67294),s=t(11163),l=t(62069),c=t(99428),d=t(27936),m=t(9473),p=t(32512),h=t(5434),u=t(41664),g=t.n(u),f=t(12238),x=t.n(f),b=t(609),y=t(39828),j=t(92369),v=t(73664),k=t(16689);async function makeMonthlyChallenge(n,e,t,r,i){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"post",o=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,l=arguments.length>8?arguments[8]:void 0,{firestore:c}=(0,j.UM)(),d=(0,y.qs)(c);if("post"===a){if(!n||!e||!t||void 0===i)throw Error("which community, uid, title, and description are required fields.");let a=(0,v.x)({uid:e});try{let m=(0,y.hJ)(c,"community",n,"posts"),p=(0,y.JU)(m),h={ownerUid:e,title:t,content:i,createdAt:(0,y.Bt)(),parent:null,postId:p.id,communityName:n,images:[],userComments:0,userLikes:0,userReports:0,reports:[],challengeWinner:"",challengeMonth:o,challengeYear:s,challengeEndDate:l,monthlyChallenge:!0};if(r)try{let e=(0,k.cF)(),t=(0,k.iH)(e,"community/".concat(n,"/post/").concat(p.id,"/").concat(r.name));await (0,k.KV)(t,r);let i=await (0,k.Jt)(t);h.images.push({url:i})}catch(n){return console.error("Error uploading image:",n),{status:500,post:null}}d.set(p,h),d.set(a,{postIds:(0,y.vr)(p.id)},{merge:!0}),await d.commit();let u=await (0,y.QT)(p),g=u.data();return{status:200,post:g}}catch(n){return console.error(n),{status:500,post:null}}}}function _templateObject(){let n=(0,r._)(['\n border-radius: 10px;\n color: rgba(255, 255, 255, 0.87);\n margin-top: 1rem;\n position: relative;\n\n p {\n margin: 0px;\n font-family: "Work Sans", sans-serif;\n }\n\n .author {\n display: flex;
1\n align-items: center;\n gap: 1rem;\n margin-top: 2rem;\n margin-bottom: 1.5rem;\n\n img {\n width: 35px;\n height: 35px;\n border-radius: 50%;\n }\n\n p {\n font-weight: 600;\n line-height: 1;\n }\n\n .author-name {\n color: ',';\n }\n\n .username {\n color: rgba(128, 128, 128, 1);\n font-weight: 400;\n font-size: 14px;\n }\n\n .time-posted {\n color: rgba(128, 128, 128, 1);\n font-weight: 400;\n }\n }\n\n .date-selectors {\n font-family: "Work Sans", sans-serif;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n\n .time-selector {\n input,\n select {\n border-radius: 7px;\n padding: 5px;\n }\n label {\n font-weight: 500;\n margin-right: 1rem;\n }\n }\n }\n\n .post {\n .post-title {\n margin: 1rem auto;\n font-size: 21px;\n font-weight: 600;\n font-family: "Work Sans", sans-serif;\n }\n\n .post-content {\n max-height: 125px;\n overflow: hidden;\n\n p {\n font-family: "Work Sans", sans-serif;\n font-size: 17px;\n font-weight: 400;\n white-space: pre-line;\n }\n }\n\n pre {\n background-color: #1d2332 !important;\n }\n }\n\n .edit-view {\n margin-top: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n input {\n width: 100%;\n border: 2px solid\n ',";\n border-radius: 7px;\n padding: 0.7rem;\n color: ",';\n font-family: "Work Sans", sans-serif;\n background-color: ',";\n outline-width: 0;\n }\n\n .button-container {\n margin-top: 0.5rem;\n display: flex;\n justify-content: end;\n gap: 1rem;\n\n button {\n font-size: 11px;\n }\n }\n\n .text-container {\n position: relative;\n }\n .dropzone {\n width: 100%;\n color: #209cee;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 7px;\n\n p {\n margin: 0px;\n }\n\n .zone {\n margin-top: 10px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n border: 2px dashed #209cee;\n border-radius: 7px;\n }\n }\n\n .dropped-file-preview {\n position: relative;\n margin-top: 10px;\n img {\n width: 100%;\n height: auto;\n border-radius: 7px;\n }\n\n .close-btn {\n all: unset;\n position: absolute;\n right: -13px;\n top: -12px;\n font-size: 25px;\n line-height: 0.8;\n transition-duration: 0.2s;\n padding: 0.2rem;\n border-radius: 50%;\n color: ",";\n\n :hover {\n background-color: #f86463;\n border-radius: 50%;\n cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC)\n 14 0,\n pointer;\n }\n }\n }\n }\n"]);return _templateObject=function(){return n},n}let w=(0,o.lazy)(()=>Promise.all([t.e(2013),t.e(7603),t.e(286),t.e(6095),t.e(155),t.e(6207),t.e(3280),t.e(148)]).then(t.bind(t,33280))),N=a.default.div.withConfig({componentId:"sc-eb8b6a79-0"})(_templateObject(),n=>"dark"===n.theme.mode?"rgba(255, 255, 255, 0.87)":"black",n=>"dark"===n.theme.mode?"rgba(36, 76, 115, 1)":"#DADADA",n=>"dark"===n.theme.mode?"rgba(255, 255, 255, 0.87)":"black",n=>"dark"===n.theme.mode?"#0e1524":"#FFFFFF",n=>"dark"===n.theme.mode?"rgba(255, 255, 255, 0.87)":"black");var monthly_challenge_PostForm=function(){let n=(0,s.useRouter)(),e=new(x()),t=(0,m.v9)(b.f8),r=(0,m.v9)(b.zr),a=(0,m.v9)(b.I),l=localStorage.getItem("photoURL")||"",[c,d]=(0,o.useState)(""),[u,f]=(0,o.useState)(""),[y,j]=(0,o.useState)(!1),[v,k]=(0,o.useState)([]),[A,C]=(0,o.useState)(""),[_,S]=(0,o.useState)("End Date:"),U=new Date().getFullYear(),E=(0,o.useCallback)(n=>{k(n)}
1,[]),{getRootProps:z,getInputProps:F,isDragActive:M,acceptedFiles:O}=(0,p.uI)({onDrop:E,multiple:!1,accept:"image/*, .gif"});async function handleSubmit(r){r.preventDefault();let i=e.isProfane(c),a=e.isProfane(u);if(i||a){j(!0);return}try{let e=await makeMonthlyChallenge("monthly-challenge",t,c,v[0],u,"post",A,U,_);200===e.status&&n.push("/admin/community/monthly-challenge")}catch(n){console.error(n)}}function getMonthName(n){return["january","february","march","april","may","june","july","august","september","october","november","december"][n]}return(0,i.jsxs)(N,{children:[(0,i.jsxs)("div",{className:"author",children:[(0,i.jsx)(g(),{href:r,legacyBehavior:!0,children:(0,i.jsx)("img",{src:l,alt:"author image",className:"nes-pointer"})}),(0,i.jsx)(g(),{href:r,legacyBehavior:!0,children:(0,i.jsxs)("div",{className:"nes-pointer",children:[(0,i.jsx)("p",{className:"author-name",children:a}),(0,i.jsxs)("p",{className:"username",children:["@",r]})]})})]}),(0,i.jsxs)("div",{className:"date-selectors",children:[(0,i.jsxs)("div",{className:"time-selector",children:[(0,i.jsx)("label",{htmlFor:"month",children:"Challenge Month:"}),(0,i.jsxs)("select",{id:"month",value:A,onChange:n=>C(n.target.value),className:"nes-pointer",children:[(0,i.jsx)("option",{value:"",children:"Select a month"}),Array.from({length:12},(n,e)=>(0,i.jsx)("option",{value:getMonthName(e),children:getMonthName(e)},e))]})]}),(0,i.jsxs)("div",{className:"time-selector",children:[(0,i.jsx)("label",{htmlFor:"start",children:"Challenge End date:"}),(0,i.jsx)("input",{type:"date",id:"start",name:"trip-start",value:_,min:"2023-08-01",max:"2033-08-31",onChange:n=>S(n.target.value)})]})]}),(0,i.jsxs)("form",{className:"edit-view",onSubmit:n=>handleSubmit(n),children:[(0,i.jsx)("input",{value:c,onChange:n=>d(n.target.value),placeholder:"Title"}),y&&(0,i.jsx)("div",{className:"profanity-alert",children:(0,i.jsx)("p",{children:"Cod\xe9dex is a community for all ages and groups. Please be considreate when making a post and remove any profanity."})}),(0,i.jsxs)("div",{className:"text-container",children:[(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)("div",{children:"Loading..."}),children:(0,i.jsx)(w,{setPostMainContent:f,value:u})}),(0,i.jsxs)("div",{className:"dropzone nes-pointer",...z(),style:{height:0===v.length?"75px":"0px"},children:[(0,i.jsx)("input",{...F()}),M?(0,i.jsx)("p",{className:"zone",children:"Drop your image file here..."}):(0,i.jsx)("div",{children:0===v.length&&(0,i.jsxs)("p",{children:["Drag and drop image or ",(0,i.jsx)("span",{children:"Upload"})]})})]})]}),0!=v.length&&(0,i.jsxs)("div",{className:"dropped-file-preview",children:[(0,i.jsx)("button",{className:"close-btn nes-pointer",children:(0,i.jsx)(h.lTq,{onClick:()=>k([])})}),(0,i.jsx)("img",{src:URL.createObjectURL(v[0]),alt:"Dropped"})]}),(0,i.jsx)("div",{className:"button-container",children:(0,i.jsx)("button",{type:"submit",className:"nes-btn is-primary",children:"Post"})})]})]})};function CreateChallenge_templateObject(){let n=(0,r._)(["\n "," {\n min-height: calc(100vh - 4.2rem);\n\n .secondary-container {\n display: grid;\n grid-template-columns: 1fr;\n gap: 1rem;\n }\n\n .feed-container {\n padding-left: 1rem;\n padding-right: 1rem;\n .post-feed {\n display: grid;\n gap: 1rem;\n }\n }\n\n .right-sidebar {\n display: none;\n position: relative;\n\n .sticky-bar {\n position: sticky;\n top: 6rem;\n }\n }\n }\n\n "," {\n .secondary-container {\n grid-template-columns: 1fr;\n }\n\n .feed-container {\n padding-left: 1rem;\n padding-right: 1rem;\n }\n\n .right-sidebar {\n display: none;\n }\n }\n\n "," {\n .secondary-container {\n grid-template-columns: 5fr 2.25fr;\n }\n\n .feed-container {\n padding-left: 0rem;\n padding-right: 0rem;\n }\n\n .right-sidebar {\n display: flex;\n }\n }\n"]);return CreateChallenge_templateObject=function(){return n},n}let A=a.default.div.withConfig({componentId:"sc-c351c5c2-0"}
1)(CreateChallenge_templateObject(),n=>{let{theme:e}=n;return e.breakpoints.xs},n=>{let{theme:e}=n;return e.breakpoints.sm},n=>{let{theme:e}=n;return e.breakpoints.md});var CreateChallenge=function(){return(0,i.jsx)(A,{children:(0,i.jsxs)("div",{className:"secondary-container",children:[(0,i.jsx)("div",{className:"feed-container",children:(0,i.jsx)(monthly_challenge_PostForm,{})}),(0,i.jsx)("div",{className:"right-sidebar",children:(0,i.jsx)("div",{className:"sticky-bar"})})]})})},C=t(34909);function create_challenge_templateObject(){let n=(0,r._)(["\n ",' {\n margin-top: 4rem;\n display: grid;\n grid-template-columns: 1fr;\n gap: 3rem;\n padding-bottom: 3rem;\n margin-left: 0rem;\n margin-right: 0rem;\n min-height: 100vh;\n\n .discovery {\n display: none;\n position: relative;\n .sticky-bar {\n position: sticky;\n top: 6.3rem;\n }\n\n .create-post-btn {\n position: fixed;\n width: 226px;\n top: 93%;\n font-size: 12px;\n }\n\n input {\n width: 100%;\n border: 2px solid rgba(36, 76, 115, 1);\n border-radius: 7px;\n padding: 0.7rem;\n color: whitesmoke;\n font-family: "Work Sans", sans-serif;\n background-color: #0e1524;\n outline-width: 0;\n }\n }\n\n .main-container {\n margin-top: 2rem;\n\n .reported-posts-container {\n display: grid;\n gap: 1.5rem;\n }\n\n h2 {\n margin-bottom: 2rem;\n font-size: 20px;\n color: ',";\n }\n\n .dropdown-container {\n display: none !important ;\n }\n\n .stats-component {\n display: none;\n }\n }\n }\n\n "," {\n grid-template-columns: 1.3fr 5fr;\n margin-left: 1rem;\n margin-right: 1rem;\n\n .discovery {\n display: block;\n }\n }\n ",' {\n margin-left: 0rem;\n margin-right: 0rem;\n\n .sticky-bar {\n .btn-container {\n display: grid;\n gap: 1rem;\n\n button {\n background: none;\n border: none;\n outline: none;\n height: 38px;\n width: 100%;\n border-radius: 8px;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n transition-duration: 0.2s;\n position: relative;\n\n p {\n margin: 0px;\n font-family: "Work Sans", sans-serif;\n font-size: 19px;\n font-weight: 600;\n color: ',";\n }\n }\n\n button:hover {\n background: ",";\n }\n }\n }\n }\n"]);return create_challenge_templateObject=function(){return n},n}let _=a.default.div.withConfig({componentId:"sc-303f4a1d-0"})(create_challenge_templateObject(),n=>{let{theme:e}=n;return e.breakpoints.xs},n=>"dark"===n.theme.mode?"rgba(255, 255, 255, 0.87)":"black",n=>{let{theme:e}=n;return e.breakpoints.sm},n=>{let{theme:e}=n;return e.breakpoints.md},n=>"dark"===n.theme.mode?"rgba(255, 255, 255, 0.87)":"black",n=>"dark"===n.theme.mode?"rgba(237, 231, 225, 0.1)":"rgba(237, 231, 225, 0.4)");var create_challenge=function(){(0,s.useRouter)();let[n,e]=(0,o.useState)({});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Z,{}),(0,i.jsx)(d.Z,{h1:"Community"}),(0,i.jsx)(l.Z,{children:(0,i.jsxs)(_,{children:[(0,i.jsx)("div",{className:"discovery",children:(0,i.jsx)("div",{className:"sticky-bar",children:(0,i.jsx)(C.Z,{})})}),(0,i.jsxs)("div",{className:"main-container",children:[(0,i.jsx)("h2",{className:"header",children:"Community Admin:"}),(0,i.jsx)("div",{className:"reported-posts-container",children:(0,i.jsx)(CreateChallenge,{})})]})]})})]})}}},function(n){n.O(0,[1272,8700,4153,1622,9280,2512,9428,9774,2888,179],function(){return n(n.s=37184)}),_N_E=n.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.