pleroma/priv/static/packs/features/list_adder.js

2 lines
3.5 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{711:function(t,e,n){"use strict";n.r(e);var i,a,c,o,s,r,d,u,l,p=n(1),f=n(6),b=n(2),v=(n(3),n(5)),j=n.n(v),O=n(26),m=n.n(O),_=n(20),R=n(24),g=n(7),I=n(34),h=n(57),N=n(63),q=Object(g.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),y=Object(_.connect)(function(t,e){var n=e.listId,i=e.added;return{list:t.get("lists").get(n),added:void 0===i?t.getIn(["listAdder","lists","items"]).includes(n):i}},function(t,e){var n=e.listId;return{onRemove:function(){return t(Object(I.J)(n))},onAdd:function(){return t(Object(I.A)(n))}}})(i=Object(g.g)((c=a=function(t){function e(){return t.apply(this,arguments)||this}return Object(f.a)(e,t),e.prototype.render=function(){var t,e=this.props,n=e.list,i=e.intl,a=e.onRemove,c=e.onAdd;return t=e.added?Object(p.a)(N.a,{icon:"times",title:i.formatMessage(q.remove),onClick:a}):Object(p.a)(N.a,{icon:"plus",title:i.formatMessage(q.add),onClick:c}),Object(p.a)("div",{className:"list"},void 0,Object(p.a)("div",{className:"list__wrapper"},void 0,Object(p.a)("div",{className:"list__display-name"},void 0,Object(p.a)("i",{className:"fa fa-fw fa-list-ul column-link__icon"}),n.get("title")),Object(p.a)("div",{className:"account__relationship"},void 0,t)))},e}(R.a),Object(b.a)(a,"propTypes",{list:m.a.map.isRequired,intl:j.a.object.isRequired,onRemove:j.a.func.isRequired,onAdd:j.a.func.isRequired,added:j.a.bool}),Object(b.a)(a,"defaultProps",{added:!1}),i=c))||i)||i,w=n(154),A=n(140),k=n(141),M=Object(_.connect)(function(){var i=Object(w.d)();return function(t,e){var n=e.accountId;return{account:i(t,n)}}})(o=Object(g.g)((r=s=function(t){function e(){return t.apply(this,arguments)||this}return Object(f.a)(e,t),e.prototype.render=function(){var t=this.props.account;return Object(p.a)("div",{className:"account"},void 0,Object(p.a)("div",{className:"account__wrapper"},void 0,Object(p.a)("div",{className:"account__display-name"},void 0,Object(p.a)("div",{className:"account__avatar-wrapper"},void 0,Object(p.a)(A.a,{account:t,size:36})),Object(p.a)(k.a,{account:t}))))},e}(R.a),Object(b.a)(s,"propTypes",{account:m.a.map.isRequired}),o=r))||o)||o,z=n(969);n.d(e,"default",function(){return J});var C=Object(h.a)([function(t){return t.get("lists")}],function(t){return t?t.toList().filter(function(t){return!!t}).sort(function(t,e){return t.get("title").localeCompare(e.get("title"))}):t}),J=Object(_.connect)(function(t){return{listIds:C(t).map(function(t){return t.get("id")})}},function(e){return{onInitialize:function(t){return e(Object(I.N)(t))},onReset:function(){return e(Object(I.L)())}}})(d=Object(g.g)((l=u=function(t){function e(){return t.apply(this,arguments)||this}Object(f.a)(e,t);var n=e.prototype;return n.componentDidMount=function(){var t=this.props;(0,t.onInitialize)(t.accountId)},n.componentWillUnmount=function(){(0,this.props.onReset)()},n.render=function(){var t=this.props,e=t.accountId,n=t.listIds;return Object(p.a)("div",{className:"modal-root__modal list-adder"},void 0,Object(p.a)("div",{className:"list-adder__account"},void 0,Object(p.a)(M,{accountId:e})),Object(p.a)(z.a,{}),Object(p.a)("div",{className:"list-adder__lists"},void 0,n.map(function(t){return Object(p.a)(y,{listId:t},t)})))},e}(R.a),Object(b.a)(u,"propTypes",{accountId:j.a.string.isRequired,onClose:j.a.func.isRequired,intl:j.a.object.isRequired,onInitialize:j.a.func.isRequired,onReset:j.a.func.isRequired,listIds:m.a.list.isRequired}),d=l))||d)||d}}]);
//# sourceMappingURL=list_adder.js.map