(window.webpackJsonp=window.webpackJsonp||[]).push([[32],{1017:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return y}));var s,o,i=a(0),l=a(1),r=a.n(l),c=a(12),n=a(4),d=a(3),h=a.n(d),m=a(961),p=a(958),u=a(271),g=a(223),b=a(2),v=a(1448),f=a(1443),O=a(1327),j=a(1344),C=a(281);const M=Object(n.f)({title:{id:"column.directory",defaultMessage:"Browse profiles"},recentlyActive:{id:"directory.recently_active",defaultMessage:"Recently active"},newArrivals:{id:"directory.new_arrivals",defaultMessage:"New arrivals"},local:{id:"directory.local",defaultMessage:"From {domain} only"},federated:{id:"directory.federated",defaultMessage:"From known fediverse"}});let y=Object(c.connect)((e=>({accountIds:e.getIn(["user_lists","directory","items"],Object(b.List)()),isLoading:e.getIn(["user_lists","directory","isLoading"],!0),domain:e.getIn(["meta","domain"])})))(s=Object(n.g)(((o=class extends r.a.PureComponent{constructor(){super(...arguments),this.state={order:null,local:null},this.handlePin=()=>{const{columnId:e,dispatch:t}=this.props;t(e?Object(u.h)(e):Object(u.e)("DIRECTORY",this.getParams(this.props,this.state)))},this.getParams=(e,t)=>({order:null===t.order?e.params.order||"active":t.order,local:null===t.local?e.params.local||!1:t.local}),this.handleMove=e=>{const{columnId:t,dispatch:a}=this.props;a(Object(u.g)(t,e))},this.handleHeaderClick=()=>{this.column.scrollTop()},this.setRef=e=>{this.column=e},this.handleChangeOrder=e=>{const{dispatch:t,columnId:a}=this.props;a?t(Object(u.f)(a,["order"],e.target.value)):this.setState({order:e.target.value})},this.handleChangeLocal=e=>{const{dispatch:t,columnId:a}=this.props;a?t(Object(u.f)(a,["local"],"1"===e.target.value)):this.setState({local:"1"===e.target.value})},this.handleLoadMore=()=>{const{dispatch:e}=this.props;e(Object(g.g)(this.getParams(this.props,this.state)))}}componentDidMount(){const{dispatch:e}=this.props;e(Object(g.h)(this.getParams(this.props,this.state)))}componentDidUpdate(e,t){const{dispatch:a}=this.props,s=this.getParams(e,t),o=this.getParams(this.props,this.state);s.order===o.order&&s.local===o.local||a(Object(g.h)(o))}render(){const{isLoading:e,accountIds:t,intl:a,columnId:s,multiColumn:o,domain:l}=this.props,{order:c,local:n}=this.getParams(this.props,this.state),d=!!s,h=Object(i.a)("div",{className:"scrollable"},void 0,Object(i.a)("div",{className:"filter-form"},void 0,Object(i.a)("div",{className:"filter-form__column",role:"group"},void 0,Object(i.a)(f.a,{name:"order",value:"active",label:a.formatMessage(M.recentlyActive),checked:"active"===c,onChange:this.handleChangeOrder}),Object(i.a)(f.a,{name:"order",value:"new",label:a.formatMessage(M.newArrivals),checked:"new"===c,onChange:this.handleChangeOrder})),Object(i.a)("div",{className:"filter-form__column",role:"group"},void 0,Object(i.a)(f.a,{name:"local",value:"1",label:a.formatMessage(M.local,{domain:l}),checked:n,onChange:this.handleChangeLocal}),Object(i.a)(f.a,{name:"local",value:"0",label:a.formatMessage(M.federated),checked:!n,onChange:this.handleChangeLocal}))),Object(i.a)("div",{className:"directory__list"},void 0,e?Object(i.a)(C.b,{}):t.map((e=>Object(i.a)(v.a,{id:e},e)))),Object(i.a)(O.a,{onClick:this.handleLoadMore,visible:!e}));return r.a.createElement(m.a,{bindToDocument:!o,ref:this.setRef,label:a.formatMessage(M.title)},Object(i.a)(p.a,{icon:"address-book-o",title:a.formatMessage(M.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:d,multiColumn:o}),o&&!d?Object(i.a)(j.a,{scrollKey:"directory"},void 0,h):h)}}).contextTypes={router:h.a.object},s=o))||s)||s}}]);
//# sourceMappingURL=directory-643a52a02a5fd34e4289.chunk.js.map