pleroma/priv/static/packs/modals/report_modal-7a2950f40d4867...

2 lines
9.6 KiB
JavaScript

webpackJsonp([17],{773:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return P});var a,c,o,i,r=n(2),s=n.n(r),u=n(1),l=n.n(u),d=n(3),h=n.n(d),f=n(4),p=n.n(f),v=n(0),m=(n.n(v),n(9)),g=n(151),b=n(16),k=n(5),y=n.n(k),_=n(12),O=n.n(_),C=n(69),j=n(6),w=n(901),S=n(8),T=(n.n(S),n(11)),E=n.n(T),M=n(101),N=Object(j.f)({placeholder:{id:"report.placeholder",defaultMessage:"Additional comments"},submit:{id:"report.submit",defaultMessage:"Submit"}}),x=function(){var e=Object(C.c)();return function(t){var n=t.getIn(["reports","new","account_id"]);return{isSubmitting:t.getIn(["reports","new","isSubmitting"]),account:e(t,n),comment:t.getIn(["reports","new","comment"]),statusIds:Object(S.OrderedSet)(t.getIn(["timelines","account:"+n,"items"])).union(t.getIn(["reports","new","status_ids"]))}}},P=(a=Object(m.connect)(x))(c=Object(j.g)((i=o=function(e){function t(){var n,a,c;l()(this,t);for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];return n=a=h()(this,e.call.apply(e,[this].concat(i))),a.handleCommentChange=function(e){a.props.dispatch(Object(g.h)(e.target.value))},a.handleSubmit=function(){a.props.dispatch(Object(g.j)())},c=n,h()(a,c)}return p()(t,e),t.prototype.componentDidMount=function(){this.props.dispatch(Object(b.w)(this.props.account.get("id")))},t.prototype.componentWillReceiveProps=function(e){this.props.account!==e.account&&e.account&&this.props.dispatch(Object(b.w)(e.account.get("id")))},t.prototype.render=function(){var e=this.props,t=e.account,n=e.comment,a=e.intl,c=e.statusIds,o=e.isSubmitting;return t?s()("div",{className:"modal-root__modal report-modal"},void 0,s()("div",{className:"report-modal__target"},void 0,s()(j.b,{id:"report.target",defaultMessage:"Report {target}",values:{target:s()("strong",{},void 0,t.get("acct"))}})),s()("div",{className:"report-modal__container"},void 0,s()("div",{className:"report-modal__statuses"},void 0,s()("div",{},void 0,c.map(function(e){return s()(w.a,{id:e,disabled:o},e)}))),s()("div",{className:"report-modal__comment"},void 0,s()("textarea",{className:"setting-text light",placeholder:a.formatMessage(N.placeholder),value:n,onChange:this.handleCommentChange,disabled:o}))),s()("div",{className:"report-modal__action-bar"},void 0,s()(M.a,{disabled:o,text:a.formatMessage(N.submit),onClick:this.handleSubmit}))):null},t}(E.a),o.propTypes={isSubmitting:y.a.bool,account:O.a.map,statusIds:O.a.orderedSet.isRequired,comment:y.a.string.isRequired,dispatch:y.a.func.isRequired,intl:y.a.object.isRequired},c=i))||c)||c},790:function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),l=n(0),d=a(l),h=n(10),f=a(h),p=n(5),v=a(p),m=n(791),g=a(m),b=n(792),k=a(b),y=n(793),_=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleClick=n.handleClick.bind(n),n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchMove=n.handleTouchMove.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.previouslyChecked=!(!e.checked&&!e.defaultChecked),n.state={checked:!(!e.checked&&!e.defaultChecked),hasFocus:!1},n}return r(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){"checked"in e&&this.setState({checked:!!e.checked})}},{key:"handleClick",value:function(e){var t=this.input;if(e.target!==t&&!this.moved)return this.previouslyChecked=t.checked,e.preventDefault(),t.focus(),void t.click();var n=this.props.hasOwnProperty("checked")?this.props.checked:t.checked;this.setState({checked:n})}},{key:"handleTouchStart",value:function(e){this.startX=(0,y.pointerCoord)(e).x,this.activated=!0}},{key:"handleTouchMove",value:function(e){if(this.activated&&(this.moved=!0,this.startX)){var t=(0,y.pointerCoord)(e).x;this.state.checked&&t+15<this.startX?(this.setState({checked:!1}),this.startX=t,this.activated=!0):t-15>this.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=t<this.startX+5)}}},{key:"handleTouchEnd",value:function(e){if(this.moved){var t=this.input;if(e.preventDefault(),this.startX){var n=(0,y.pointerCoord)(e).x;!0===this.previouslyChecked&&this.startX+4>n?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4<n&&this.previouslyChecked!==this.state.checked&&(this.setState({checked:!0}),this.previouslyChecked=this.state.checked,t.click()),this.activated=!1,this.startX=null,this.moved=!1}}}},{key:"handleFocus",value:function(e){var t=this.props.onFocus;t&&t(e),this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(e){var t=this.props.onBlur;t&&t(e),this.setState({hasFocus:!1})}},{key:"getIcon",value:function(e){var n=this.props.icons;return n?void 0===n[e]?t.defaultProps.icons[e]:n[e]:null}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,a=(t.icons,c(t,["className","icons"])),o=(0,f.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},n);return d.default.createElement("div",{className:o,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},d.default.createElement("div",{className:"react-toggle-track"},d.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),d.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),d.default.createElement("div",{className:"react-toggle-thumb"}),d.default.createElement("input",s({},a,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(l.PureComponent);t.default=_,_.displayName="Toggle",_.defaultProps={icons:{checked:d.default.createElement(g.default,null),unchecked:d.default.createElement(k.default,null)}},_.propTypes={checked:v.default.bool,disabled:v.default.bool,defaultChecked:v.default.bool,onChange:v.default.func,onFocus:v.default.func,onBlur:v.default.func,className:v.default.string,name:v.default.string,value:v.default.string,id:v.default.string,"aria-labelledby":v.default.string,"aria-label":v.default.string,icons:v.default.oneOfType([v.default.bool,v.default.shape({checked:v.default.node,unchecked:v.default.node})])}},791:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),c=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(){return c.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},c.default.createElement("title",null,"switch-check"),c.default.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}))}},792:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),c=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(){return c.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},c.default.createElement("title",null,"switch-x"),c.default.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"}))}},793:function(e,t,n){"use strict";function a(e){if(e){var t=e.changedTouches;if(t&&t.length>0){var n=t[0];return{x:n.clientX,y:n.clientY}}var a=e.pageX;if(void 0!==a)return{x:a,y:e.pageY}}return{x:0,y:0}}Object.defineProperty(t,"__esModule",{value:!0}),t.pointerCoord=a},901:function(e,t,n){"use strict";var a=n(9),c=n(902),o=n(151),i=n(8),r=(n.n(i),function(e,t){var n=t.id;return{status:e.getIn(["statuses",n]),checked:e.getIn(["reports","new","status_ids"],Object(i.Set)()).includes(n)}}),s=function(e,t){var n=t.id;return{onToggle:function(t){e(Object(o.k)(n,t.target.checked))}}};t.a=Object(a.connect)(r,s)(c.a)},902:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var a=n(2),c=n.n(a),o=n(1),i=n.n(o),r=n(3),s=n.n(r),u=n(4),l=n.n(u),d=n(0),h=n.n(d),f=n(790),p=n.n(f),v=function(e){function t(){return i()(this,t),s()(this,e.apply(this,arguments))}return l()(t,e),t.prototype.render=function(){var e=this.props,t=e.status,n=e.checked,a=e.onToggle,o=e.disabled,i={__html:t.get("contentHtml")};return t.get("reblog")?null:c()("div",{className:"status-check-box"},void 0,c()("div",{className:"status__content",dangerouslySetInnerHTML:i}),c()("div",{className:"status-check-box-toggle"},void 0,c()(p.a,{checked:n,onChange:a,disabled:o})))},t}(h.a.PureComponent)}});
//# sourceMappingURL=report_modal-7a2950f40d4867b9cbb0.js.map