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

2 lines
No EOL
5 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{716:function(e,t,a){"use strict";a.r(t);var n,c,i,o,r,s,d,u=a(1),l=a(6),b=a(2),p=a(3),j=a.n(p),f=a(5),O=a.n(f),v=a(26),m=a.n(v),h=a(20),g=a(24),_=a(7),y=a(35),I=a(155),R=a(141),C=a(142),N=a(64),w=Object(_.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),q=Object(h.connect)(function(){var c=Object(I.d)();return function(e,t){var a=t.accountId,n=t.added;return{account:c(e,a),added:void 0===n?e.getIn(["listEditor","accounts","items"]).includes(a):n}}},function(e,t){var a=t.accountId;return{onRemove:function(){return e(Object(y.K)(a))},onAdd:function(){return e(Object(y.B)(a))}}})(n=Object(_.g)((i=c=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e,t=this.props,a=t.account,n=t.intl,c=t.onRemove,i=t.onAdd;return e=t.added?Object(u.a)(N.a,{icon:"times",title:n.formatMessage(w.remove),onClick:c}):Object(u.a)(N.a,{icon:"plus",title:n.formatMessage(w.add),onClick:i}),Object(u.a)("div",{className:"account"},void 0,Object(u.a)("div",{className:"account__wrapper"},void 0,Object(u.a)("div",{className:"account__display-name"},void 0,Object(u.a)("div",{className:"account__avatar-wrapper"},void 0,Object(u.a)(R.a,{account:a,size:36})),Object(u.a)(C.a,{account:a})),Object(u.a)("div",{className:"account__relationship"},void 0,e)))},t}(g.a),Object(b.a)(c,"propTypes",{account:m.a.map.isRequired,intl:O.a.object.isRequired,onRemove:O.a.func.isRequired,onAdd:O.a.func.isRequired,added:O.a.bool}),Object(b.a)(c,"defaultProps",{added:!1}),n=i))||n)||n,M=a(0),k=a(12),A=a.n(k),E=a(33),x=Object(_.f)({search:{id:"lists.search",defaultMessage:"Search among people you follow"}}),z=Object(h.connect)(function(e){return{value:e.getIn(["listEditor","suggestions","value"])}},function(t){return{onSubmit:function(e){return t(Object(y.H)(e))},onClear:function(){return t(Object(y.E)())},onChange:function(e){return t(Object(y.D)(e))}}})(o=Object(_.g)(o=function(c){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=c.call.apply(c,[this].concat(a))||this,Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleChange",function(e){t.props.onChange(e.target.value)}),Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleKeyUp",function(e){13===e.keyCode&&t.props.onSubmit(t.props.value)}),Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleClear",function(){t.props.onClear()}),t}return Object(l.a)(e,c),e.prototype.render=function(){var e=this.props,t=e.value,a=e.intl,n=0<t.length;return Object(u.a)("div",{className:"list-editor__search search"},void 0,Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,a.formatMessage(x.search)),Object(u.a)("input",{className:"search__input",type:"text",value:t,onChange:this.handleChange,onKeyUp:this.handleKeyUp,placeholder:a.formatMessage(x.search)})),Object(u.a)("div",{role:"button",tabIndex:"0",className:"search__icon",onClick:this.handleClear},void 0,Object(u.a)(E.a,{id:"search",className:A()({active:!n})}),Object(u.a)(E.a,{id:"times-circle","aria-label":a.formatMessage(x.search),className:A()({active:n})})))},e}(j.a.PureComponent))||o)||o,K=a(140),S=a(46),U=a.n(S);a.d(t,"default",function(){return D});var D=Object(h.connect)(function(e){return{title:e.getIn(["listEditor","title"]),accountIds:e.getIn(["listEditor","accounts","items"]),searchAccountIds:e.getIn(["listEditor","suggestions","items"])}},function(t){return{onInitialize:function(e){return t(Object(y.O)(e))},onClear:function(){return t(Object(y.E)())},onReset:function(){return t(Object(y.M)())}}})(r=Object(_.g)((d=s=function(e){function t(){return e.apply(this,arguments)||this}Object(l.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=this.props;(0,e.onInitialize)(e.listId)},a.componentWillUnmount=function(){(0,this.props.onReset)()},a.render=function(){var e=this.props,t=e.title,a=e.accountIds,n=e.searchAccountIds,c=e.onClear,i=0<n.size;return Object(u.a)("div",{className:"modal-root__modal list-editor"},void 0,Object(u.a)("h4",{},void 0,t),Object(u.a)(z,{}),Object(u.a)("div",{className:"drawer__pager"},void 0,Object(u.a)("div",{className:"drawer__inner list-editor__accounts"},void 0,a.map(function(e){return Object(u.a)(q,{accountId:e,added:!0},e)})),i&&Object(u.a)("div",{role:"button",tabIndex:"-1",className:"drawer__backdrop",onClick:c}),Object(u.a)(K.a,{defaultStyle:{x:-100},style:{x:U()(i?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return Object(u.a)("div",{className:"drawer__inner backdrop",style:{transform:0===t?null:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,n.map(function(e){return Object(u.a)(q,{accountId:e},e)}))})))},t}(g.a),Object(b.a)(s,"propTypes",{listId:O.a.string.isRequired,onClose:O.a.func.isRequired,intl:O.a.object.isRequired,onInitialize:O.a.func.isRequired,onClear:O.a.func.isRequired,onReset:O.a.func.isRequired,title:O.a.string.isRequired,accountIds:m.a.list.isRequired,searchAccountIds:m.a.list.isRequired}),r=d))||r)||r}}]);
//# sourceMappingURL=list_editor.js.map