(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8977],{2974:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/campaign",function(){return a(3052)}])},2404:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var s=a(5893),n=a(5675),r=a.n(n),i=a(1664),l=a.n(i);function o(e){return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(l(),{href:"/campaign/"+e.id,className:"group w-full relative flex items-center overflow-hidden rounded-2xl",children:[(0,s.jsx)(r(),{width:100,height:100,className:"lg:w-[130px] w-[100px] lg:h-[130px] h-[110px] object-cover rounded-l-2xl absolute left-0 top-1/2 -translate-y-1/2 z-[0]  duration-200",alt:"image",src:e.image}),(0,s.jsxs)("div",{className:"w-full lg:h-[132px] h-[110px] p-3 lg:ml-[120px] ml-[90px] bg-secondary-gray rounded-2xl flex flex-col lg:gap-[10px] gap-2 duration-200 z-[2]",children:[(0,s.jsx)("h2",{className:"lg:text-xs text-[10px] font-semibold text-secondary-gray10",children:e.category}),(0,s.jsxs)("h2",{className:"lg:text-base text-sm font-bold text-secondary-dark5",children:[e.title," "]}),(0,s.jsx)("div",{className:"w-full bg-primary_light_90 rounded-full ml-1 block lg:mb-3 mb-2 h-1",children:(0,s.jsx)("div",{className:"bg-primary-blue20 rounded-full relative h-1",style:{width:"".concat(e.precentage,"%")},children:(0,s.jsx)("div",{className:"absolute top-1/2 -translate-y-1/2 right-0 w-2 h-2 rounded-full bg-primary-blue20"})})}),(0,s.jsx)("h2",{className:"lg:text-xs text-[10px] font-extrabold text-black",children:e.price})]})]})})}},8242:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var s=a(5893);function n(e){return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("button",{type:e.type,className:"fixed bottom-5 left-5 right-5 md:max-w-[440px] max-w-none md:min-w-[440px] min-w-min mx-auto rounded-full p-4 bg-primary-blue20 text-white font-semibold text-sm hover:bg-opacity-70 duration-200",children:e.title})})}a(7294)},221:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var s=a(5893);function n(e){let{children:t}=e;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"w-full bg-tertiary-light80 rounded-full flex justify-between items-center overflow-hidden",children:t})})}a(7294)},2463:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var s=a(5893);function n(e){let{children:t}=e;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"w-full min-h-screen relative bg-tertiary-light80",children:(0,s.jsx)("div",{className:"md:max-w-[480px] max-w-none md:min-w-[480px] min-w-min mx-auto bg-white shadow-sm w-full min-h-screen pt-[77px] pb-[78px] px-6 relative",children:t})})})}a(7294)},8020:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var s=a(5893),n=a(5675),r=a.n(n),i=a(1664),l=a.n(i);function o(e){var t;return(0,s.jsx)("nav",{className:"w-full fixed top-0 left-0 right-0 bg-primary-blue20 z-50",children:(0,s.jsxs)("div",{className:"w-full md:max-w-[480px] max-w-none md:min-w-[480px] min-w-min mx-auto flex items-center py-3 gap-x-2",children:[(0,s.jsx)(l(),{href:e.link,children:(0,s.jsx)(r(),{width:0,height:0,className:"w-6 object-cover",alt:"logo",src:"/assets/icon/icon-arrow-left.svg"})}),e.children,(0,s.jsx)("h2",{className:"text-white font-bold",children:(null==(t=e.title)?void 0:t.length)>40?t.substr(0,39)+"...":t})]})})}a(7294)},3052:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return w}});var s=a(5893),n=a(2404),r=a(8242),i=a(221),l=a(2463),o=a(8020),c=a(5675),d=a.n(c),x=a(1664),u=a.n(x),m=a(7294),h=a(4948),g=a(8533),p=a(3279),f=a.n(p),b=a(129),y=a.n(b),j=a(6376);function w(){let[e,t]=(0,m.useState)([]),[a,c]=(0,m.useState)([]),[x,p]=(0,m.useState)(!0),[b,w]=(0,m.useState)(1),[v,N]=(0,m.useState)(""),[k,_]=(0,m.useState)([]),[C,F]=(0,m.useState)(!1),[E,S]=(0,m.useState)(!1),T=(0,m.useRef)(null),R=(0,m.useRef)(null),[Z,D]=(0,m.useState)(!1),[L,z]=(0,m.useState)(!1),[I,M]=(0,m.useState)(!1),O=(0,m.useRef)(null),K=(0,m.useRef)(null),[P,A]=(0,m.useState)(!1),B=(e,t)=>e.length<=t?e:e.slice(0,t)+"...",U=()=>{setTimeout(()=>{F(!1)},190),S(!1)},X=()=>{setTimeout(()=>{z(!1)},190),M(!1)};(0,m.useEffect)(()=>{let e=e=>{R.current&&!R.current.contains(e.target)&&T.current&&!T.current.contains(e.target)&&U()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[R,T]),(0,m.useEffect)(()=>{let e=e=>{K.current&&!K.current.contains(e.target)&&O.current&&!O.current.contains(e.target)&&X()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[K,O]);let[Y,q]=(0,m.useState)("");(0,m.useEffect)(()=>{(async()=>{let e=y().stringify({page:1,category:Y,sort:v,selectedFilters:k},{arrayFormat:"indices"}),t=await (0,h.vM)(e);c(t.data),t.length<10&&p(!1)})()},[]);let G=async()=>{let e=y().stringify({page:1,category:Y,sort:v,selectedFilters:k},{arrayFormat:"indices"});console.log(e);let t=await (0,h.vM)(e);t.data.length<10&&p(!1),c(t.data),w(1)},H=async()=>{let e=b+1,t=y().stringify({page:e,category:Y,sort:v,selectedFilters:k},{arrayFormat:"indices"});console.log(t);let a=await (0,h.vM)(t);a.data.length<10&&p(!1),c(e=>[...e,...a.data]),w(e)},J=async e=>{q(e),console.log(e),G(),U()},Q=async e=>{N(e),G()},V=e=>{let{value:t,checked:a}=e.target;_(e=>a?[...e,t]:e.filter(e=>e!==t))};(0,m.useEffect)(()=>{(async()=>{t((await (0,h.n3)()).data)})()},[]);let W=e=>new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}).format(e),$=f()(H,1e3);return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{link:"/",title:"Campaign List"}),(0,s.jsxs)(i.Z,{children:[(0,s.jsxs)("button",{ref:T,className:"flex w-full items-center justify-center gap-2 py-3 px-8 hover:bg-primary-blue10 duration-200",onClick:()=>{!1===E&&(F(!0),S(!0))},children:[(0,s.jsx)(d(),{className:"w-6 object-cover",width:24,height:24,src:"/assets/icon/sort-menu-kategori.svg",alt:"icon"}),(0,s.jsx)("h2",{className:"text-xs font-medium",children:"Kategori"})]}),"ASC"===v?(0,s.jsxs)("button",{onClick:()=>Q("DESC"),className:"flex w-full items-center justify-center gap-2 border-x py-3 px-8 hover:bg-primary-blue10 duration-200",children:[(0,s.jsx)(d(),{className:"w-6 object-cover transition-all ease-in-out",width:24,height:24,src:"/assets/icon/sort-menu-urutkan.svg",alt:"icon"}),(0,s.jsx)("h2",{className:"text-xs font-medium",children:"Terlama"})]}):(0,s.jsxs)("button",{onClick:()=>Q("ASC"),className:"flex w-full items-center justify-center gap-2 border-x py-3 px-8 hover:bg-primary-blue10 duration-200",children:[(0,s.jsx)(d(),{className:"w-6 object-cover rotate-180 transition-all ease-in-out",width:24,height:24,src:"/assets/icon/sort-menu-urutkan.svg",alt:"icon"}),(0,s.jsx)("h2",{className:"text-xs font-medium",children:"Terbaru"})]}),(0,s.jsxs)("button",{ref:O,className:"flex w-full items-center justify-center gap-2 py-3 px-8 hover:bg-primary-blue10 duration-200",onClick:()=>{!1===I&&(z(!0),M(!0))},children:[(0,s.jsx)(d(),{className:"w-6 object-cover",width:24,height:24,src:"/assets/icon/sort-menu-filter.svg",alt:"icon"}),(0,s.jsx)("h2",{className:"text-xs font-medium",children:"Filter"})]})]}),(0,s.jsx)(g.Z,{dataLength:a.length,next:$,hasMore:x,loader:(0,s.jsx)("div",{children:(0,s.jsx)("h4",{className:"text-center my-2 font-bold text-gray-500",children:"Loading..."})}),endMessage:(0,s.jsx)("h4",{className:"text-center my-2 font-bold text-gray-500",children:"No more data"}),children:(0,s.jsx)("div",{className:"flex flex-col gap-4 mt-6",children:a.map((e,t)=>{var a;return(0,s.jsx)(n.Z,{id:e.post_name,image:e.post_image,category:null===(a=e.category)||void 0===a?void 0:a.category_name,title:B(e.post_title,25),precentage:e.percentage_paid,price:W(e.total_paid),target:W(e.post_price)},t)})})}),(0,s.jsx)("div",{id:"displayOutside",className:"".concat(C?"fixed":"hidden"," w-full h-screen bg-black top-0 left-0 right-0 bottom-0 bg-opacity-30 z-[100]"),children:(0,s.jsx)("div",{className:"w-full md:max-w-[480px] max-w-none md:min-w-[480px] min-w-min bg-transparent rounded-t-3xl mx-auto h-max bottom-0 absolute left-0 right-0",children:(0,s.jsxs)(j.E.div,{ref:R,id:"displayInside",initial:{y:"100%"},animate:{y:E?0:"100%"},transition:{type:"spring",stiffness:300,damping:30},drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:1},onDragStart:()=>D(!0),onDragEnd:(e,t)=>{D(!1),console.log(t.point.y),t.point.y>500&&U()},style:{width:"100%",height:"auto",backgroundColor:"#fff",overflow:"visible",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",padding:"20px 20px 40px 20px",position:"relative",cursor:"grab"},whileTap:{cursor:"grabbing"},children:[(0,s.jsx)("div",{id:"displayButtonClose",className:"bg-[#F5F5F7] w-[32px] h-2 mx-auto cursor-pointer mb-5 rounded-full",onClick:U}),(0,s.jsxs)("main",{id:"displayContent",children:[(0,s.jsx)("h2",{className:"font-bold text-secondary-dark5 text-[22px] mb-5",children:"Semua Kategori"}),(0,s.jsx)("div",{className:"flex flex-col gap-y-4 md:h-[300px] h-[300px] overflow-y-auto",children:e.map(e=>(0,s.jsxs)(u(),{href:"#",onClick:()=>J(e.category_slug),className:"w-full flex flex-row gap-x-3 items-center hover:bg-primary-blue10 rounded-full duration-200 hover:bg-opacity-50",children:[(0,s.jsx)(d(),{src:e.category_icon,alt:"icon",className:"lg:w-10 w-8 object-cover",width:40,height:40}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h2",{className:"font-bold lg:text-base text-sm",children:e.category_name}),(0,s.jsxs)("h2",{className:"font-medium text-secondary-gray10 lg:text-xs text-[10px]",children:[e.category_description,"."]})]})]},e.category_slug))})]})]})})}),(0,s.jsx)("div",{id:"displayOutside",className:"".concat(L?"fixed":"hidden"," w-full h-screen bg-black top-0 left-0 right-0 bottom-0 bg-opacity-30 z-[100]"),children:(0,s.jsx)("div",{className:"w-full md:max-w-[480px] max-w-none md:min-w-[480px] min-w-min bg-transparent rounded-t-3xl mx-auto h-max bottom-0 absolute left-0 right-0",children:(0,s.jsxs)(j.E.div,{ref:K,id:"displayInside",initial:{y:"100%"},animate:{y:I?0:"100%"},transition:{type:"spring",stiffness:300,damping:30},drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:1},onDragStart:()=>A(!0),onDragEnd:(e,t)=>{A(!1),console.log(t.point.y),t.point.y>700&&X()},style:{width:"100%",height:"auto",backgroundColor:"#fff",overflow:"visible",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",padding:"20px 20px 40px 20px",position:"relative",cursor:"grab"},whileTap:{cursor:"grabbing"},children:[(0,s.jsx)("div",{id:"displayButtonClose",className:"bg-[#F5F5F7] w-[32px] h-2 mx-auto cursor-pointer mb-5 rounded-full",onClick:X}),(0,s.jsxs)("main",{id:"displayContent",children:[(0,s.jsx)("h2",{className:"font-bold text-secondary-dark5 text-[22px] mb-5",children:"Filter"}),(0,s.jsxs)("form",{action:"#",onSubmit:e=>{e.preventDefault(),G(),X()},className:"flex flex-col gap-y-4 md:h-max h-max overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("div",{className:"relative flex items-center gap-x-2",children:(0,s.jsx)("input",{type:"checkbox",name:"filter",id:"untukumat",value:"untukumat",className:"",onChange:V})}),(0,s.jsx)("label",{className:"font-semibold text-secondary-dark5 lg:text-base text-xs",htmlFor:"untukumat",children:"Oleh UntukUmat"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("div",{className:"relative flex items-center gap-x-2",children:(0,s.jsx)("input",{type:"checkbox",name:"filter",id:"yayasan",value:"yayasan",className:"",onChange:V})}),(0,s.jsx)("label",{className:"font-semibold text-secondary-dark5 lg:text-base text-xs",htmlFor:"yayasan",children:"Kolaborasi Yayasan"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("div",{className:"relative flex items-center gap-x-2",children:(0,s.jsx)("input",{type:"checkbox",name:"filter",id:"publik",value:"publik",className:"",onChange:V})}),(0,s.jsx)("label",{className:"font-semibold text-secondary-dark5 lg:text-base text-xs",htmlFor:"publik",children:"Kolaborasi Publik"})]}),(0,s.jsx)("div",{className:"mt-12",children:(0,s.jsx)(r.Z,{type:"submit",title:"Terapkan Filter"})})]})]})]})})})]})})}},4654:function(){}},function(e){e.O(0,[3061,129,9944,6376,2888,9774,179],function(){return e(e.s=2974)}),_N_E=e.O()}]);