1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5077],{50332:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/community/[channel]",function(){return t(96722)}])},96722:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSG:function(){return P},default:function(){return ChannelPage}});var o=t(85893),i=t(67294),r=t(99428),a=t(82077),l=t(82729),s=t(19521),c=t(9473),u=t(609),m=t(58533),f=t(25670),d=t(54456),h=t(67788),p=t(86121),y=t(27012),w=t(83330),g=t(96229),x=t(81776),N=t(73845),hooks_useCommunityFetch=function(e){let{community:n}=e,t=(0,N.T)(),o=(0,c.v9)((0,x.Wx)({community:n})),r=(0,c.v9)((0,x.hl)({community:n})),a=(0,c.v9)((0,x.bq)({community:n})),l=(0,c.v9)((0,x.CU)({community:n})),s=(0,c.v9)((0,x.VF)({community:n})),u=(0,i.useRef)(new Set),m={newest:"/api/community/getCommunityPosts?communityName=".concat(n,"&filter=newest&page=").concat(o),"top-posts":"/api/community/getTrendingPostsChannel?communityName=".concat(n,"&page=").concat(o)};return{getPosts:async function(e){let{forInitialPosts:o=!1}=e,i="".concat(n,":").concat(r);if(!l){if(o){if(u.current.has(i)||s||a.length>0)return;u.current.add(i)}else if(!s)return;t((0,x.a3)({community:n,filter:r,isLoading:!0}));try{let e=m[r],o=await fetch(e),i=await o.json(),a=i.posts;0!==a.length&&t((0,x.Cg)({posts:a,community:n,filter:r}))}finally{t((0,x.a3)({community:n,filter:r,isLoading:!1})),o&&t((0,x.BC)({community:n,filter:r}))}}},posts:a}};function _templateObject(){let e=(0,l._)(["\n width: 100%;\n max-width: 700px;\n\n .fake-channel-composer {\n margin-bottom: 24px;\n\n "," {\n margin-bottom: 8px;\n }\n }\n\n .channel-posts {\n margin-top: 12px;\n display: flex;\n flex-direction: column;\n overflow: visible !important;\n }\n\n .community-feed-filters {\n .about {\n display: inline;\n\n "," {\n display: none;\n }\n }\n }\n"]);return _templateObject=function(){return e},e}let v=s.default.div.withConfig({componentId:"sc-5f1d1d69-0"})(_templateObject(),e=>{let{theme:n}=e;return n.breakpoints.sm},e=>{let{theme:n}=e;return n.breakpoints.sm});var feed_ChannelFeed=function(e){let{filters:n,noMorePosts:t=!1,community:i,disableComposer:r=!1,headerType:a="without-channel",pinPost:l=!1,feedFor:s="",sideBar:_=null}=e,j=(0,N.T)(),b=(0,c.v9)(u.f8),C=(0,c.v9)((0,x.hl)({community:i})),{getPosts:F,posts:E}=hooks_useCommunityFetch({community:i});return console.log({currentFilter:C}),(0,o.jsxs)(v,{children:[(0,o.jsx)(h.Z,{community:i}),(0,o.jsx)(w.Z,{community:i}),!r&&(0,o.jsx)(y.Z,{community:i}),(0,o.jsx)(p.Z,{filters:n,currentFilter:C,setCurrentFilter:function(e){j((0,x.Yl)({community:i,filter:e}))}}),"about"!=C&&(0,o.jsxs)(m.Z,{className:"channel-posts",dataLength:E.length,next:()=>F({forInitialPosts:!1}),hasMore:!0!=t,scrollThreshold:.9,loader:(0,o.jsx)(o.Fragment,{}),children:[null==E?void 0:E.map((e,n)=>(0,o.jsx)(d.Z,{post:e,uid:b,headerType:a,pinned:0===n&&(null==e?void 0:e.communityName)=="monthly-challenge"&&l,forFeed:!0,inFeed:s},null==e?void 0:e.postId)),t&&(0,o.jsx)("div",{style:{margin:"2rem 0rem"},children:(0,o.jsx)(g.Z,{mainText:"No posts yet"})}),!t&&0===E.length&&(0,o.jsx)(f.Z,{})]},"".concat(i,"-").concat(C)),"about"==C&&_]})},_=t(74796),j=t(52861),b=t(1198),C=t(39828),F=t(92369);async function setChannelRead(e){let{uid:n,channel:t,postId:o}=e;if(!n)throw Error("userUid is a required field.");let{firestore:i}=(0,F.UM)();try{let e=(0,C.JU)(i,"users",n,"channel-read-status",t);await (0,C.pl)(e,{lastSeen:o},{merge:!0})}catch(e){throw Error("Error setting popup status: "+e.message)}}var E=t(51382),P=!0;function ChannelPage(e){let{channelData:n,news:t,events:l,visitorCount:s,postCount:m}=e,f=(0,c.v9)(u.f8);(0,i.useEffect)(()=>{(0,E.P)({uid:f,community:n.internalName})},[f,n.internalName]);let d={...!n.hideTopPosts&&{"top-posts":{api:"/api/community/getTrendingPostsChannel?communityName=".concat(n.internalName),displayText:"Top Posts",internalName:"top-posts"}},newest:{api:"/api/community/getCommunityPosts?communityName=".concat(n.internalName,"&filter=newest"),displayText:"Newest",internalName:"newest"},about:{displayText:"About",internalName:"about"}},{getPosts:h,posts:p}=hooks_useCommunityFetch({community:n.internalName});(0,i.useEffect)(()=>{h({forInitialPosts:!0})},[h]),(0,i.useEffect)(()=>
1{if(0!=p.length&&f){let e=p[0];setChannelRead({uid:f,channel:n.internalName,postId:e.postId})}},[null==n?void 0:n.internalName,p,f]),function(e){let{community:n,throttleMs:t=150,enabled:o=!0}=e,r=(0,c.I0)(),a=(0,c.v9)((0,x.Pv)({community:n})),l=(0,i.useRef)(null),s=(0,i.useRef)(0),u=(0,i.useRef)(0);(0,i.useRef)(!1),console.log({savedScrollY:a}),(0,i.useEffect)(()=>{if(!n||!o||a<=0)return;let e=0,tryRestore=()=>{window.scrollTo({top:a,left:0,behavior:"instant"}),e+=1;let n=50>Math.abs(window.scrollY-a);!n&&e<10&&requestAnimationFrame(tryRestore)};requestAnimationFrame(tryRestore)},[n,o]),(0,i.useEffect)(()=>{if(!n||!o)return;let flush=()=>{r((0,x.hu)({community:n,scrollY:u.current})),s.current=Date.now()},handleScroll=()=>{u.current=window.scrollY,l.current||(l.current=requestAnimationFrame(()=>{l.current=null;let e=Date.now();e-s.current>=t&&flush()}))};return window.addEventListener("scroll",handleScroll,{passive:!0}),()=>{window.removeEventListener("scroll",handleScroll),l.current&&cancelAnimationFrame(l.current),flush()}},[n,o,t,r])}({community:n.internalName});let y={news:t,events:l,community:n.internalName,visitorCount:s,postCount:m,channel:n.internalName},w=(0,o.jsx)(b.Z,{...y,forMobile:!0}),g=(0,o.jsx)(b.Z,{...y,forMobile:!1});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.Z,{learningEnv:"community"}),(0,o.jsxs)(_.Z,{children:[(0,o.jsx)(a.Z,{}),(0,o.jsxs)(j.Z,{children:[(0,o.jsx)(feed_ChannelFeed,{filters:d,community:n.internalName,feedFor:n.internalName,sideBar:w}),g]})]})]})}}},function(e){e.O(0,[1272,8700,1057,3777,5937,7603,4090,4153,1622,9280,286,6095,8849,2512,719,9428,2163,6207,5884,4561,8325,5388,4456,1024,8866,9774,2888,179],function(){return e(e.s=50332)}),_N_E=e.O()}]);
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.