1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6375],{29455:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/forum/unapproved",function(){return t(33452)}])},79597:function(e,n,t){"use strict";var r=t(34051),s=t.n(r),c=t(85893),i=(t(67294),t(25675)),a=t(41664),o=t(63750),u=t(11510),l=t(88767),d=t(40611),f=t(74931);function p(e,n,t,r,s,c,i){try{var a=e[c](i),o=a.value}catch(u){return void t(u)}a.done?n(o):Promise.resolve(o).then(r,s)}function m(e){return function(){var n=this,t=arguments;return new Promise((function(r,s){var c=e.apply(n,t);function i(e){p(c,r,s,i,a,"next",e)}function a(e){p(c,r,s,i,a,"throw",e)}i(void 0)}))}}n.Z=function(e){var n,t=e.topic,r=e.user,p=(0,l.useMutation)({mutationFn:function(){return d.Z.delete("/api/cms/communities/".concat(t._id,"/topics"))},onSuccess:function(){return f.ZP.success("Deleted Successfully!")}}),h=(0,l.useMutation)({mutationFn:function(){return d.Z.put("/api/cms/communities/".concat(t._id,"/topics/approve"))},onSuccess:function(){return f.ZP.success("Approved Successfully!")}}),x=function(){var e=m(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.confirm("Are you sure you want to delete this item? This action cannot be undone")){e.next=3;break}return e.next=3,p.mutateAsync();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),v=function(){var e=m(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.confirm("Are you sure you want to approve this topic? This action cannot be undone")){e.next=3;break}return e.next=3,h.mutateAsync();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.jsxs)("div",{className:"flex items-center justify-between md:p-6 p-4 bg-white even:bg-slate-100",children:[(0,c.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,c.jsx)("div",{children:(0,c.jsx)(i.default,{src:t.user.avatar||"/images/avatar.png",alt:t.user.first_name||"",width:48,height:48,className:"rounded-full object-cover"})}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"font-bold text-lg",children:(0,c.jsx)(a.default,{href:"/dashboard/forum/".concat(t.community,"/").concat(t.slug),children:(0,c.jsx)("a",{className:"text-slate-700",children:t.title})})}),(0,c.jsxs)("ul",{className:"md:flex items-center md:space-x-4 space-x-0 md:space-y-0 space-y-1 text-sm",children:[(0,c.jsxs)("li",{children:["By"," ",(0,c.jsx)(a.default,{href:"/".concat(t.user.username),children:(0,c.jsx)("a",{target:"_blank",rel:"noreferrer",className:"",children:(n=t.user,"".concat(n.first_name||""," ").concat(n.last_name||""))})})]}),(0,c.jsx)("li",{children:(0,u.Z)(new Date(t.createdAt),"do MMM, yyyy @h:ma")}),r&&null!==r&&(0,c.jsx)(c.Fragment,{children:"admin"===r.role||r.id===t.user.user?(0,c.jsx)("li",{children:(0,c.jsx)("button",{onClick:x,className:"font-bold text-red-500",children:"Delete"})}):null}),r&&null!==r&&(0,c.jsx)(c.Fragment,{children:"admin"!==r.role||t.isApproved?null:(0,c.jsx)("li",{children:(0,c.jsx)("button",{className:"text-blue-600 font-bold",onClick:v,children:"Approve"})})})]})]})]}),(0,c.jsxs)("div",{className:"flex items-center space-x-2 font-bold",children:[(0,c.jsx)(o.YAB,{})," ",t.responses?(0,c.jsxs)("span",{children:[t.responses.length||0," Post",t.responses.length>1?"s":""]}):(0,c.jsx)("span",{children:"0 Posts"})]})]})}},88362:function(e,n,t){"use strict";var r=t(85893),s=(t(67294),t(80471));n.Z=function(){return(0,r.jsx)("div",{className:"py-8 px-4 border border-slate-300 rounded-lg bg-white",children:(0,r.jsx)(s.frZ,{size:"1.5em",className:"animate animate-spin mx-auto"})})}},33452:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return m}});var r=t(85893),s=(t(67294),t(80575)),c=t(34051),i=t.n(c),a=t(88767),o=t(40611),u=t(88362),l=t(79597),d=t(2282);t(41664);function f(e,n,t,r,s,c,i){try{var a=e[c](i),o=a.value}catch(u){return void t(u)}a.done?n(o):Promise.resolve(o).then(r,s)}var p=function(){var e,n=(0,d.a)().user,t=(0,a.useQuery)("topics.unapproved",(e=i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.Z.get("/api/cms/communities/topics/unapproved").then((function(e){return e.data}
1)).catch((function(e){console.log(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,s){var c=e.apply(n,t);function i(e){f(c,r,s,i,a,"next",e)}function a(e){f(c,r,s,i,a,"throw",e)}i(void 0)}))}),{enabled:n&&"admin"===n.role}),s=t.data;return t.isLoading?(0,r.jsx)(u.Z,{}):(0,r.jsx)("div",{children:n&&s&&s.length>0?(0,r.jsx)("div",{className:"mt-8 space-y-4",children:s.map((function(e){return(0,r.jsx)("div",{className:"rounded-lg overflow-hidden border border-slate-300",children:(0,r.jsx)(l.Z,{topic:e,user:n})},e._id)}))}):(0,r.jsx)("div",{className:"p-4 rounded-lg bg-white",children:"Nothing found"})})};var m=function(){return(0,r.jsx)(s.Z,{title:"Unapproved Topics",subTitle:"Manage yet to be approved topics",isAdmin:!0,children:(0,r.jsx)("div",{className:"my-6",children:(0,r.jsx)(p,{})})})}}},function(e){e.O(0,[5445,2013,9866,955,3874,4617,3276,6653,1510,575,9774,2888,179],(function(){return n=29455,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
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.