1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9060],{49861:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/update-tech-news",function(){return t(35447)}])},35447:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return update_tech_news}});var a=t(82729),i=t(85893),s=t(19521),r=t(67294),l=t(39828),c=t(92369);async function updateTechNews(e,n){try{let{firestore:t}=(0,c.UM)(),a=(0,l.JU)(t,"tech-news",e);return await (0,l.r7)(a,n),{status:200}}catch(e){return{status:200,error:e}}}var d=t(11163),o=t(47010);function _templateObject(){let e=(0,a._)(["\n border: 2px solid\n ",';\n width: 300px;\n height: fit-content;\n background-color: #1d2332;\n\n .view {\n display: flex;\n flex-direction: column;\n\n gap: 1rem;\n padding: 1rem;\n word-break: break-word;\n\n hr {\n width: 100%;\n }\n h3 {\n font-family: "Work Sans", sans-serif;\n }\n\n .image-container {\n display: flex;\n justify-content: center;\n img {\n height: 200px;\n width: 200px;\n border-radius: 7px;\n object-fit: cover;\n }\n }\n\n .btn-container {\n display: flex;\n justify-content: center;\n button {\n width: fit-content;\n font-size: 13px;\n }\n }\n\n input,\n textarea {\n font-family: "Work Sans", sans-serif;\n width: 100%;\n border-radius: 5px;\n padding: 5px;\n }\n\n label {\n font-family: "Work Sans", sans-serif;\n }\n }\n']);return _templateObject=function(){return e},e}let h=s.default.div.withConfig({componentId:"sc-f88bbb62-0"})(_templateObject(),e=>"dark"===e.theme.mode?"rgba(36, 76, 115, 1)":"#DADADA");var admin_TechNewsCard=function(e){let{news:n}=e;console.log(n);let t=(0,d.useRouter)(),[a,s]=(0,r.useState)(!1),[l,c]=(0,r.useState)({}),[u,p]=(0,r.useState)(!1),[x,m]=(0,r.useState)({imageUrl:n.imageUrl,title:n.title,date:n.date,link:n.link});function handleInputChange(e){let{name:n,value:t}=e.target;m(e=>({...e,[n]:t})),c(e=>({...e,[n]:t}))}async function handleUpdate(){p(!0);let e=await updateTechNews(n.id,l);200===e.status&&(s(!1),t.reload())}return(0,i.jsx)(h,{children:a?(0,i.jsxs)("div",{className:"view",children:[(0,i.jsx)("div",{className:"image-container",children:(0,i.jsx)("img",{src:x.imageUrl,alt:"news image"})}),(0,i.jsx)("hr",{}),(0,i.jsx)("label",{children:"Update Title:"}),(0,i.jsx)("textarea",{name:"title",value:x.title,onChange:handleInputChange}),(0,i.jsx)("hr",{}),(0,i.jsx)("label",{children:"Update Date:"}),(0,i.jsx)("input",{type:"text",name:"date",value:x.date,onChange:handleInputChange}),(0,i.jsx)("hr",{}),(0,i.jsx)("label",{children:"Update Link:"}),(0,i.jsx)("input",{type:"text",name:"link",value:x.link,onChange:handleInputChange}),(0,i.jsx)("hr",{}),(0,i.jsx)("label",{children:"Update Image:"}),(0,i.jsx)("input",{type:"text",name:"imageUrl",value:x.imageUrl,onChange:handleInputChange}),(0,i.jsxs)("div",{className:"btn-container",children:[(0,i.jsx)("button",{className:"nes-btn is-warning",onClick:()=>t.reload(),children:"Cancel"}),(0,i.jsx)("button",{className:"nes-btn is-error",onClick:()=>handleUpdate(),children:u?(0,i.jsx)(o.Z,{color:"#8C2022"}):"Save"})]})]}):(0,i.jsxs)("div",{className:"view",children:[(0,i.jsx)("div",{className:"image-container",children:(0,i.jsx)("img",{src:n.imageUrl,alt:"news image"})}),(0,i.jsx)("hr",{}),(0,i.jsx)("h3",{children:n.title}),(0,i.jsx)("hr",{}),(0,i.jsx)("h3",{children:n.date}),(0,i.jsx)("hr",{}),(0,i.jsx)("h3",{children:n.link}),(0,i.jsx)("div",{className:"btn-container",children:(0,i.jsx)("button",{className:"nes-btn is-error",onClick:()=>s(!0),children:"Edit"})})]})})},u=t(99428),p=t(62069);function update_tech_news_templateObject(){let e=(0,a._)(["\n margin-top: 7rem;\n color: ",";\n\n display: flex;\n justify-content: space-around;\n"]);return update_tech_news_templateObject=function(){return e},e}let x=s.default.div.withConfig({componentId:"sc-57a76406-0"})(update_tech_news_templateObject(),e=>e.theme.colors.text1);var update_tech_news=function(){let[e,n]=(0,r.useState)([]);async function getEvents(){let e=await fetch("/api/community/getTechNews"),t=await e.json();n(t.events)}return(0,r.useEffect)(()=>{getEvents()},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u.Z,{}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(x,{children:e.map(e=>(0,i.jsx)("div",{children:(0,i.jsx)(admin_TechNewsCard,{news:e})},e))})})]})}}},function(e){e.O(0,[1272,8700,4153,1622,9280,9428,9774,2888,179],function(){return e(e.s=49861)}),_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.