(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[695],{3575:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/events",function(){return t(2935)}])},2935:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>g});var s=t(2322),a=t(2784),i=t(5632),c=t(7729),l=t.n(c),o=t(9097),r=t.n(o),d=t(2202),m=t(2176),_=t(9034),h=t.n(_),x=t(7649),v=t.n(x),p=t(7732),j=t(9725),u=t(6577);function g(e){let{theme:n,setContactInfo:t}=e,c=(0,i.useRouter)(),[o,_]=(0,a.useState)(),[x,g]=(0,a.useState)([]),[N,Y]=(0,a.useState)(),[f,E]=(0,a.useState)(!1),[D,M]=(0,a.useState)(),[w,b]=(0,a.useState)(),[k,y]=(0,a.useState)([]),[S,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{void 0!==c.query.id&&b(c.query.id),console.log(c.query.id),I(),G()},[]),(0,a.useLayoutEffect)(()=>{Y(localStorage.listType||"grid")},[]),(0,a.useEffect)(()=>{localStorage.listType=N},[N]);let G=async()=>{let{data:e,error:n}=await m.q.graphql.request("\n        query {\n          event_categories {\n            id\n            name\n            value\n          }\n        }\n      ");n&&n.map(e=>d.ZP.error("Getting Event Categories: ".concat(e.message))),e&&(console.log(e.event_categories),g(e.event_categories))},I=async()=>{let{data:e,error:n}=await m.q.graphql.request('\n        query ($now: date) {\n          events (order_by: {date: asc}, where: {\n            date: {_gte: $now}\n            categories: {_has_key: "main"}\n          }) {\n            id\n            title\n            description\n            image\n            date\n            end_date\n            time\n            location\n            link\n            link_text\n            contact_name\n            contact_email\n            invert\n            show_update\n            categories\n          }\n        }\n      ',{now:h()(Date.now()).format("YYYY-MM-DD")});n&&d.ZP.error(n[0].message),e&&_(e.events)};(0,a.useEffect)(()=>{void 0!==D&&void 0!==w&&E(!0)},[D]),(0,a.useEffect)(()=>{void 0!==w&&c.push("/events","/events?id=".concat(w),{shallow:!0}),void 0===w&&c.push("/events",void 0,{shallow:!0}),void 0!==w&&o&&o.map(e=>{e.id==w&&M(e)})},[w]);let q=()=>{let e=e=>{let{eventInfo:t}=e;return(0,s.jsxs)("section",{className:"".concat(v().eventCard," cardShadow"),onClick:()=>{b(t.id),E(!0),M(t)},children:[t.show_update&&(0,s.jsx)("span",{className:v().updateFlag,children:(0,s.jsx)("p",{children:"UPDATED"})}),null!==t.image?(0,s.jsx)("img",{src:"".concat("https://svznrpbyjssmrqclkvkg.storage.us-east-1.nhost.run/v1/files","/").concat(t.image,"?w=400&q=90"),alt:t.title,className:"dark"===n&&t.invert&&"invert"}):(0,s.jsx)("img",{}),(0,s.jsxs)("article",{className:v().eventDetails,children:[(0,s.jsx)("h2",{className:v().title,children:t.title}),(0,s.jsxs)("span",{className:v().detailContainer,children:[(0,s.jsxs)("div",{className:v().tagContainer,children:[(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.fT7}),null===t.end_date&&(0,s.jsx)("p",{children:h()(t.date,"YYYY-MM-DD").format("MMM DD, YYYY")}),null!==t.end_date&&(0,s.jsx)("p",{children:"".concat(h()(t.date,"YYYY-MM-DD").format("MMM DD")," - ").concat(h()(t.end_date,"YYYY-MM-DD").format("MMM DD, YYYY"))})]}),t.time&&(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.SZw}),(0,s.jsx)("p",{children:t.time})]})]}),(0,s.jsx)(p.G,{className:"icon ".concat(v().detailIcon),icon:j.r8p})]})]})]},t.id)};return(0,s.jsx)(s.Fragment,{children:k.length>0?k.map(n=>o&&o.map(t=>{if(t.categories.includes(n))return(0,s.jsx)(e,{eventInfo:t})})):o&&o.map(n=>(0,s.jsx)(e,{eventInfo:n}))})},B=()=>{let e=e=>{let{eventInfo:n}=e;return(0,s.jsxs)("section",{className:"".concat(v().eventListCard," cardShadow"),onClick:()=>{b(n.id),E(!0),M(n)},children:[n.show_update&&(0,s.jsx)("span",{className:v().updateFlag,children:(0,s.jsx)("p",{children:"UPDATED"})}),(0,s.jsxs)("article",{className:v().eventDetails,children:[(0,s.jsx)("h2",{className:v().title,children:n.title}),(0,s.jsx)("span",{className:v().detailContainer,children:(0,s.jsxs)("div",{className:v().tagContainer,children:[(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.fT7}),null===n.end_date&&(0,s.jsx)("p",{children:h()(n.date,"YYYY-MM-DD").format("MMM DD, YYYY")}),null!==n.end_date&&(0,s.jsx)("p",{children:"".concat(h()(n.date,"YYYY-MM-DD").format("MMM DD")," - ").concat(h()(n.end_date,"YYYY-MM-DD").format("MMM DD, YYYY"))})]}),n.time&&(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.SZw}),(0,s.jsx)("p",{children:n.time})]})]})})]}),(0,s.jsx)(p.G,{className:"icon ".concat(v().detailIcon),icon:j.r8p})]},n.id)};return(0,s.jsx)(s.Fragment,{children:k.length>0?k.map(n=>o&&o.map(t=>{if(t.categories.includes(n))return(0,s.jsx)(e,{eventInfo:t})})):o&&o.map(n=>(0,s.jsx)(e,{eventInfo:n}))})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l(),{children:(0,s.jsx)("title",{children:"Events at Covenant"})}),(0,s.jsxs)("main",{children:[f&&(0,s.jsx)(C,{off:()=>{E(!1),b(void 0),M(void 0)},event:D,theme:n,setContactInfo:t}),(0,s.jsxs)("div",{className:"mainContainer_wide ".concat(v().timeline),children:[(0,s.jsxs)("section",{className:v().actionBar,children:[S&&(0,s.jsx)(()=>{let e=[...k],n=n=>{e=k.includes(n.target.value)?e.filter(e=>e!==n.target.value):[...e,n.target.value]};return(0,s.jsxs)("div",{className:"".concat(v().filterContainer," menuShadow"),children:[(0,s.jsxs)("span",{className:v().head,children:[(0,s.jsx)("h3",{children:"Filters"}),(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:j.NBC,onClick:()=>T(!1),size:"lg"})]}),x&&x.map(e=>["Next Steps","Kids","Students","Young Adults","Brotherhood","Sisterhood"].includes(e.name)&&(0,s.jsxs)("span",{className:v().checkboxContainer,children:[(0,s.jsx)("input",{type:"checkbox",id:e.id,className:v().checkbox,value:e.value,defaultChecked:k&&k.includes(e.value),onChange:e=>n(e),name:e.name},e.id),(0,s.jsx)("label",{for:e.id,children:e.name})]})),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px",gap:5,alignItems:"flex-end"},children:[k.length>0&&(0,s.jsx)("p",{className:"outlineBtn btn-xs btn-animation",onClick:()=>{y([]),T(!1)},children:"Clear"}),(0,s.jsx)("p",{className:"solidBtn_primary btn-sm btn-animation",onClick:()=>{y(e),console.log(e),T(!1)},children:"Filter"})]})]})},{}),(0,s.jsxs)("span",{style:{alignContent:"center",gridColumn:"1 / -1"},children:[(0,s.jsx)("h1",{className:v().pageTitle,children:"Events at Covenant"}),(0,s.jsx)(r(),{legacyBehavior:!0,href:"https://covenant.churchcenter.com/people/forms/341978",children:(0,s.jsx)("a",{className:"solidBtn_primary btn-sm btn-animation",target:"_blank",children:"CK Childcare"})})]}),(0,s.jsxs)("span",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"},children:[(0,s.jsxs)("div",{className:v().iconContainer,onClick:()=>T(!0),children:[(0,s.jsx)(p.G,{icon:j.G_j,className:v().listIcon}),(0,s.jsx)("p",{style:{margin:0,width:"max-content"},children:"Filter"})]}),(0,s.jsxs)("div",{className:v().iconContainer,onClick:()=>{"grid"===N?Y("list"):Y("grid")},children:[(0,s.jsx)(p.G,{icon:"grid"===N?j.Zrf:j.QR4,className:v().listIcon}),(0,s.jsx)("p",{style:{margin:0,width:"max-content"},children:"grid"===N?"List View":"Grid View"})]})]})]}),"grid"===N?(0,s.jsx)(()=>o&&o.length>0?(0,s.jsx)(q,{}):(0,s.jsxs)("p",{className:v().noEvents,children:["We don't currently have any events scheduled. ",(0,s.jsx)("br",{}),"This page will be updated once we do."]}),{}):(0,s.jsx)("section",{className:v().cardContainer,children:(0,s.jsx)(()=>o&&o.length>0?(0,s.jsx)(B,{}):(0,s.jsxs)("p",{className:v().noEvents,children:["We don't currently have any events scheduled. ",(0,s.jsx)("br",{}),"This page will be updated once we do."]}),{})})]})]})]})}function C(e){let{off:n,event:t,theme:a,setContactInfo:i}=e;return(0,s.jsx)("section",{className:v().eventModal,children:(0,s.jsxs)("div",{className:v().modalWrapper,children:[(0,s.jsx)(p.G,{icon:j.NBC,className:"icon ".concat(v().close),onClick:n,size:"xl"}),(0,s.jsx)("div",{className:"".concat(v().modalContainer," cardShadow"),children:(0,s.jsxs)("div",{className:v().subContainer,children:[null!==t.image?(0,s.jsx)("img",{src:"".concat("https://svznrpbyjssmrqclkvkg.storage.us-east-1.nhost.run/v1/files","/").concat(t.image,"?w=1200&q=90"),alt:t.title,className:"".concat("dark"===a&&t.invert&&"invert"," menuShadow")}):"",(0,s.jsxs)("section",{className:v().detailsContainer,children:[(0,s.jsx)("h2",{children:t.title}),(0,s.jsxs)("span",{className:v().tagContainer,children:[(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.fT7}),(0,s.jsx)("p",{children:h()(t.date,"YYYY-MM-DD").format("MMM DD, YYYY")})]}),t.time&&(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:u.SZw}),(0,s.jsx)("p",{children:t.time})]}),t.location&&null!==t.location?(0,s.jsxs)("span",{className:v().tag,children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:j.FGq}),(0,s.jsx)("p",{children:t.location})]}):null]}),null!==t.description?(0,s.jsx)("p",{children:t.description}):(0,s.jsx)("p",{}),(0,s.jsxs)("span",{className:v().btnContainer,children:[null!==t.contact_email&&null!==t.contact_name?(0,s.jsxs)("span",{onClick:()=>{i.setIsPrayer(!1),i.setShowContact(!0),i.setHeader(()=>(0,s.jsxs)("h1",{children:["Message",(0,s.jsx)("br",{}),(0,s.jsx)("strong",{children:t.contact_name.split(" ")[0]})," ",t.contact_name.split(" ")[1]]})),i.setRecipient(t.contact_email),i.setSubject("".concat(t.title," ").concat(h()(t.date,"YYYY-MM-DD").format("MMM DD, YYYY")," ").concat(t.time))},className:"".concat(v().btn," outlineBtn_primary btn-sm"),children:[(0,s.jsx)(p.G,{className:"icon",icon:j.FU$}),(0,s.jsx)("p",{className:v().registerText,children:"Email ".concat(t.contact_name)})]}):null,null!==t.link&&null!==t.link_text?(0,s.jsxs)("a",{href:t.link,target:"_blank",className:"".concat(v().btn," solidBtn_primary btn-md"),children:[(0,s.jsx)(p.G,{className:"icon ".concat(v().icon),icon:j.nNP}),(0,s.jsx)("p",{children:t.link_text})]}):null]})]})]})})]})})}},7649:e=>{e.exports={eventCard:"Events_eventCard__hEupt",noEvents:"Events_noEvents__Z3vqj",timeline:"Events_timeline__PZCdf",pageTitle:"Events_pageTitle__oXzRY",actionBar:"Events_actionBar__tlcPk",filterContainer:"Events_filterContainer__qnDvg",checkboxContainer:"Events_checkboxContainer__9jyTc",checkbox:"Events_checkbox__vCtIY",head:"Events_head__1WfZT",icon:"Events_icon__ojPsF",dropdown:"Events_dropdown__4EWIp",iconContainer:"Events_iconContainer__05rLK",listIcon:"Events_listIcon__0SExc",updateFlag:"Events_updateFlag__gjhtZ",cardContainer:"Events_cardContainer__BdI0V",eventListCard:"Events_eventListCard__kS5ut",eventDetails:"Events_eventDetails__r42CF",detailContainer:"Events_detailContainer___oGp_",tagContainer:"Events_tagContainer__i32w4",tag:"Events_tag__EWlqR",detailIcon:"Events_detailIcon__giTpP",title:"Events_title__gkixH",descriptionPreview:"Events_descriptionPreview__AThJn",fullbtn:"Events_fullbtn__hiG1A",eventModal:"Events_eventModal__3nc5S",modalWrapper:"Events_modalWrapper__0XDmf",close:"Events_close__UWITD",modalContainer:"Events_modalContainer__VvyTi",subContainer:"Events_subContainer__MGr1g",detailsContainer:"Events_detailsContainer__Y_jKO",btnContainer:"Events_btnContainer__CJCS0",btn:"Events_btn__fNk4x",registerText:"Events_registerText__aBp9e",Container:"Events_Container__fX8Je"}}},e=>{var n=n=>e(e.s=n);e.O(0,[888,774,179],()=>n(3575)),_N_E=e.O()}]);