pleroma/priv/static/packs/features/list_adder.js
2020-05-20 07:55:14 +02:00

2 lines
3.6 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[37],{854:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return T}));var i,a,c,o=n(0),r=(n(9),n(6),n(8)),s=n(1),d=(n(3),n(5)),u=n.n(d),l=n(16),p=n.n(l),v=n(15),b=n(21),f=n(7),j=n(31),O=n(57),m=n(53),_=n(27);var R,g,I,h=Object(f.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),N=Object(v.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(j.J)(n))},onAdd:function(){return t(Object(j.A)(n))}}}))(i=Object(f.g)((c=a=function(t){Object(r.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}return n.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(o.a)(m.a,{icon:"times",title:i.formatMessage(h.remove),onClick:a}):Object(o.a)(m.a,{icon:"plus",title:i.formatMessage(h.add),onClick:c}),Object(o.a)("div",{className:"list"},void 0,Object(o.a)("div",{className:"list__wrapper"},void 0,Object(o.a)("div",{className:"list__display-name"},void 0,Object(o.a)(_.a,{id:"list-ul",className:"column-link__icon",fixedWidth:!0}),n.get("title")),Object(o.a)("div",{className:"account__relationship"},void 0,t)))},n}(b.a),Object(s.a)(a,"propTypes",{list:p.a.map.isRequired,intl:u.a.object.isRequired,onRemove:u.a.func.isRequired,onAdd:u.a.func.isRequired,added:u.a.bool}),Object(s.a)(a,"defaultProps",{added:!1}),i=c))||i)||i,q=n(210),y=n(115),w=n(122);var A,k,M,z=Object(v.connect)((function(){var t=Object(q.d)();return function(e,n){var i=n.accountId;return{account:t(e,i)}}}))(R=Object(f.g)((I=g=function(t){Object(r.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}return n.prototype.render=function(){var t=this.props.account;return(Object(o.a)("div",{className:"account"},void 0,Object(o.a)("div",{className:"account__wrapper"},void 0,Object(o.a)("div",{className:"account__display-name"},void 0,Object(o.a)("div",{className:"account__avatar-wrapper"},void 0,Object(o.a)(y.a,{account:t,size:36})),Object(o.a)(w.a,{account:t})))))},n}(b.a),Object(s.a)(g,"propTypes",{account:p.a.map.isRequired}),R=I))||R)||R,C=n(1175);var J=Object(O.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(v.connect)((function(t){return{listIds:J(t).map((function(t){return t.get("id")}))}}),(function(t){return{onInitialize:function(e){return t(Object(j.N)(e))},onReset:function(){return t(Object(j.L)())}}}))(A=Object(f.g)((M=k=function(t){Object(r.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}var i=n.prototype;return i.componentDidMount=function(){var t=this.props;(0,t.onInitialize)(t.accountId)},i.componentWillUnmount=function(){(0,this.props.onReset)()},i.render=function(){var t=this.props,e=t.accountId,n=t.listIds;return(Object(o.a)("div",{className:"modal-root__modal list-adder"},void 0,Object(o.a)("div",{className:"list-adder__account"},void 0,Object(o.a)(z,{accountId:e})),Object(o.a)(C.a,{}),Object(o.a)("div",{className:"list-adder__lists"},void 0,n.map((function(t){return Object(o.a)(N,{listId:t},t)})))))},n}(b.a),Object(s.a)(k,"propTypes",{accountId:u.a.string.isRequired,onClose:u.a.func.isRequired,intl:u.a.object.isRequired,onInitialize:u.a.func.isRequired,onReset:u.a.func.isRequired,listIds:p.a.list.isRequired}),A=M))||A)||A}}]);
//# sourceMappingURL=list_adder.js.map