1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9970],{97207:function(e,r,n){var s=n(85893),t=(n(67294),n(80471));r.Z=function(e){var r=e.children,n=e.classes,a=e.isSubmitting;return(0,s.jsx)("button",{className:"".concat(n," button"),disabled:a,type:"submit",children:a?(0,s.jsx)(t.frZ,{size:"1.2em",className:"animate animate-spin mx-auto"}):r})}},46014:function(e,r,n){var s=n(34051),t=n.n(s),a=n(85893),i=n(67294),c=n(82175),o=n(43977),l=n(97207),u=n(74231),d=n(40611),m=n(74931),h=n(11163),x=n(41664);function p(e,r,n,s,t,a,i){try{var c=e[a](i),o=c.value}catch(l){return void n(l)}c.done?r(o):Promise.resolve(o).then(s,t)}function f(e){return function(){var r=this,n=arguments;return new Promise((function(s,t){var a=e.apply(r,n);function i(e){p(a,s,t,i,c,"next",e)}function c(e){p(a,s,t,i,c,"throw",e)}i(void 0)}))}}function j(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function b(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},s=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),s.forEach((function(r){j(e,r,n[r])}))}return e}var v=u.Ry().shape({question:u.Z_().min(20,"Minimum of 20 characters").max(1e3,"Maximum of 1000 characters").required("Question is required"),name:u.Z_().min(3,"Minimum of 3 characters").max(64,"Maximum of 64 characters").required("Your name is required"),email:u.Z_().email("Please enter a valid email").required("Email is required"),agree:u.O7().oneOf([!0],"Please accept our terms and conditions").required("Please accept our terms and conditions")}),g=u.Ry().shape({code:u.Z_().required("Verification code is required")});r.Z=function(){var e=(0,i.useState)(null),r=e[0],n=e[1],s=(0,i.useState)(null),u=s[0],p=s[1],j=(0,h.useRouter)();return(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(c.J9,{initialValues:{question:"",name:"",email:"",agree:!1},validationSchema:v,onSubmit:function(){var e=f(t().mark((function e(r,s){var a,i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.setSubmitting,a=Math.random().toString(36).substring(2,12),e.prev=2,i={to:r.email,subject:"Your verification code",body:"<p>Here is your verification code for naijabarrister: <strong>".concat(a,"</strong></p>\n <p>Copy and paste it on your form to submit your form</p>")},e.next=6,d.Z.post("/api/emails/",i,{headers:{authorization:"Bearer ".concat("nMDnCfHu2yIVLYKyrhMwFmSReUmuCUu8")}});case 6:e.sent,p(r),n(a),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(2),m.ZP.error("An error occurred, please try again.");case 14:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(r,n){return e.apply(this,arguments)}}(),children:function(e){var r=e.errors,n=e.touched,s=e.isSubmitting;return(0,a.jsxs)(c.l0,{children:[(0,a.jsx)("label",{htmlFor:"",className:"font-bold",children:"Your question"}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)(c.gN,{name:"question",as:"textarea",placeholder:"e.g How do i register a business in Nigeria",rows:4,className:"".concat(r.question&&n.question?"has-error":""," input")}),(0,a.jsx)(c.Bc,{component:o.Z,name:"question"})]}),(0,a.jsx)("label",{htmlFor:"",className:"font-bold",children:"Personal information"}),(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Your name and email won't be displayed publicly"}),(0,a.jsxs)("div",{className:"md:grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)(c.gN,{name:"name",className:"".concat(r.name&&n.name?"has-error":""," input"),placeholder:"e.g Chuka Sule (Optional)"}),(0,a.jsx)(c.Bc,{component:o.Z,name:"name"})]}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)(c.gN,{name:"email",className:"".concat(r.email&&n.email?"has-error":""," input"),placeholder:"e.g [email protected]"}),(0,a.jsx)(c.Bc,{component:o.Z,name:"email"})]})]}),(0,a.jsxs)("div",{className:"md:grid grid-cols-2 gap-4 items-center",children:[(0,a.jsxs)("div",{className:"field",children:[(0,a.jsxs)("label",{className:"cursor-pointer",children:[(0,a.jsx)(c.gN,{name:"agree",type:"checkbox"})," ",(0,a.jsxs)("span",{children:["I agree to your"," ",(0,a.jsx)(x.default,{href:"/terms",children:(0,a.jsx)("a",{target:"_blank",rel:"noreferrer",children:"Terms and Condition"})})]})]}),(0,a.jsx)(c.Bc,{component:o.Z,name:"agree"})]}),(0,a.jsx)("div",{className:"field justify-self-end",children:(0,a.jsx)(l.Z,{type:"submit",isSubmitting:s,
1classes:"primary font-bold mr-2",children:"Submit question"})})]})]})}}),u&&r&&(0,a.jsxs)("div",{className:"absolute inset-0 bg-white",children:[(0,a.jsxs)("h2",{className:"text-3xl font-black mb-3",children:["Verify your ",(0,a.jsx)("span",{className:"under-line",children:"email"})]}),(0,a.jsxs)("p",{className:"text-lg text-slate-700",children:["We have sent a verification code to your email"," ",(0,a.jsx)("span",{className:"font-bold",children:u.email}),". Please copy and paste the code below to verify your email and submit your question."]}),(0,a.jsx)(c.J9,{initialValues:{code:""},validationSchema:g,onSubmit:function(){var e=f(t().mark((function e(n,s){var a,i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s.setSubmitting,n.code===r){e.next=4;break}return m.ZP.error("Invalid verification code"),e.abrupt("return");case 4:return(a=b({},u)).verifyCode=n.code,a.isVerified=!0,e.prev=7,e.next=10,d.Z.post("/api/questions/",a);case 10:201===(i=e.sent).status&&j.push("/questions/".concat(i.data.slug,"?is_new=true")),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),m.ZP.error("An error occurred, please try again");case 17:case"end":return e.stop()}}),e,null,[[7,14]])})));return function(r,n){return e.apply(this,arguments)}}(),children:function(e){e.errors;return(0,a.jsxs)(c.l0,{children:[(0,a.jsxs)("div",{className:"flex items-center border border-slate-200 rounded-md p-2",children:[(0,a.jsx)("div",{className:"grow",children:(0,a.jsx)(c.gN,{name:"code",placeholder:"Enter verification code",className:"text-lg pl-4 w-full outline-none"})}),(0,a.jsx)("div",{children:(0,a.jsx)(l.Z,{type:"submit",classes:"primary",children:"Verify"})})]}),(0,a.jsx)(c.Bc,{name:"code",component:o.Z})]})}})]})]})}},3569:function(e,r,n){var s=n(34051),t=n.n(s),a=n(85893),i=(n(67294),n(40611)),c=n(80471),o=n(62030),l=n(86893),u=n(47516),d=n(41664),m=n(11163),h=n(89583),x=n(86492),p=n.n(x),f=n(88767),j=n(74931);function b(e,r,n,s,t,a,i){try{var c=e[a](i),o=c.value}catch(l){return void n(l)}c.done?r(o):Promise.resolve(o).then(s,t)}r.Z=function(){var e,r=(0,m.useRouter)(),n=(0,f.useQuery)(["questions"],(e=t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.Z.get("/api/questions/",{params:{isVerified:!0,limit:15,search:r.query.search?r.query.search:""}}).then((function(e){return e.data})).catch((function(e){console.log(e),j.ZP.error("Error loading recent questions")}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})),function(){var r=this,n=arguments;return new Promise((function(s,t){var a=e.apply(r,n);function i(e){b(a,s,t,i,c,"next",e)}function c(e){b(a,s,t,i,c,"throw",e)}i(void 0)}))}),{enabled:r.isReady}),s=n.data;return n.isLoading?(0,a.jsxs)("div",{children:[(0,a.jsx)(c.frZ,{className:"text-lg animate animate-spin mx-auto",size:"2em"}),(0,a.jsx)("span",{className:"block text-center uppercase text-sm mt-3",children:"Loading recent questions"})]}):(0,a.jsxs)(a.Fragment,{children:[r.query.search?(0,a.jsx)("div",{className:"my-3 text-2xl",children:(0,a.jsxs)("h4",{children:["Search results for: ",r.query.search]})}):null,s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("form",{method:"get",children:(0,a.jsxs)("div",{className:"flex items-center justify-center bg-white rounded-lg p-1 border-2 border-gray-300",children:[(0,a.jsx)("input",{type:"search",name:"search",placeholder:"Search questions...",className:"p-2 grow appearance-none bg-transparent outline-none text-gray-800",defaultValue:r.query.search?r.query.search:""}),(0,a.jsx)("button",{type:"submit",className:"px-3 text-gray-800",children:(0,a.jsx)(h.U41,{size:"1.25em"})})]})}),s&&s.data.length>0?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("h4",{className:"font-black text-xl mt-8",children:"Recent questions"}),s.data.map((function(e){return(0,a.jsxs)("div",{className:"p-4 bg-white rounded-md drop-shadow-sm hover:drop-shadow-lg border border-slate-200 hover:scale-105 transition-all duration-300",children:[(0,a.jsxs)("span",{className:"text-slate-500",children:["Asked"," ",(0,o.Z)(new Date(e.createdAt),{addSuffix:!0})]}),(0,a.jsx)("p",{children:(0,a.jsx)(d.default,{href:"/questions/".concat(e.slug),children:(0,a.jsx)("a",{className:"hover:text-slate-800 hover:no-underline text-slate-900",children:p().decode(e.question)})})}),(0,a.jsxs)("ul",{className:"mt-3 pt-3 border-t border-slate-200 flex space-x-4",children:[(0,a.jsx)("li",{className:"",children:(0,a.jsx)(d.default,{href:"/questions/".concat(e.slug),children:(0,a.jsxs)("a",{className:"hover:text-blue-700 hover:no-underline text-blue-900 inline-flex items-center space-x-2",children:[(0,a.jsx)(u.rKo,{}),(0,a.jsxs)("span",{children:[e.responses.length," Response",e.responses.length>
11?"s":""]})]})})}),(0,a.jsx)("li",{children:(0,a.jsx)(d.default,{href:"/questions/".concat(e.slug),children:(0,a.jsxs)("a",{className:"hover:text-blue-700 hover:no-underline text-blue-900 inline-flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"View"}),(0,a.jsx)(l.AlO,{})]})})}),(0,a.jsx)("li",{})]})]},e.id)}))]}):(0,a.jsx)("div",{className:"p-4 rounded-md bg-red-50 border border-red-200 text-red-600 my-4",children:"No questions found"})]}):null]})}},43977:function(e,r,n){var s=n(85893);n(67294);r.Z=function(e){var r=e.children;return(0,s.jsx)("div",{className:"text-sm text-red-500 my-1",children:r})}}}]);
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.