distraction.party/priv/static/packs/features/glitch/async/directory.js
2020-05-20 07:55:14 +02:00

2 lines
No EOL
9.6 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{849:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return G}));var o,n,c,i,r=a(0),s=a(2),l=(a(9),a(6),a(8)),d=a(1),u=a(3),b=a.n(u),m=a(15),f=a(7),j=a(5),g=a.n(j),h=a(760),p=a(758),O=a(252),v=a(204),_=a(4),M=a(21),w=a(16),y=a.n(w),k=a(108),C=a(96),I=a(98),N=a(214),L=a(102),E=a(41),R=a(18),P=a(420),q=a(24),A=a(45),F=a(123);var S=Object(f.f)({follow:{id:"account.follow",defaultMessage:"Follow"},unfollow:{id:"account.unfollow",defaultMessage:"Unfollow"},requested:{id:"account.requested",defaultMessage:"Awaiting approval"},unblock:{id:"account.unblock",defaultMessage:"Unblock @{name}"},unmute:{id:"account.unmute",defaultMessage:"Unmute @{name}"},unfollowConfirm:{id:"confirmations.unfollow.confirm",defaultMessage:"Unfollow"}}),T=(o=Object(m.connect)((function(){var e=Object(k.d)();return function(t,a){var o=a.id;return{account:e(t,o)}}}),(function(e,t){var a=t.intl;return{onFollow:function(t){t.getIn(["relationship","following"])||t.getIn(["relationship","requested"])?R.s?e(Object(A.d)("CONFIRM",{message:Object(r.a)(f.b,{id:"confirmations.unfollow.message",defaultMessage:"Are you sure you want to unfollow {name}?",values:{name:Object(r.a)("strong",{},void 0,"@",t.get("acct"))}}),confirm:a.formatMessage(S.unfollowConfirm),onConfirm:function(){return e(Object(q.S)(t.get("id")))}})):e(Object(q.S)(t.get("id"))):e(Object(q.M)(t.get("id")))},onBlock:function(t){t.getIn(["relationship","blocking"])?e(Object(q.R)(t.get("id"))):e(Object(q.z)(t.get("id")))},onMute:function(t){t.getIn(["relationship","muting"])?e(Object(q.T)(t.get("id"))):e(Object(F.g)(t))}}})),Object(f.g)(n=o((i=c=function(e){Object(l.a)(a,e);var t;t=a;function a(){for(var t,a=arguments.length,o=new Array(a),n=0;n<a;n++)o[n]=arguments[n];return t=e.call.apply(e,[this].concat(o))||this,Object(d.a)(Object(s.a)(t),"handleEmojiMouseEnter",(function(e){var t=e.target;t.src=t.getAttribute("data-original")})),Object(d.a)(Object(s.a)(t),"handleEmojiMouseLeave",(function(e){var t=e.target;t.src=t.getAttribute("data-static")})),Object(d.a)(Object(s.a)(t),"handleFollow",(function(){t.props.onFollow(t.props.account)})),Object(d.a)(Object(s.a)(t),"handleBlock",(function(){t.props.onBlock(t.props.account)})),Object(d.a)(Object(s.a)(t),"handleMute",(function(){t.props.onMute(t.props.account)})),Object(d.a)(Object(s.a)(t),"setRef",(function(e){t.node=e})),t}var o=a.prototype;return o._updateEmojis=function(){var e=this.node;if(e&&!R.a)for(var t=e.querySelectorAll(".custom-emoji"),a=0;a<t.length;a++){var o=t[a];o.classList.contains("status-emoji")||(o.classList.add("status-emoji"),o.addEventListener("mouseenter",this.handleEmojiMouseEnter,!1),o.addEventListener("mouseleave",this.handleEmojiMouseLeave,!1))}},o.componentDidMount=function(){this._updateEmojis()},o.componentDidUpdate=function(){this._updateEmojis()},o.render=function(){var e,t=this.props,a=t.account,o=t.intl;if(a.get("id")!==R.m&&null!==a.get("relationship",null)){var n=a.getIn(["relationship","following"]),c=a.getIn(["relationship","requested"]),i=a.getIn(["relationship","blocking"]),s=a.getIn(["relationship","muting"]);c?e=Object(r.a)(E.a,{disabled:!0,icon:"hourglass",title:o.formatMessage(S.requested)}):i?e=Object(r.a)(E.a,{active:!0,icon:"unlock",title:o.formatMessage(S.unblock,{name:a.get("username")}),onClick:this.handleBlock}):s?e=Object(r.a)(E.a,{active:!0,icon:"volume-up",title:o.formatMessage(S.unmute,{name:a.get("username")}),onClick:this.handleMute}):a.get("moved")&&!n||(e=Object(r.a)(E.a,{icon:n?"user-times":"user-plus",title:o.formatMessage(n?S.unfollow:S.follow),onClick:this.handleFollow,active:n}))}return(Object(r.a)("div",{className:"directory__card"},void 0,Object(r.a)("div",{className:"directory__card__img"},void 0,Object(r.a)("img",{src:R.a?a.get("header"):a.get("header_static"),alt:""})),Object(r.a)("div",{className:"directory__card__bar"},void 0,Object(r.a)(N.a,{className:"directory__card__bar__name",href:a.get("url"),to:"/accounts/"+a.get("id")},void 0,Object(r.a)(C.a,{account:a,size:48}),Object(r.a)(I.a,{account:a})),Object(r.a)("div",{className:"directory__card__bar__relationship account__relationship"},void 0,e)),b.a.createElement("div",{className:"directory__card__extra",ref:this.setRef},Object(r.a)("div",{className:"account__header__content",dangerouslySetInnerHTML:{__html:a.get("note_emojified")}})),Object(r.a)("div",{className:"directory__card__extra"},void 0,Object(r.a)("div",{className:"accounts-table__count"},void 0,Object(P.a)(a.get("statuses_count"))," ",Object(r.a)("small",{},void 0,Object(r.a)(f.b,{id:"account.posts",defaultMessage:"Toots"}))),Object(r.a)("div",{className:"accounts-table__count"},void 0,a.get("followers_count")<0?"-":Object(P.a)(a.get("followers_count"))," ",Object(r.a)("small",{},void 0,Object(r.a)(f.b,{id:"account.followers",defaultMessage:"Followers"}))),Object(r.a)("div",{className:"accounts-table__count"},void 0,null===a.get("last_status_at")?Object(r.a)(f.b,{id:"account.never_active",defaultMessage:"Never"}):Object(r.a)(L.default,{timestamp:a.get("last_status_at")})," ",Object(r.a)("small",{},void 0,Object(r.a)(f.b,{id:"account.last_status",defaultMessage:"Last active"}))))))},a}(M.a),Object(d.a)(c,"propTypes",{account:y.a.map.isRequired,intl:g.a.object.isRequired,onFollow:g.a.func.isRequired,onBlock:g.a.func.isRequired,onMute:g.a.func.isRequired}),n=i))||n)||n),U=a(14),B=a.n(U);var D,x,H,z=function(e){Object(l.a)(a,e);var t;t=a;function a(){return e.apply(this,arguments)||this}return a.prototype.render=function(){var e=this.props,t=e.name,a=e.value,o=e.checked,n=e.onChange,c=e.label;return(Object(r.a)("label",{className:"radio-button"},void 0,Object(r.a)("input",{name:t,type:"radio",value:a,checked:o,onChange:n}),Object(r.a)("span",{className:B()("radio-button__input",{checked:o})}),Object(r.a)("span",{},void 0,c)))},a}(b.a.PureComponent),J=a(1078),K=a(472);var Y=Object(f.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"}}),G=Object(m.connect)((function(e){return{accountIds:e.getIn(["user_lists","directory","items"],Object(_.List)()),isLoading:e.getIn(["user_lists","directory","isLoading"],!0),domain:e.getIn(["meta","domain"])}}))(D=Object(f.g)((H=x=function(e){Object(l.a)(a,e);var t;t=a;function a(){for(var t,a=arguments.length,o=new Array(a),n=0;n<a;n++)o[n]=arguments[n];return t=e.call.apply(e,[this].concat(o))||this,Object(d.a)(Object(s.a)(t),"state",{order:null,local:null}),Object(d.a)(Object(s.a)(t),"handlePin",(function(){var e=t.props,a=e.columnId,o=e.dispatch;o(a?Object(O.h)(a):Object(O.e)("DIRECTORY",t.getParams(t.props,t.state)))})),Object(d.a)(Object(s.a)(t),"getParams",(function(e,t){return{order:null===t.order?e.params.order||"active":t.order,local:null===t.local?e.params.local||!1:t.local}})),Object(d.a)(Object(s.a)(t),"handleMove",(function(e){var a=t.props,o=a.columnId;(0,a.dispatch)(Object(O.g)(o,e))})),Object(d.a)(Object(s.a)(t),"handleHeaderClick",(function(){t.column.scrollTop()})),Object(d.a)(Object(s.a)(t),"setRef",(function(e){t.column=e})),Object(d.a)(Object(s.a)(t),"handleChangeOrder",(function(e){var a=t.props,o=a.dispatch,n=a.columnId;n?o(Object(O.f)(n,["order"],e.target.value)):t.setState({order:e.target.value})})),Object(d.a)(Object(s.a)(t),"handleChangeLocal",(function(e){var a=t.props,o=a.dispatch,n=a.columnId;n?o(Object(O.f)(n,["local"],"1"===e.target.value)):t.setState({local:"1"===e.target.value})})),Object(d.a)(Object(s.a)(t),"handleLoadMore",(function(){(0,t.props.dispatch)(Object(v.g)(t.getParams(t.props,t.state)))})),t}var o=a.prototype;return o.componentDidMount=function(){(0,this.props.dispatch)(Object(v.h)(this.getParams(this.props,this.state)))},o.componentDidUpdate=function(e,t){var a=this.props.dispatch,o=this.getParams(e,t),n=this.getParams(this.props,this.state);o.order===n.order&&o.local===n.local||a(Object(v.h)(n))},o.render=function(){var e=this.props,t=e.isLoading,a=e.accountIds,o=e.intl,n=e.columnId,c=e.multiColumn,i=e.domain,s=e.shouldUpdateScroll,l=this.getParams(this.props,this.state),d=l.order,u=l.local,m=!!n,f=Object(r.a)("div",{className:"scrollable",style:{background:"transparent"}},void 0,Object(r.a)("div",{className:"filter-form"},void 0,Object(r.a)("div",{className:"filter-form__column",role:"group"},void 0,Object(r.a)(z,{name:"order",value:"active",label:o.formatMessage(Y.recentlyActive),checked:"active"===d,onChange:this.handleChangeOrder}),Object(r.a)(z,{name:"order",value:"new",label:o.formatMessage(Y.newArrivals),checked:"new"===d,onChange:this.handleChangeOrder})),Object(r.a)("div",{className:"filter-form__column",role:"group"},void 0,Object(r.a)(z,{name:"local",value:"1",label:o.formatMessage(Y.local,{domain:i}),checked:u,onChange:this.handleChangeLocal}),Object(r.a)(z,{name:"local",value:"0",label:o.formatMessage(Y.federated),checked:!u,onChange:this.handleChangeLocal}))),Object(r.a)("div",{className:B()("directory__list",{loading:t})},void 0,a.map((function(e){return Object(r.a)(T,{id:e},e)}))),Object(r.a)(J.a,{onClick:this.handleLoadMore,visible:!t}));return b.a.createElement(h.a,{bindToDocument:!c,ref:this.setRef,label:o.formatMessage(Y.title)},Object(r.a)(p.a,{icon:"address-book-o",title:o.formatMessage(Y.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:m,multiColumn:c}),c&&!m?Object(r.a)(K.a,{scrollKey:"directory",shouldUpdateScroll:s},void 0,f):f)},a}(b.a.PureComponent),Object(d.a)(x,"contextTypes",{router:g.a.object}),D=H))||D)||D}}]);
//# sourceMappingURL=directory.js.map