1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9954],{53895:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/questions",function(){return t(29356)}])},93996:function(e,n,t){"use strict";t.d(n,{Z:function(){return _}});var s=t(85893),r=(t(67294),t(34051)),i=t.n(r),a=t(41664),o=t(62030),c=t(27856),u=t.n(c),l=t(47516),d=t(53854),x=t(89583),f=t(88767),h=t(40611),p=t(74931);function m(e,n,t,s,r,i,a){try{var o=e[i](a),c=o.value}catch(u){return void t(u)}o.done?n(c):Promise.resolve(c).then(s,r)}function v(e){return function(){var n=this,t=arguments;return new Promise((function(s,r){var i=e.apply(n,t);function a(e){m(i,s,r,a,o,"next",e)}function o(e){m(i,s,r,a,o,"throw",e)}a(void 0)}))}}var j=function(e){var n=e.question,t=e.user,r=void 0===t?null:t,c=(0,f.useQueryClient)(),m=(0,f.useMutation)({mutationFn:v(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.Z.delete("/api/questions/".concat(n.id));case 2:case"end":return e.stop()}}),e)}))),onSuccess:v(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.invalidateQueries("questions");case 2:p.ZP.success("Question deleted successfully");case 3:case"end":return e.stop()}}),e)}))),onError:function(e){console.log(e)}}),j=function(){var e=v(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.confirm("Are you sure you want to delete this question?")){e.next=3;break}return e.next=3,m.mutateAsync();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,s.jsxs)("div",{className:"py-4 pl-6 px-4 bg-white border border-slate-300 rounded-lg relative",children:[(0,s.jsx)(x.MXt,{className:"absolute -left-4 top-6 text-3xl text-slate-400 bg-white border-4 border-slate-200 rounded-full"}),(0,s.jsx)("h4",{children:(0,s.jsx)(a.default,{href:"/dashboard/questions/".concat(n.slug),children:(0,s.jsx)("a",{className:"text-slate-800",children:(0,s.jsxs)("i",{className:"text-slate-600 text-sm",children:["Question asked"," ",(0,o.Z)(new Date(n.createdAt),{addSuffix:!0})]})})})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{dangerouslySetInnerHTML:{__html:u().sanitize(n.question)}}),(0,s.jsxs)("ul",{className:"flex items-center space-x-4",children:[(0,s.jsx)("li",{children:(0,s.jsx)(a.default,{href:"/dashboard/questions/".concat(n.slug),children:(0,s.jsxs)("a",{className:"text-blue-800 flex items-center space-x-2",children:[(0,s.jsx)(l.rKo,{})," ",(0,s.jsxs)("span",{children:[n.responses.length," Response",n.responses.length>1?"s":""]})]})})}),(0,s.jsx)("li",{children:(0,s.jsx)(a.default,{href:"/dashboard/questions/".concat(n.slug),children:(0,s.jsxs)("a",{className:"text-blue-800 flex items-center space-x-2",children:[(0,s.jsx)("span",{children:"View question"})," ",(0,s.jsx)(d.Hi9,{})]})})}),r&&"admin"===r.role?(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:j,className:"text-red-600 hover:text-red-400",children:"Delete"})}):null]})]})]})},g=t(88362),b=t(80471),N=t(2282),w=t(21190),y=t(6580);var _=function(e){var n=e.limit,t=void 0===n?5:n,r=(0,N.a)().user,i=(0,f.useInfiniteQuery)(["questions"],(function(e){var n=e.pageParam,s=void 0===n?1:n;return h.Z.get("/api/questions/",{params:{page:s,limit:t,isVerified:!0}}).then((function(e){return e.data})).catch((function(e){console.log(e)}))}),{getNextPageParam:function(e,n){return e.next.page||void 0},keepPreviousData:!0}),a=i.data,o=i.isLoading,c=i.hasNextPage,u=i.isFetchingNextPage,l=i.fetchNextPage;return o?(0,s.jsx)(g.Z,{}):(0,s.jsx)("div",{children:(0,s.jsx)(w.M,{children:a.pages&&a.pages.length>0?(0,s.jsxs)("div",{className:"space-y-4",children:[a.pages.map((function(e,n){return(0,s.jsx)("div",{className:"space-y-4",children:e.data.map((function(e){return(0,s.jsx)(y.E.div,{initial:{opacity:0}
1,exit:{opacity:0,x:-20},animate:{opacity:1},layout:!0,children:(0,s.jsx)(j,{question:e,user:r||null},e.id)},e.id)}))},"page__".concat(n+1))})),c?(0,s.jsx)("button",{onClick:l,className:"bg-white py-2 px-6 rounded-md border border-slate-300 font-bold disabled:opacity-50",disabled:u,children:u?(0,s.jsx)(b.frZ,{className:"animate-spin text-2xl"}):"Load more"}):(0,s.jsx)("div",{children:"No more questions"})]}):null})})}},88362:function(e,n,t){"use strict";var s=t(85893),r=(t(67294),t(80471));n.Z=function(){return(0,s.jsx)("div",{className:"py-8 px-4 border border-slate-300 rounded-lg bg-white",children:(0,s.jsx)(r.frZ,{size:"1.5em",className:"animate animate-spin mx-auto"})})}},29356:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return a}});var s=t(85893),r=t(80575),i=t(93996);function a(){return(0,s.jsx)(r.Z,{title:"Questions",children:(0,s.jsx)(i.Z,{limit:10})})}}},function(e){e.O(0,[5445,2013,9866,955,3874,4617,6556,3276,6653,7856,7926,8941,575,9774,2888,179],(function(){return n=53895,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.