(self.webpackChunk_studyhub_co_react_comments_django_client=self.webpackChunk_studyhub_co_react_comments_django_client||[]).push([[22],{30022:(e,t,n)=>{"use strict";n.r(t),n.d(t,{HomePage:()=>U,default:()=>L,mapDispatchToProps:()=>F});var r=n(67294),o=n(49656),a=(n(45697),n(15482)),c=n(99095),i=n(37424),s=n(35281),u=n(22222),m=n(3500),l=n(41293),d=n(92148),p=n(29473),f=n(71893);const g=f.ZP.section.withConfig({displayName:"Section",componentId:"sc-1hn1bn5-0"})(["margin:3em auto;&:first-child{margin-top:0;}"]);const v=(0,f.ZP)(g).withConfig({displayName:"CenteredSection",componentId:"sc-1lglnfg-0"})(["text-align:center;"]);var h="boilerplate.containers.HomePage";const y=(0,c.vU)({reactDjangoCommentsWelcome:{id:"".concat(h,".welcome.header"),defaultMessage:"Welcome to the react-comments-django!"},trymeHeader:{id:"".concat(h,".tryme.header"),defaultMessage:"Try me!"},trymeMessage:{id:"".concat(h,".tryme.message"),defaultMessage:"Show Github repositories by"},trymeAtPrefix:{id:"".concat(h,".tryme.atPrefix"),defaultMessage:"@"}});var _=n(39727),b="boilerplate/Home/CHANGE_USERNAME";var w=n(18172),C={username:""};const E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:C,t=arguments.length>1?arguments[1]:void 0;return(0,w.ZP)(e,(function(e){switch(t.type){case b:e.username=t.username.replace(/@/gi,"")}}))};var k,x,D,P=function(e){return e.home||C},M=function(){return(0,u.P1)(P,(function(e){return e.username}))},S=n(73375),R=n(8425),H=n(77775),N=regeneratorRuntime.mark(A),j=regeneratorRuntime.mark(O);function A(){var e,t,n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,(0,S.select)(M());case 2:return e=r.sent,t="https://api.github.com/users/".concat(e,"/repos?type=all&sort=updated"),r.prev=4,r.next=7,(0,S.call)(H.Z,t);case 7:return n=r.sent,r.next=10,(0,S.put)((0,_.reposLoaded)(n,e));case 10:r.next=16;break;case 12:return r.prev=12,r.t0=r.catch(4),r.next=16,(0,S.put)((0,_.repoLoadingError)(r.t0));case 16:case"end":return r.stop()}}),N,null,[[4,12]])}function O(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,S.takeLatest)(R.W0,A);case 2:case"end":return e.stop()}}),j)}function W(e,t,n,r){D||(D="function"===typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);var o=e&&e.defaultProps,a=arguments.length-3;if(t||0===a||(t={children:void 0}),1===a)t.children=r;else if(a>1){for(var c=new Array(a),i=0;i<a;i++)c[i]=arguments[i+3];t.children=c}if(t&&o)for(var s in o)void 0===t[s]&&(t[s]=o[s]);else t||(t=o||{});return{$$typeof:D,type:e,key:void 0===n?null:""+n,ref:null,props:t,_owner:null}}var Z="home",G=window.REACT_COMMENTS_DJANGO_CONFIG,T=!1;function U(e){var t=e.username,n=(e.loading,e.error,e.repos,e.onSubmitForm);e.onChangeUsername;return(0,d.v)({key:Z,reducer:E}),(0,p.h)({key:Z,saga:O}),(0,r.useEffect)((function(){t&&t.trim().length>0&&n()}),[]),T?k||(k=W(o.l_,{to:"topics"})):W("article",{},void 0,x||(x=W(a.ql,{},void 0,W("title",{},void 0,"Home Page"),W("meta",{name:"description",content:"React comments django homepage"}))),W("div",{},void 0,W(v,{},void 0,W(l.Z,{},void 0,r.createElement(c._H,y.reactDjangoCommentsWelcome)),W("p",{})),W(g,{})))}G&&(T=G.EMBEDDED_MODE);var z=(0,u.zB)({repos:(0,m.zW)(),username:M(),loading:(0,m.DO)(),error:(0,m.hz)()});function F(e){return{onChangeUsername:function(t){return e((n=t.target.value,{type:b,username:n}));var n},onSubmitForm:function(t){void 0!==t&&t.preventDefault&&t.preventDefault(),e((0,_.loadRepos)())}}}var I=(0,i.connect)(z,F);const L=(0,s.compose)(I,r.memo)(U)}}]);