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

2 lines
No EOL
3.5 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{712:function(t,e,n){"use strict";n.r(e);var i,a,c,o,s,r,d,u,l,p=n(1),b=n(6),f=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(35),h=n(58),N=n(64),q=n(33),y=Object(g.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),w=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(b.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(y.remove),onClick:a}):Object(p.a)(N.a,{icon:"plus",title:i.formatMessage(y.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)(q.a,{id:"list-ul",className:"column-link__icon",fixedWidth:!0}),n.get("title")),Object(p.a)("div",{className:"account__relationship"},void 0,t)))},e}(R.a),Object(f.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(f.a)(a,"defaultProps",{added:!1}),i=c))||i)||i,A=n(155),k=n(141),M=n(142),z=Object(_.connect)(function(){var i=Object(A.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(b.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)(k.a,{account:t,size:36})),Object(p.a)(M.a,{account:t}))))},e}(R.a),Object(f.a)(s,"propTypes",{account:m.a.map.isRequired}),o=r))||o)||o,C=n(970);n.d(e,"default",function(){return T});var J=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}),T=Object(_.connect)(function(t){return{listIds:J(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(b.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)(z,{accountId:e})),Object(p.a)(C.a,{}),Object(p.a)("div",{className:"list-adder__lists"},void 0,n.map(function(t){return Object(p.a)(w,{listId:t},t)})))},e}(R.a),Object(f.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