PageSourceSearch

https://naijabarrister.com/_next/static/chunks/pages/dashboard/forum/[id]-7d9be2cbb6495a7b.js

js naijabarrister.com collected 2026-10-02 16:04:13 UTC 16,742 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1567],{37087:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/forum/[id]",function(){return n(68366)}])},93987:function(e,t,n){"use strict";var r=n(85893),i=(n(67294),n(80471));t.Z=function(e){var t=e.children,n=e.classes,s=e.type,a=e.isSubmitting;return(0,r.jsx)("button",{className:"".concat(n," button"),disabled:a,type:s||"button",children:a?(0,r.jsx)(i.frZ,{size:"1.2em",className:"animate animate-spin mx-auto"}):t})}},79597:function(e,t,n){"use strict";var r=n(34051),i=n.n(r),s=n(85893),a=(n(67294),n(25675)),o=n(41664),u=n(63750),c=n(11510),l=n(88767),d=n(40611),f=n(74931);function m(e,t,n,r,i,s,a){try{var o=e[s](a),u=o.value}catch(c){return void n(c)}o.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function a(e){m(s,r,i,a,o,"next",e)}function o(e){m(s,r,i,a,o,"throw",e)}a(void 0)}))}}t.Z=function(e){var t,n=e.topic,r=e.user,m=(0,l.useMutation)({mutationFn:function(){return d.Z.delete("/api/cms/communities/".concat(n._id,"/topics"))},onSuccess:function(){return f.ZP.success("Deleted Successfully!")}}),h=(0,l.useMutation)({mutationFn:function(){return d.Z.put("/api/cms/communities/".concat(n._id,"/topics/approve"))},onSuccess:function(){return f.ZP.success("Approved Successfully!")}}),b=function(){var e=p(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 item? This action cannot be undone")){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)}}(),v=function(){var e=p(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 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,s.jsxs)("div",{className:"flex items-center justify-between md:p-6 p-4 bg-white even:bg-slate-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)("div",{children:(0,s.jsx)(a.default,{src:n.user.avatar||"/images/avatar.png",alt:n.user.first_name||"",width:48,height:48,className:"rounded-full object-cover"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-bold text-lg",children:(0,s.jsx)(o.default,{href:"/dashboard/forum/".concat(n.community,"/").concat(n.slug),children:(0,s.jsx)("a",{className:"text-slate-700",children:n.title})})}),(0,s.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,s.jsxs)("li",{children:["By"," ",(0,s.jsx)(o.default,{href:"/".concat(n.user.username),children:(0,s.jsx)("a",{target:"_blank",rel:"noreferrer",className:"",children:(t=n.user,"".concat(t.first_name||""," ").concat(t.last_name||""))})})]}),(0,s.jsx)("li",{children:(0,c.Z)(new Date(n.createdAt),"do MMM, yyyy @h:ma")}),r&&null!==r&&(0,s.jsx)(s.Fragment,{children:"admin"===r.role||r.id===n.user.user?(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:b,className:"font-bold text-red-500",children:"Delete"})}):null}),r&&null!==r&&(0,s.jsx)(s.Fragment,{children:"admin"!==r.role||n.isApproved?null:(0,s.jsx)("li",{children:(0,s.jsx)("button",{className:"text-blue-600 font-bold",onClick:v,children:"Approve"})})})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 font-bold",children:[(0,s.jsx)(u.YAB,{})," ",n.responses?(0,s.jsxs)("span",{children:[n.responses.length||0," Post",n.responses.length>1?"s":""]}):(0,s.jsx)("span",{children:"0 Posts"})]})]})}},43977:function(e,t,n){"use strict";var r=n(85893);n(67294);t.Z=function(e){var t=e.children;return(0,r.jsx)("div",{className:"text-sm text-red-500 my-1",children:t})}},88362:function(e,t,n){"use strict";var r=n(85893),i=(n(67294),n(80471));t.Z=function(){return(0,r.jsx)("div",{className:"py-8 px-4 border border-slate-300 rounded-lg bg-white",children:(0,r.jsx)(i.frZ,{size:"1.5em",className:"animate animate-spin mx-auto"})})}},90638:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}
1)))),i.forEach((function(t){r(e,t,n[t])}))}return e}t.default=function(e,t){var n=s.default,r={loading:function(e){e.error,e.isLoading;return e.pastDelay,null}};a=e,u=Promise,(null!=u&&"undefined"!==typeof Symbol&&u[Symbol.hasInstance]?u[Symbol.hasInstance](a):a instanceof u)?r.loader=function(){return e}:"function"===typeof e?r.loader=e:"object"===typeof e&&(r=i({},r,e));var a,u;var c=r=i({},r,t);if(c.suspense)throw new Error("Invalid suspense option usage in next/dynamic. Read more: https://nextjs.org/docs/messages/invalid-dynamic-suspense");if(c.suspense)return n(c);r.loadableGenerated&&delete(r=i({},r,r.loadableGenerated)).loadableGenerated;if("boolean"===typeof r.ssr){if(!r.ssr)return delete r.ssr,o(n,r);delete r.ssr}return n(r)};a(n(67294));var s=a(n(14302));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return delete t.webpack,delete t.modules,e(t)}},16319:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.LoadableContext=void 0;var i=((r=n(67294))&&r.__esModule?r:{default:r}).default.createContext(null);t.LoadableContext=i},14302:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){i(e,t,n[t])}))}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,o=(a=n(67294))&&a.__esModule?a:{default:a},u=n(67161),c=n(16319);var l=[],d=[],f=!1;function m(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}var p=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._loadFn=t,this._opts=n,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}var t,n,i;return t=e,(n=[{key:"promise",value:function(){return this._res.promise}},{key:"retry",value:function(){var e=this;this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};var t=this._res,n=this._opts;if(t.loading){if("number"===typeof n.delay)if(0===n.delay)this._state.pastDelay=!0;else{var r=this;this._delay=setTimeout((function(){r._update({pastDelay:!0})}),n.delay)}if("number"===typeof n.timeout){var i=this;this._timeout=setTimeout((function(){i._update({timedOut:!0})}),n.timeout)}}this._res.promise.then((function(){e._update({}),e._clearTimeouts()})).catch((function(t){e._update({}),e._clearTimeouts()})),this._update({})}},{key:"_update",value:function(e){this._state=s({},this._state,{error:this._res.error,loaded:this._res.loaded,loading:this._res.loading},e),this._callbacks.forEach((function(e){return e()}))}},{key:"_clearTimeouts",value:function(){clearTimeout(this._delay),clearTimeout(this._timeout)}},{key:"getCurrentValue",value:function(){return this._state}},{key:"subscribe",value:function(e){var t=this;return this._callbacks.add(e),function(){t._callbacks.delete(e)}}}])&&r(t.prototype,n),i&&r(t,i),e}();function h(e){return function(e,t){var n=function(){if(!i){var t=new p(e,r);i={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return i.promise()},r=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null,suspense:!1},t);r.suspense&&(r.lazy=o.default.lazy(r.loader));var i=null;if(!f&&!r.suspense){var a=r.webpack?r.webpack():r.modules;a&&d.push((function(e){var t=!0,r=!1,i=void 0;try{for(var s,o=a[Symbol.iterator]();!(t=(s=o.next()).done);t=!0){var u=s.value;if(-1!==e.indexOf(u))return n()}}catch(c){r=!0,i=c}finally{try{t||null==o.return||o.return()}finally{if(r)throw i}}}))}var l=r.suspense?function(e,t){return o.default.createElement(r.lazy,s({},e,{ref:t}))}:function(e,t){n();var s=o.default.useContext(c.LoadableContext),a=u.useSubscription(i);return o.default.useImperativeHandle(t,(function(){return{retry:i.retry}}
1),[]),s&&Array.isArray(r.modules)&&r.modules.forEach((function(e){s(e)})),o.default.useMemo((function(){return a.loading||a.error?o.default.createElement(r.loading,{isLoading:a.loading,pastDelay:a.pastDelay,timedOut:a.timedOut,error:a.error,retry:i.retry}):a.loaded?o.default.createElement(function(e){return e&&e.__esModule?e.default:e}(a.loaded),e):null}),[e,a])};return l.preload=function(){return!r.suspense&&n()},l.displayName="LoadableComponent",o.default.forwardRef(l)}(m,e)}function b(e,t){for(var n=[];e.length;){var r=e.pop();n.push(r(t))}return Promise.all(n).then((function(){if(e.length)return b(e,t)}))}h.preloadAll=function(){return new Promise((function(e,t){b(l).then(e,t)}))},h.preloadReady=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new Promise((function(t){var n=function(){return f=!0,t()};b(d,e).then(n,n)}))},window.__NEXT_PRELOADREADY=h.preloadReady;var v=h;t.default=v},68366:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return P}});var r=n(85893),i=n(67294),s=n(80575),a=n(11163),o=n(88767),u=n(40611),c=n(88362),l=n(80471),d=n(89583),f=n(34051),m=n.n(f),p=n(82175),h=n(74231),b=n(43977),v=n(93987),x=n(74931);function y(e,t,n,r,i,s,a){try{var o=e[s](a),u=o.value}catch(c){return void n(c)}o.done?t(u):Promise.resolve(u).then(r,i)}function j(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function a(e){y(s,r,i,a,o,"next",e)}function o(e){y(s,r,i,a,o,"throw",e)}a(void 0)}))}}var g=(0,n(5152).default)((function(){return Promise.all([n.e(2554),n.e(3586)]).then(n.bind(n,83586)).then((function(e){return e.default}))}),{loadableGenerated:{webpack:function(){return[83586]}},ssr:!1}),_=h.Ry().shape({title:h.Z_().required("Title is required").max(64),body:h.Z_().required("Body is required").max(512),community:h.Z_().required()});var w=function(e){var t=e.communityId,n=e.setShowForm,i=void 0===n?null:n,s=e.setShowWarning,a=(0,o.useQueryClient)(),c=(0,o.useMutation)({mutationFn:function(){var e=j(m().mark((function e(n){return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.Z.post("/api/cms/communities/".concat(t,"/topics"),n).then((function(e){return e.data})).catch((function(e){console.log(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),onSuccess:function(e){x.ZP.success("Topic created successfully."),s(!0),i(!1)},onSettled:function(){a.invalidateQueries("community.".concat(t,".topics"))}});return(0,r.jsxs)("div",{className:"p-8 bg-white border border-slate-200 rounded-lg drop-shadow-sm",children:[(0,r.jsx)("h4",{className:"title text-2xl font-black mb-0",children:"Start new topic"}),(0,r.jsx)("p",{className:"-mt-3",children:"Please note that new topics are subject to approvals from an admin."}),(0,r.jsx)("hr",{className:"mb-4"}),(0,r.jsx)(p.J9,{initialValues:{title:"",description:"",community:t},validationSchema:_,onSubmit:function(){var e=j(m().mark((function e(t){return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.mutateAsync(t);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),children:function(e){var t=e.errors,n=e.touched,i=e.isSubmitting;return(0,r.jsxs)(p.l0,{children:[(0,r.jsxs)("div",{className:"field",children:[(0,r.jsx)("label",{children:"Topic"}),(0,r.jsx)(p.gN,{name:"title",placeholder:"",className:"".concat(t.title&&n.title?"has-error":""," input")}),(0,r.jsx)(p.Bc,{name:"title",component:b.Z})]}),(0,r.jsxs)("div",{className:"field small-editor",children:[(0,r.jsx)(g,{name:"body",rows:3}),(0,r.jsx)(p.Bc,{name:"body",component:b.Z})]}),(0,r.jsx)("div",{className:"field",children:(0,r.jsx)(v.Z,{type:"submit",classes:"primary",isSubmitting:i,children:"Create Topic"})})]})}})]})},N=n(79597);var k=function(e){var t=e.topics;return(0,r.jsx)("div",{children:t&&t.length>0?(0,r.jsx)("div",{children:t.map((function(e){return(0,r.jsx)(N.Z,{topic:e},e._id)}))}):null})};var S=function(e){var t=e.communityId,n=(0,i.useState)(!1),s=n[0],a=n[1],f=(0,i.useState)(!1),m=f[0],p=f[1],h=(0,o.useQuery)("community.".concat(t,".topics"),(function(){return u.Z.get("/api/cms/communities/".concat(t,"/topics")).then((function(e){return e.data}
1)).catch((function(e){console.log(e)}))})),b=h.data,v=h.isLoading,x=(0,o.useQuery)("community.".concat(t,".count"),(function(){return u.Z.get("/api/cms/communities/".concat(t,"/topics/count")).then((function(e){return e.data})).catch((function(e){console.log(e)}))})),y=x.data,j=x.isLoading;return v?(0,r.jsx)(c.Z,{}):(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{}),(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsx)("div",{children:j?(0,r.jsx)(l.frZ,{}):(0,r.jsx)(r.Fragment,{children:y&&(0,r.jsxs)("h4",{className:"font-bold title text-xl",children:[y.count," Topic",y.count>1?"s":""]})})})}),(0,r.jsx)("button",{className:"button",onClick:function(){a(!s),p(!1)},type:"button",children:s?"Cancel":(0,r.jsxs)("span",{className:"block flex items-center space-x-2",children:[(0,r.jsx)(d.wEH,{})," ",(0,r.jsx)("span",{children:"Start a topic"})]})}),s&&(0,r.jsx)("div",{className:"my-4",children:(0,r.jsx)(w,{setShowWarning:p,communityId:t,setShowForm:a})}),m&&(0,r.jsxs)("div",{className:"md:p-6 flex items-center space-x-2 drop-shadow-md p-4 bg-white border-l-4 border-red-400 rounded-lg my-4",children:[(0,r.jsx)(d.DAO,{}),(0,r.jsx)("span",{children:"Your topic has been submitted for approval. It will become visible to the public upon approval."})]}),b&&b.length>0?(0,r.jsx)("div",{className:"my-4 border border-slate-200 rounded-lg overflow-hidden",children:(0,r.jsx)(k,{topics:b})}):(0,r.jsx)("div",{className:"bg-white mt-6 font-bold p-4 rounded-lg border border-red-200 text-red-400",children:"No discussion topics in this community. Click to start one"})]})},O=n(41664);var P=function(){var e=(0,a.useRouter)(),t=(0,o.useQuery)("community.".concat(e.query.id),(function(){return u.Z.get("/api/cms/communities/".concat(e.query.id)).then((function(e){return e.data})).catch((function(e){console.log(e)}))}),{enabled:e.isReady}),n=t.data;return t.isLoading,(0,r.jsx)(s.Z,{title:n?n.title:"Loading...",subTitle:n?n.description:"",showHeader:!1,children:n?(0,r.jsxs)("div",{children:[(0,r.jsxs)("header",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(O.default,{href:"/dashboard/forum",children:(0,r.jsxs)("a",{className:"flex items-center space-x-2 font-bold",children:[(0,r.jsx)(d.bUI,{})," ",(0,r.jsx)("span",{children:"Communities"})]})})}),(0,r.jsx)("h4",{className:"text-4xl font-black",children:n?n.title:"Loading..."}),(0,r.jsx)("p",{children:n?n.description:""})]}),(0,r.jsx)("div",{})]}),(0,r.jsx)(S,{communityId:n.id})]}):null})}},5152:function(e,t,n){e.exports=n(90638)},68217:function(e,t,n){"use strict";var r=n(96086),i=n(67294);t.useSubscription=function(e){var t=e.getCurrentValue,n=e.subscribe,s=i.useState((function(){return{getCurrentValue:t,subscribe:n,value:t()}}));e=s[0];var a=s[1];return s=e.value,e.getCurrentValue===t&&e.subscribe===n||(s=t(),a({getCurrentValue:t,subscribe:n,value:s})),i.useDebugValue(s),i.useEffect((function(){function e(){if(!i){var e=t();a((function(i){return i.getCurrentValue!==t||i.subscribe!==n||i.value===e?i:r({},i,{value:e})}))}}var i=!1,s=n(e);return e(),function(){i=!0,s()}}),[t,n]),s}},67161:function(e,t,n){"use strict";e.exports=n(68217)}},function(e){e.O(0,[5445,2013,9866,955,3874,4617,3276,2175,6653,4231,1510,575,9774,2888,179],(function(){return t=37087,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.