forked from YokaiRick/akkoma
2 lines
No EOL
9.5 KiB
JavaScript
2 lines
No EOL
9.5 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{855: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(762),p=a(759),O=a(253),v=a(207),_=a(4),M=a(21),w=a(16),y=a.n(w),k=a(210),C=a(115),I=a(122),N=a(300),L=a(109),E=a(53),R=a(22),P=a(421),q=a(26),A=a(48),F=a(212);var U=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.v?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(U.unfollowConfirm),onConfirm:function(){return e(Object(q.K)(t.get("id")))}})):e(Object(q.K)(t.get("id"))):e(Object(q.F)(t.get("id")))},onBlock:function(t){t.getIn(["relationship","blocking"])?e(Object(q.J)(t.get("id"))):e(Object(q.w)(t.get("id")))},onMute:function(t){t.getIn(["relationship","muting"])?e(Object(q.L)(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.n&&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(U.requested)}):i?e=Object(r.a)(E.a,{active:!0,icon:"unlock",title:o.formatMessage(U.unblock,{name:a.get("username")}),onClick:this.handleBlock}):s?e=Object(r.a)(E.a,{active:!0,icon:"volume-up",title:o.formatMessage(U.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?U.unfollow:U.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,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),B=a(14),D=a.n(B);var S,x,H,J=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:D()("radio-button__input",{checked:o})}),Object(r.a)("span",{},void 0,c)))},a}(b.a.PureComponent),K=a(1081),z=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"])}}))(S=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)(J,{name:"order",value:"active",label:o.formatMessage(Y.recentlyActive),checked:"active"===d,onChange:this.handleChangeOrder}),Object(r.a)(J,{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)(J,{name:"local",value:"1",label:o.formatMessage(Y.local,{domain:i}),checked:u,onChange:this.handleChangeLocal}),Object(r.a)(J,{name:"local",value:"0",label:o.formatMessage(Y.federated),checked:!u,onChange:this.handleChangeLocal}))),Object(r.a)("div",{className:D()("directory__list",{loading:t})},void 0,a.map((function(e){return Object(r.a)(T,{id:e},e)}))),Object(r.a)(K.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)(z.a,{scrollKey:"directory",shouldUpdateScroll:s},void 0,f):f)},a}(b.a.PureComponent),Object(d.a)(x,"contextTypes",{router:g.a.object}),S=H))||S)||S}}]);
|
|
//# sourceMappingURL=directory.js.map
|