Current Path : /home/ncdcgo/admin.ncdc.go.ug/static/js/ |
Current File : /home/ncdcgo/admin.ncdc.go.ug/static/js/6.4b2e7bef.chunk.js.map |
{"version":3,"sources":["utils/format.js","../node_modules/dayjs/dayjs.min.js","features/comments/api/getComments.js","features/comments/api/deleteComment.js","features/comments/components/DeleteComment.jsx","features/comments/components/CommentsList.jsx","features/comments/api/createComment.js","features/comments/components/CreateComment.jsx","features/comments/components/Comments.jsx","features/blog/api/getPost.js","features/blog/api/updatePost.js","features/blog/components/UpdatePost.jsx","features/blog/routes/Post.jsx","features/blog/api/createPost.js","features/blog/components/CreatePost.jsx","features/blog/api/getPosts.js","features/blog/api/deletePost.js","features/blog/components/DeletePost.jsx","features/blog/components/PostsList.jsx","features/blog/routes/Posts.jsx","features/blog/routes/index.jsx"],"names":["formatDate","date","dayjs","format","propTypes","PropTypes","string","isRequired","module","exports","t","e","n","r","i","s","u","a","o","f","h","c","d","$","l","y","M","name","weekdays","split","months","m","String","length","Array","join","g","z","utcOffset","Math","abs","floor","year","month","clone","add","ceil","p","w","D","ms","Q","toLowerCase","replace","v","_","S","args","arguments","O","locale","$L","utc","$u","x","$x","$offset","this","parse","prototype","$d","Date","NaN","test","match","substring","UTC","init","$y","getFullYear","$M","getMonth","$D","getDate","$W","getDay","$H","getHours","$m","getMinutes","$s","getSeconds","$ms","getMilliseconds","$utils","isValid","toString","isSame","startOf","endOf","isAfter","isBefore","$g","set","unix","valueOf","getTime","toDate","apply","slice","$locale","weekStart","$set","min","daysInMonth","get","Number","round","subtract","invalidDate","substr","meridiem","YY","YYYY","MM","MMM","monthsShort","MMMM","DD","dd","weekdaysMin","ddd","weekdaysShort","dddd","H","HH","hh","A","mm","ss","SSS","Z","getTimezoneOffset","diff","toJSON","toISOString","toUTCString","b","forEach","extend","$i","isDayjs","en","Ls","getComments","postId","axios","deleteComment","id","delete","DeleteComment","deleteCommentMutation","config","addNotification","useNotificationStore","useMutation","onMutate","deletedComment","queryClient","cancelQueries","previousComments","getQueryData","setQueryData","filter","comment","commentId","onError","__","context","onSuccess","invalidateQueries","type","title","mutationFn","useDeleteComment","isDone","isSuccess","icon","body","triggerButton","variant","className","confirmButton","isLoading","onClick","mutateAsync","CommentsList","user","useAuth","commentsQuery","useQuery","queryKey","queryFn","useComments","size","data","aria-label","map","index","text","policyCheck","POLICIES","createdAt","_id","value","role","createComment","post","shape","schema","CreateComment","createCommentMutation","newComment","useCreateComment","Form","startIcon","submitButton","form","disabled","onSubmit","values","formState","watch","setValue","label","error","errors","editorContent","Comments","getPost","usePost","updatePost","patch","headers","desc","category","UpdatePost","useState","image","setImage","preview","setPreview","postQuery","updatePostMutation","updatingPost","previousPost","refetchQueries","useUpdatePost","allowedRoles","ROLES","ADMIN","encType","bodyFormData","FormData","append","options","defaultValues","register","registration","subTitle","onChange","target","files","URL","createObjectURL","Post","useParams","Head","button","src","UPLOADS_API_URL","alt","createPost","CreatePost","createPostMutation","newPost","previousPosts","useCreatePost","getPosts","deletePost","DeletePost","deletePostMutation","deletedPost","useDeletePost","PostsList","postsQuery","usePosts","columns","field","Cell","entry","to","Posts","PostsRoutes","path","element"],"mappings":"gHAAA,wEAGaA,EAAa,SAACC,GAAD,OAAUC,IAAMD,GAAME,OAAO,wBAEvDH,EAAWI,UAAY,CACrBH,KAAMI,IAAUC,OAAOC,a,oBCN2CC,EAAOC,QAAmI,WAAW,aAAa,IAAIC,EAAE,IAAIC,EAAE,IAAIC,EAAE,KAAKC,EAAE,cAAcC,EAAE,SAASC,EAAE,SAASC,EAAE,OAAOC,EAAE,MAAMC,EAAE,OAAOC,EAAE,QAAQC,EAAE,UAAUC,EAAE,OAAOC,EAAE,OAAOC,EAAE,eAAeC,EAAE,6FAA6FC,EAAE,sFAAsFC,EAAE,CAACC,KAAK,KAAKC,SAAS,2DAA2DC,MAAM,KAAKC,OAAO,wFAAwFD,MAAM,MAAME,EAAE,SAASrB,EAAEC,EAAEC,GAAG,IAAIC,EAAEmB,OAAOtB,GAAG,OAAOG,GA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B,OACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOC,KAAK,GAAGC,QAAS,cAAC,EAAD,MACxB,cAAC,IAAD,CAAOD,KAAK,UAAUC,QAAS,cAAC,EAAD,MAC/B,cAAC,IAAD,CAAOD,KAAK,IAAIC,QAAS,cAAC,IAAD,CAAUJ,GAAG","file":"static/js/6.4b2e7bef.chunk.js","sourcesContent":["import { default as dayjs } from 'dayjs';\nimport PropTypes from 'prop-types';\n\nexport const formatDate = (date) => dayjs(date).format('MMMM D, YYYY h:mm A');\n\nformatDate.propTypes = {\n date: PropTypes.string.isRequired,\n};\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",f=\"month\",h=\"quarter\",c=\"year\",d=\"date\",$=\"Invalid Date\",l=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\")},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||\"\").toLowerCase().replace(/s$/,\"\")},u:function(t){return void 0===t}},D=\"en\",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if(\"string\"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else{var i=t.name;v[i]=t,r=i}return!n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate(\"s\"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g=\"set\"+(this.$u?\"UTC\":\"\");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+\"Hours\",0);case u:return l(g+\"Minutes\",1);case s:return l(g+\"Seconds\",2);case i:return l(g+\"Milliseconds\",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h=\"set\"+(this.$u?\"UTC\":\"\"),$=(n={},n[a]=h+\"Date\",n[d]=h+\"Date\",n[f]=h+\"Month\",n[c]=h+\"FullYear\",n[u]=h+\"Hours\",n[s]=h+\"Minutes\",n[i]=h+\"Seconds\",n[r]=h+\"Milliseconds\",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||\"YYYY-MM-DDTHH:mm:ssZ\",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,\"0\")},d=n.meridiem||function(t,e,n){var r=t<12?\"AM\":\"PM\";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,\"0\"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,\"0\"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,\"0\"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,\"0\"),s:String(this.$s),ss:O.s(this.$s,2,\"0\"),SSS:O.s(this.$ms,3,\"0\"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(\":\",\"\")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[[\"$ms\",r],[\"$s\",i],[\"$m\",s],[\"$H\",u],[\"$W\",a],[\"$M\",f],[\"$y\",c],[\"$D\",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));","import { axios } from '@/lib/axios';\nimport PropTypes from 'prop-types';\nimport { useQuery } from 'react-query';\n\nexport const getComments = ({ postId }) => {\n return axios.get(`/posts/${postId}/comments`);\n};\n\ngetComments.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n\nexport const useComments = ({ postId, config }) => {\n return useQuery({\n ...config,\n queryKey: ['comments', postId],\n queryFn: () => getComments({ postId }),\n });\n};\n","import { axios } from '@/lib/axios';\nimport { queryClient } from '@/lib/react-query';\nimport { useNotificationStore } from '@/stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const deleteComment = ({ postId, id }) => {\n return axios.delete(`/posts/${postId}/comments/${id}`);\n};\n\ndeleteComment.propTypes = {\n postId: PropTypes.string.isRequired,\n id: PropTypes.string.isRequired,\n};\n\nexport const useDeleteComment = ({ config, postId }) => {\n const { addNotification } = useNotificationStore();\n return useMutation({\n onMutate: async (deletedComment) => {\n await queryClient.cancelQueries(['comments', postId]);\n\n const previousComments = queryClient.getQueryData(['comments', postId]);\n\n queryClient.setQueryData(\n ['comments', postId],\n previousComments?.filter((comment) => comment.id !== deletedComment.commentId)\n );\n\n return { previousComments };\n },\n onError: (_, __, context) => {\n if (context?.previousComments) {\n queryClient.setQueryData(['comments', postId], context.previousComments);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries(['comments', postId]);\n addNotification({\n type: 'success',\n title: 'Comment Deleted',\n });\n },\n ...config,\n mutationFn: deleteComment,\n });\n};\n","import { Button, ConfirmationDialog } from '@/components/Elements';\nimport { TrashIcon } from '@heroicons/react/outline';\nimport PropTypes from 'prop-types';\n\nimport { useDeleteComment } from '../api/deleteComment';\n\nexport const DeleteComment = ({ postId, id }) => {\n const deleteCommentMutation = useDeleteComment({ postId });\n\n return (\n <ConfirmationDialog\n isDone={deleteCommentMutation.isSuccess}\n icon=\"danger\"\n title=\"Delete Comment\"\n body=\"Are you sure you want to delete this comment?\"\n triggerButton={\n <Button variant=\"danger\">\n <TrashIcon className=\"h-4 w-4\" />\n </Button>\n }\n confirmButton={\n <Button\n isLoading={deleteCommentMutation.isLoading}\n type=\"button\"\n className=\"bg-red-600\"\n onClick={async () => await deleteCommentMutation.mutateAsync({ postId: postId, id: id })}\n >\n Delete Comment\n </Button>\n }\n />\n );\n};\n\nDeleteComment.propTypes = {\n id: PropTypes.string.isRequired,\n postId: PropTypes.string.isRequired,\n};\n","import { Spinner, MDPreview } from '@/components/Elements';\nimport { useAuth } from '@/lib/auth';\nimport { POLICIES, Authorization } from '@/lib/authorization';\nimport { formatDate } from '@/utils/format';\nimport { ArchiveIcon } from '@heroicons/react/outline';\nimport PropTypes from 'prop-types';\n\nimport { useComments } from '../api/getComments';\n\nimport { DeleteComment } from './DeleteComment';\n\nexport const CommentsList = ({ postId }) => {\n const { user } = useAuth();\n const commentsQuery = useComments({ postId });\n\n if (commentsQuery.isLoading) {\n return (\n <div className=\"w-full h-48 flex justify-center items-center\">\n <Spinner size=\"lg\" />\n </div>\n );\n }\n\n if (!commentsQuery?.data?.length)\n return (\n <div\n role=\"list\"\n aria-label=\"comments\"\n className=\"bg-white text-gray-500 h-40 flex justify-center items-center flex-col\"\n >\n <ArchiveIcon className=\"h-10 w-10\" />\n <h4>No Comments Found</h4>\n </div>\n );\n\n return (\n <ul aria-label=\"comments\" className=\"flex flex-col space-y-3\">\n {commentsQuery.data.map((comment, index) => (\n <li\n aria-label={`comment-${comment.text}-${index}`}\n key={comment._id || index}\n className=\"w-full bg-white shadow-sm p-4\"\n >\n <Authorization policyCheck={POLICIES['comment:delete'](user, comment)}>\n <div className=\"flex justify-between\">\n <span className=\"text-xs font-semibold\">{formatDate(comment.createdAt)}</span>\n <DeleteComment postId={postId} id={comment._id} />\n </div>\n </Authorization>\n\n <MDPreview value={comment.text} />\n </li>\n ))}\n </ul>\n );\n};\n\nCommentsList.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n","import { axios } from '@/lib/axios';\nimport { queryClient } from '@/lib/react-query';\nimport { useNotificationStore } from '@/stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const createComment = ({ postId, data }) => {\n return axios.post(`/posts/${postId}/comments`, data);\n};\n\ncreateComment.propTypes = {\n data: PropTypes.shape({\n text: PropTypes.string.isRequired,\n }).isRequired,\n postId: PropTypes.string.isRequired,\n};\n\nexport const useCreateComment = ({ config, postId }) => {\n const { addNotification } = useNotificationStore();\n\n return useMutation({\n onMutate: async (newComment) => {\n await queryClient.cancelQueries(['comments', postId]);\n\n const previousComments = queryClient.getQueryData(['comments', postId]);\n\n queryClient.setQueryData(\n ['comments', postId],\n [...(previousComments || []), newComment.data]\n );\n\n return { previousComments };\n },\n onError: (_, __, context) => {\n if (context?.previousComments) {\n queryClient.setQueryData(['comments', postId], context.previousComments);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries(['comments', postId]);\n addNotification({\n type: 'success',\n title: 'Comment Created',\n });\n },\n ...config,\n mutationFn: createComment,\n });\n};\n","import { Button } from '@/components/Elements';\nimport { Form, FormDrawer, TextAreaField } from '@/components/Form';\nimport { PlusIcon } from '@heroicons/react/outline';\nimport PropTypes from 'prop-types';\nimport * as z from 'zod';\n\nimport { useCreateComment } from '../api/createComment';\n\nconst schema = z.object({\n text: z.string().min(1, 'Required'),\n});\n\nexport const CreateComment = ({ postId }) => {\n const createCommentMutation = useCreateComment({ postId });\n return (\n <>\n <FormDrawer\n size=\"sm\"\n isDone={createCommentMutation.isSuccess}\n triggerButton={\n <Button size=\"sm\" startIcon={<PlusIcon className=\"h-4 w-4\" />}>\n Create Comment\n </Button>\n }\n title=\"Create Comment\"\n submitButton={\n <Button\n isLoading={createCommentMutation.isLoading}\n form=\"create-comment\"\n type=\"submit\"\n size=\"sm\"\n disabled={createCommentMutation.isLoading}\n >\n Submit\n </Button>\n }\n >\n <Form\n id=\"create-comment\"\n onSubmit={async (values) => {\n await createCommentMutation.mutateAsync({\n data: {\n text: values.text,\n },\n postId,\n });\n }}\n schema={schema}\n >\n {({ formState, watch, setValue }) => (\n <TextAreaField\n label=\"Body\"\n error={formState.errors['text']}\n editorContent={watch('text')}\n setValue={setValue}\n value=\"text\"\n />\n )}\n </Form>\n </FormDrawer>\n </>\n );\n};\n\nCreateComment.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n","import PropTypes from 'prop-types';\n\nimport { CommentsList } from './CommentsList';\nimport { CreateComment } from './CreateComment';\n\nexport const Comments = ({ postId }) => {\n return (\n <div>\n <div className=\"flex justify-between items-center mb-4\">\n <h3 className=\"text-1xl font-bold\">Comments:</h3>\n <CreateComment postId={postId} />\n </div>\n <CommentsList postId={postId} />\n </div>\n );\n};\n\nComments.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n","import { axios } from '@/lib/axios';\nimport { useQuery } from 'react-query';\n\nexport const getPost = async ({ postId }) => {\n return await axios.get(`/posts/${postId}`);\n};\n\nexport const usePost = ({ postId, config }) => {\n return useQuery({\n ...config,\n queryKey: ['post', postId],\n queryFn: () => getPost({ postId }),\n });\n};\n","import { axios } from '@/lib/axios';\nimport { queryClient } from '@/lib/react-query';\nimport { useNotificationStore } from '@/stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const updatePost = ({ data, postId }) => {\n return axios.patch(`/posts/${postId}`, data, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n });\n};\n\nupdatePost.propTypes = {\n data: PropTypes.shape({\n title: PropTypes.string.isRequired,\n desc: PropTypes.string.isRequired,\n category: PropTypes.string.isRequired,\n }).isRequired,\n postId: PropTypes.string.isRequired,\n};\n\nexport const useUpdatePost = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n\n return useMutation({\n onMutate: async (updatingPost) => {\n await queryClient.cancelQueries(['post', updatingPost?.postId]);\n\n const previousPost = queryClient.getQueryData[('post', updatingPost?.postId)];\n\n queryClient.setQueryData(['post', updatingPost?.postId], {\n ...previousPost,\n ...updatingPost.data,\n id: updatingPost.postId,\n });\n\n return { previousPost };\n },\n onError: (_, __, context) => {\n if (context?.previousPost) {\n queryClient.setQueryData(['post', context.previousPost.id], context.previousPost);\n }\n },\n onSuccess: (data) => {\n queryClient.refetchQueries(['post', data.id]);\n addNotification({\n type: 'success',\n title: 'Post Updated',\n });\n },\n ...config,\n mutationFn: updatePost,\n });\n};\n","import { Button } from '@/components/Elements';\nimport { Form, FormDrawer, InputField, TextAreaField, UploadField } from '@/components/Form';\nimport { Authorization, ROLES } from '@/lib/authorization';\nimport { PencilIcon } from '@heroicons/react/solid';\nimport PropTypes from 'prop-types';\nimport { useState } from 'react';\nimport * as z from 'zod';\n\nimport { usePost } from '../api/getPost';\nimport { useUpdatePost } from '../api/updatePost';\n\nconst schema = z.object({\n title: z.string().min(1, 'Required'),\n desc: z.string().min(1, 'Required'),\n});\n\nexport const UpdatePost = ({ postId }) => {\n const [image, setImage] = useState(null);\n const [preview, setPreview] = useState(null);\n const postQuery = usePost({ postId });\n const updatePostMutation = useUpdatePost();\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <FormDrawer\n size=\"sm\"\n isDone={updatePostMutation.isSuccess}\n triggerButton={\n <Button startIcon={<PencilIcon className=\"h-4 w-4\" />} size=\"sm\">\n Update Post\n </Button>\n }\n title=\"Update Post\"\n submitButton={\n <Button\n form=\"update-post\"\n type=\"submit\"\n size=\"sm\"\n isLoading={updatePostMutation.isLoading}\n >\n Submit\n </Button>\n }\n >\n <Form\n id=\"update-post\"\n encType=\"multipart/form-data\"\n onSubmit={async (values) => {\n const { title, desc, category = 'News' } = values;\n const bodyFormData = new FormData();\n bodyFormData.append('image', image);\n bodyFormData.append('title', title);\n bodyFormData.append('desc', desc);\n bodyFormData.append('category', category);\n await updatePostMutation.mutateAsync({ data: bodyFormData, postId });\n }}\n options={{\n defaultValues: {\n title: postQuery.data?.title,\n desc: postQuery.data?.desc,\n category: postQuery.data?.category,\n },\n }}\n schema={schema}\n >\n {({ register, formState, watch, setValue }) => (\n <>\n <InputField\n label=\"Title\"\n error={formState.errors['title']}\n registration={register('title')}\n />\n <TextAreaField\n label=\"Content\"\n error={formState.errors['desc']}\n editorContent={watch('desc')}\n setValue={setValue}\n value=\"desc\"\n />\n <InputField\n label=\"Category\"\n disabled={true}\n error={formState.errors['category']}\n registration={register('category')}\n />\n <span className=\"text-gray-500 text-sm\">\n Default category is set to news and can not be updated.\n </span>\n <UploadField\n title=\"Update Cover Photo\"\n subTitle=\"This will also be used as the thumbnail in feeds\"\n error={formState.errors['image']}\n x={1024}\n y={768}\n onChange={(e) => {\n setImage(e.target.files[0]);\n setPreview(URL.createObjectURL(e.target.files[0]));\n }}\n preview={preview}\n />\n </>\n )}\n </Form>\n </FormDrawer>\n </Authorization>\n );\n};\n\nUpdatePost.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n","import { Spinner, MDPreview } from '@/components/Elements';\nimport { Head } from '@/components/Head';\nimport { ContentLayout } from '@/components/Layout';\nimport { UPLOADS_API_URL } from '@/config';\nimport { Comments } from '@/features/comments';\nimport { formatDate } from '@/utils/format';\nimport { useParams } from 'react-router-dom';\n\nimport { usePost } from '../api/getPost';\nimport { UpdatePost } from '../components/UpdatePost';\n\nexport const Post = () => {\n const { postId } = useParams();\n const postQuery = usePost({ postId });\n\n if (postQuery.isLoading) {\n return (\n <div className=\"w-full h-48 flex justify-center items-center\">\n <Spinner size=\"lg\" />\n </div>\n );\n }\n\n if (!postQuery.data) return null;\n\n return (\n <>\n <Head title={postQuery.data.title} />\n <ContentLayout title={postQuery.data.title} button={<UpdatePost postId={postId} />}>\n <span className=\"text-xs font-bold\">{formatDate(postQuery.data.createdAt)}</span>\n <div className=\"mt-6 flex flex-col space-y-16\">\n <div>\n <div className=\"bg-white shadow overflow-hidden sm:rounded-lg\">\n <div>\n <img\n src={`${UPLOADS_API_URL}/posts/resized/${postQuery.data.image}`}\n alt=\"background for post\"\n className=\"h-48 object-cover hover:opacity-75 transition-opacity duration-200\"\n />\n </div>\n <div className=\"px-4 py-5 sm:px-6\">\n <div className=\"mt-1 max-w-2xl text-sm text-gray-500\">\n <MDPreview value={postQuery.data.desc} />\n </div>\n </div>\n </div>\n </div>\n <div>\n <Comments postId={postId} />\n </div>\n </div>\n </ContentLayout>\n </>\n );\n};\n","import { axios } from '@/lib/axios';\nimport { queryClient } from '@/lib/react-query';\nimport { useNotificationStore } from '@/stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const createPost = ({ data }) => {\n return axios.post(`/posts`, data, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n });\n};\n\ncreatePost.propTypes = {\n data: PropTypes.shape({\n title: PropTypes.string.isRequired,\n category: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport const useCreatePost = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n return useMutation({\n onMutate: async (newPost) => {\n await queryClient.cancelQueries('posts');\n\n const previousPosts = queryClient.getQueryData('posts');\n\n queryClient.setQueryData('posts', [...(previousPosts || []), newPost.data]);\n\n return { previousPosts };\n },\n onError: (_, __, context) => {\n if (context?.previousPosts) {\n queryClient.setQueryData('posts', context.previousPosts);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries('posts');\n addNotification({\n type: 'success',\n title: 'Post Created',\n });\n },\n ...config,\n mutationFn: createPost,\n });\n};\n","import { Button } from '@/components/Elements';\nimport { Form, FormDrawer, InputField, TextAreaField, UploadField } from '@/components/Form';\nimport { Authorization, ROLES } from '@/lib/authorization';\nimport { PlusIcon } from '@heroicons/react/outline';\nimport { useState } from 'react';\nimport * as z from 'zod';\n\nimport { useCreatePost } from '../api/createPost';\n\nconst schema = z.object({\n title: z.string().min(1, 'Required'),\n desc: z.string(),\n});\n\nexport const CreatePost = () => {\n const [image, setImage] = useState(null);\n const [preview, setPreview] = useState(null);\n const createPostMutation = useCreatePost();\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <FormDrawer\n size=\"sm\"\n isDone={createPostMutation.isSuccess}\n triggerButton={\n <Button size=\"sm\" startIcon={<PlusIcon className=\"h-4 w-4\" />}>\n Create Post\n </Button>\n }\n title=\"Create Post\"\n submitButton={\n <Button\n form=\"create-post\"\n type=\"submit\"\n size=\"sm\"\n isLoading={createPostMutation.isLoading}\n >\n Submit\n </Button>\n }\n >\n <Form\n id=\"create-post\"\n encType=\"multipart/form-data\"\n onSubmit={async (values) => {\n const { title, desc, category = 'News' } = values;\n const bodyFormData = new FormData();\n bodyFormData.append('image', image);\n bodyFormData.append('title', title);\n bodyFormData.append('desc', desc);\n bodyFormData.append('category', category);\n await createPostMutation.mutateAsync({ data: bodyFormData });\n }}\n schema={schema}\n >\n {({ register, formState, watch, setValue }) => (\n <>\n <InputField\n label=\"Title\"\n error={formState.errors['title']}\n registration={register('title')}\n />\n <TextAreaField\n label=\"Content\"\n error={formState.errors['desc']}\n editorContent={watch('desc')}\n setValue={setValue}\n value=\"desc\"\n />\n <InputField\n label=\"Category\"\n value=\"News\"\n disabled={true}\n error={formState.errors['category']}\n registration={register('category')}\n />\n <span className=\"text-gray-500 text-sm\">Default category is set to news.</span>\n <UploadField\n title=\"Upload a Cover Photo\"\n subTitle=\"This will also be used as the thumbnail in feeds\"\n error={formState.errors['image']}\n x={1024}\n y={768}\n onChange={(e) => {\n setImage(e.target.files[0]);\n setPreview(URL.createObjectURL(e.target.files[0]));\n }}\n preview={preview}\n />\n </>\n )}\n </Form>\n </FormDrawer>\n </Authorization>\n );\n};\n","import { axios } from '@/lib/axios';\nimport { useQuery } from 'react-query';\n\nexport const getPosts = () => {\n return axios.get('/posts');\n};\n\nexport const usePosts = ({ config } = {}) => {\n return useQuery({\n ...config,\n queryKey: ['posts'],\n queryFn: () => getPosts(),\n });\n};\n","import { axios } from '@/lib/axios';\nimport { queryClient } from '@/lib/react-query';\nimport { useNotificationStore } from '@/stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const deletePost = ({ postId }) => {\n return axios.delete(`/posts/${postId}`);\n};\n\ndeletePost.propTypes = {\n postId: PropTypes.string.isRequired,\n};\n\nexport const useDeletePost = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n\n return useMutation({\n onMutate: async (deletedPost) => {\n await queryClient.cancelQueries('posts');\n\n const previousPosts = queryClient.getQueryData('posts');\n\n queryClient.setQueryData(\n 'posts',\n previousPosts?.filter((post) => post.id !== deletedPost.postId)\n );\n\n return { previousPosts };\n },\n onError: (_, __, context) => {\n if (context?.previousPosts) {\n queryClient.setQueryData('posts', context.previousPosts);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries('posts');\n addNotification({\n type: 'success',\n title: 'Post Deleted',\n });\n },\n ...config,\n mutationFn: deletePost,\n });\n};\n","import { Button, ConfirmationDialog } from '@/components/Elements';\nimport { Authorization, ROLES } from '@/lib/authorization';\nimport { TrashIcon } from '@heroicons/react/outline';\nimport PropTypes from 'prop-types';\n\nimport { useDeletePost } from '../api/deletePost';\n\nexport const DeletePost = ({ id }) => {\n const deletePostMutation = useDeletePost();\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <ConfirmationDialog\n icon=\"danger\"\n title=\"Delete Post\"\n body=\"Are you sure you want to delete this Post?\"\n triggerButton={\n <Button variant=\"danger\">\n <TrashIcon className=\"h-4 w-4\" />\n </Button>\n }\n confirmButton={\n <Button\n isLoading={deletePostMutation.isLoading}\n type=\"button\"\n className=\"bg-red-600\"\n onClick={async () => await deletePostMutation.mutateAsync({ postId: id })}\n >\n Delete Post\n </Button>\n }\n />\n </Authorization>\n );\n};\n\nDeletePost.propTypes = {\n id: PropTypes.string.isRequired,\n};\n","import { Table, Spinner, Link } from '@/components/Elements';\nimport { formatDate } from '@/utils/format';\n\nimport { usePosts } from '../api/getPosts';\n\nimport { DeletePost } from './DeletePost';\n\nexport const PostsList = () => {\n const postsQuery = usePosts();\n\n if (postsQuery.isLoading) {\n return (\n <div className=\"w-full h-48 flex justify-center items-center\">\n <Spinner size=\"lg\" />\n </div>\n );\n }\n\n if (!postsQuery.data) return null;\n\n return (\n <Table\n data={postsQuery.data}\n columns={[\n {\n title: 'Title',\n field: 'title',\n },\n {\n title: 'Created At',\n field: 'createdAt',\n Cell({ entry: { createdAt } }) {\n return <span>{formatDate(createdAt)}</span>;\n },\n },\n {\n title: '',\n field: '_id',\n Cell({ entry: { _id } }) {\n return <Link to={`./${_id}`}>View</Link>;\n },\n },\n {\n title: '',\n field: '_id',\n Cell({ entry: { _id } }) {\n return <DeletePost id={_id} />;\n },\n },\n ]}\n />\n );\n};\n","import { ContentLayout } from '@/components/Layout';\n\nimport { CreatePost } from '../components/CreatePost';\nimport { PostsList } from '../components/PostsList';\n\nexport const Posts = () => {\n return (\n <ContentLayout title=\"Posts\" button={<CreatePost />}>\n <div className=\"mt-4\">\n <PostsList />\n </div>\n </ContentLayout>\n );\n};\n","import { Navigate, Route, Routes } from 'react-router-dom';\n\nimport { Post } from './Post';\nimport { Posts } from './Posts';\n\nexport const PostsRoutes = () => {\n return (\n <Routes>\n <Route path=\"\" element={<Posts />} />\n <Route path=\":postId\" element={<Post />} />\n <Route path=\"*\" element={<Navigate to=\".\" />} />\n </Routes>\n );\n};\n"],"sourceRoot":""}