akkoma/priv/static/packs/features/directory.js
2020-01-22 16:00:23 +01:00

2 lines
No EOL
9.4 KiB
JavaScript

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