1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5091],{56704:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/articles",function(){return r(14826)}])},38171:function(e,t,r){"use strict";var n=r(34051),a=r.n(n),s=r(85893),i=r(11510),c=r(25675),l=r(41664),o=(r(67294),r(40611)),u=r(88767),d=r(80471),x=r(89583),h=r(74931);function m(e,t,r,n,a,s,i){try{var c=e[s](i),l=c.value}catch(o){return void r(o)}c.done?t(l):Promise.resolve(l).then(n,a)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var s=e.apply(t,r);function i(e){m(s,n,a,i,c,"next",e)}function c(e){m(s,n,a,i,c,"throw",e)}i(void 0)}))}}t.Z=function(e){var t,r=e.article,n=e.user,m=void 0===n?null:n,f=(0,u.useQuery)("user.".concat(r.author),p(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.Z.get("/api/users/".concat(r.author)).then((function(e){return e.data})).catch((function(e){return console.log(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))),v=f.data,g=f.isLoading,b=(0,u.useMutation)({mutationFn:p(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.Z.delete("/api/cms/articles/".concat(r.slug));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),onSuccess:function(){h.ZP.success("Article deleted successfully")}}),j=function(){var e=p(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.confirm("Are you sure you want to delete this article? This action cannot be undone")){e.next=3;break}return e.next=3,b.mutateAsync();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,s.jsxs)("div",{className:"relative pb-16 border border-slate-300 rounded-lg bg-white hover:drop-shadow-lg md:mb-0 mb-4",children:[(0,s.jsxs)("div",{className:"md:p-4 p-4",children:[(0,s.jsx)("p",{className:"text-slate-500 mb-1",children:(0,i.Z)(new Date(r.createdAt),"PPP")}),(0,s.jsx)(l.default,{href:"/articles/".concat(r.slug),children:(0,s.jsxs)("a",{className:"hover:no-underline",target:"_blank",rel:"noreferrer",children:[(0,s.jsx)("h2",{className:"font-bold text-2xl mb-2 text-slate-800",children:r.title}),(0,s.jsx)("p",{dangerouslySetInnerHTML:{__html:(t=r.description,t?t.replace(/(<([^>]+)>)/gi,"").slice(0,128)+"...":"")},className:"text-slate-600"})]})})]}),g?(0,s.jsx)("div",{className:"absolute bottom-0 left-0 right-0 border-t border-slate-300 px-4 py-2",children:(0,s.jsx)(d.frZ,{className:"animate-spin"})}):(0,s.jsx)(s.Fragment,{children:v&&(0,s.jsxs)("div",{className:"absolute flex justify-between items-center bottom-0 left-0 right-0 border-t border-slate-300 px-4 py-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{href:"/".concat(v.username),children:(0,s.jsxs)("a",{target:"_blank",className:"inline-flex items-center space-x-2 text-slate-800",rel:"noreferrer",children:[(0,s.jsx)("span",{className:" top-1 relative",children:(0,s.jsx)(c.default,{src:v.avatar||"/images/avatar.png",alt:v.fullName,width:30,height:30,className:"object-cover rounded-full"})}),(0,s.jsx)("span",{children:v.fullName})]})})}),m&&"admin"===m.role?(0,s.jsx)("div",{children:(0,s.jsx)("button",{onClick:j,className:"text-red-600 hover:text-red-500",children:(0,s.jsx)(x.AMf,{})})}):null]})})]})}},24205:function(e,t,r){"use strict";var n=r(34051),a=r.n(n),s=r(85893),i=(r(41664),r(67294),r(40611)),c=r(38171),l=r(88362),o=r(88767),u=r(80471);function d(e,t,r,n,a,s,i){try{var c=e[s](i),l=c.value}catch(o){return void r(o)}c.done?t(l):Promise.resolve(l).then(n,a)}t.Z=function(e){e.title;var t=e.query,r=e.user,n=void 0===r?null:r,x=(0,o.useInfiniteQuery)("articles",{queryFn:function(){var e,r=(e=a().mark((function e(r){var n,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.pageParam,s=void 0===n?1:n,e.next=3,i.Z.get("/api/cms/articles/",{params:{limit:12,page:s,search:t||null}}).then((function(e){return e.data})).catch((function(e){console.log(e)}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,a){var s=e.apply(t,r);function i(e){d(s,n,a,i,c,"next",e)}function c(e){d(s,n,a,i,c,"throw",e)}i(void 0)}))});return function(e){return r.apply(this,arguments)}}(),getNextPageParam:function(e,t){var r;return(null===e||void 0===e||null===(r=e.next)||void 0===r?void 0:r.page)||void 0}}),h=x.data,m=x.isLoading,p=x.hasNextPage,f=x.isFetchingNextPage,v=x.fetchNextPage;return m?(0,s.jsx)(l.Z,{}):(0,s.jsxs)("div",{children:[t&&(0,s.jsxs)("h1",{className:"mb-4 text-xl",children:["Search results for: ",t]}),h&&h.pages.length>0?(0,s.jsxs)("div",{children:[h.pages.map((function(e,t){return(0,s.jsx)("div",{className:"md:grid grid-cols-3 gap-8 mb-8",children:e.data.map((function(e){return(0,s.jsx)(c.Z,{article:e,user:n},e.id)}))},"page_".concat(t))})),p?(0,s.jsx)("button",{onClick:v,disabled:f,className:"button primary",children:f?(0,s.jsxs)("span",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{children:"Loading "}),(0,s.jsx)(u.frZ,{className:"animate-spin relative top-0.5"})]}):(0,s.jsx)("span",{children:"Load more"})}):null]}):(0,s.jsx)("div",{children:t?(0,s.jsx)("div",{className:"p-4 rounded-md text-red-600 border border-red-200",children:"We couldn't find any article that matched your search query, please try a different search term"}):null})]})}},88362:function(e,t,r){"use strict";var n=r(85893),a=(r(67294),r(80471));t.Z=function(){return(0,n.jsx)("div",{className:"py-8 px-4 border border-slate-300 rounded-lg bg-white",children:(0,n.jsx)(a.frZ,{size:"1.5em",className:"animate animate-spin mx-auto"})})}},14826:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return l}});var n=r(85893),a=r(11163),s=r(89583),i=r(65357),c=r(24205);function l(){var e=(0,a.useRouter)();return(0,n.jsxs)(i.Z,{title:"Articles",description:"Discover articles written by top lawyers in Nigeria",meta:!0,children:[(0,n.jsxs)("header",{className:"md:pt-40 pb-24 bg-gray-900 px-4 text-center bg-hero bg-cover bg-no-repeat bg-top-center relative",children:[(0,n.jsx)("div",{className:"absolute bg-black bg-opacity-75 inset-0 z-10"}),(0,n.jsxs)("div",{className:"max-w-7xl mx-auto relative z-20",children:[(0,n.jsx)("h1",{className:"font-bold text-white text-6xl",children:"Articles"}),(0,n.jsx)("p",{className:"text-lg text-white",children:"Discover articles written by top lawyers in Nigeria"}),(0,n.jsx)("form",{method:"get",className:"max-w-md mx-auto",children:(0,n.jsxs)("div",{className:"flex items-center justify-center bg-white rounded-lg p-1",children:[(0,n.jsx)("input",{type:"search",name:"search",placeholder:"Search articles...",className:"p-2 grow appearance-none bg-transparent outline-none text-gray-300",defaultValue:e.query.search?e.query.search:""}),(0,n.jsx)("button",{type:"submit",className:"px-3 text-gray-800",children:(0,n.jsx)(s.U41,{})})]})})]})]}),(0,n.jsx)("div",{className:"py-16",children:(0,n.jsx)("div",{className:"mx-auto max-w-7xl",children:(0,n.jsx)(c.Z,{title:!1,query:e.query.search})})})]})}}},function(e){e.O(0,[5445,2013,9866,955,3276,2175,1510,5357,9774,2888,179],(function(){return t=56704,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.