akkoma/priv/static/packs/modals/report_modal.js
2018-06-02 16:11:38 +02:00

2 lines
11 KiB
JavaScript

webpackJsonp([21],{1016:function(e,t,n){"use strict";var a=n(9),o=n(1017),i=n(155),r=n(8),s=(n.n(r),function(e,t){var n=t.id;return{status:e.getIn(["statuses",n]),checked:e.getIn(["reports","new","status_ids"],Object(r.Set)()).includes(n)}}),c=function(e,t){var n=t.id;return{onToggle:function(t){e(Object(i.m)(n,t.target.checked))}}};t.a=Object(a.connect)(s,c)(o.a)},1017:function(e,t,n){"use strict";n.d(t,"a",function(){return y});var a=n(2),o=n.n(a),i=n(1),r=n.n(i),s=n(3),c=n.n(s),l=n(4),d=n.n(l),u=n(0),h=n.n(u),f=n(882),p=n.n(f),v=n(1018),g=n.n(v),m=n(104),b=n(58),k=n(163),y=function(e){function t(){return r()(this,t),c()(this,e.apply(this,arguments))}return d()(t,e),t.prototype.render=function(){var e=this.props,t=e.status,n=e.checked,a=e.onToggle,i=e.disabled,r=null;if(t.get("reblog"))return null;if(t.get("media_attachments").size>0)if(t.get("media_attachments").some(function(e){return"unknown"===e.get("type")}));else if("video"===t.getIn(["media_attachments",0,"type"])){var s=t.getIn(["media_attachments",0]);r=o()(k.a,{fetchComponent:b.G,loading:this.renderLoadingVideoPlayer},void 0,function(e){return o()(e,{preview:s.get("preview_url"),src:s.get("url"),width:239,height:110,inline:!0,sensitive:t.get("sensitive"),onOpenVideo:g.a})})}else r=o()(k.a,{fetchComponent:b.w,loading:this.renderLoadingMediaGallery},void 0,function(e){return o()(e,{media:t.get("media_attachments"),sensitive:t.get("sensitive"),height:110,onOpenMedia:g.a})});return o()("div",{className:"status-check-box"},void 0,o()("div",{className:"status-check-box__status"},void 0,o()(m.a,{status:t}),r),o()("div",{className:"status-check-box-toggle"},void 0,o()(p.a,{checked:n,onChange:a,disabled:i})))},t}(h.a.PureComponent)},1018:function(e,t){function n(){}e.exports=n},851:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return X});var a,o,i,r,s=n(2),c=n.n(s),l=n(1),d=n.n(l),u=n(3),h=n.n(u),f=n(4),p=n.n(f),v=n(0),g=(n.n(v),n(9)),m=n(155),b=n(19),k=n(5),y=n.n(k),_=n(14),w=n.n(_),C=n(68),O=n(7),j=n(1016),M=n(8),T=(n.n(M),n(12)),S=n.n(T),x=n(100),E=n(882),N=n.n(E),P=n(23),I=Object(O.f)({close:{id:"lightbox.close",defaultMessage:"Close"},placeholder:{id:"report.placeholder",defaultMessage:"Additional comments"},submit:{id:"report.submit",defaultMessage:"Submit"}}),F=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"]),forward:t.getIn(["reports","new","forward"]),statusIds:Object(M.OrderedSet)(t.getIn(["timelines","account:"+n+":with_replies","items"])).union(t.getIn(["reports","new","status_ids"]))}}},X=(a=Object(g.connect)(F))(o=Object(O.g)((r=i=function(e){function t(){var n,a,o;d()(this,t);for(var i=arguments.length,r=Array(i),s=0;s<i;s++)r[s]=arguments[s];return n=a=h()(this,e.call.apply(e,[this].concat(r))),a.handleCommentChange=function(e){a.props.dispatch(Object(m.i)(e.target.value))},a.handleForwardChange=function(e){a.props.dispatch(Object(m.j)(e.target.checked))},a.handleSubmit=function(){a.props.dispatch(Object(m.l)())},o=n,h()(a,o)}return p()(t,e),t.prototype.componentDidMount=function(){this.props.dispatch(Object(b.l)(this.props.account.get("id"),{withReplies:!0}))},t.prototype.componentWillReceiveProps=function(e){this.props.account!==e.account&&e.account&&this.props.dispatch(Object(b.l)(e.account.get("id"),{withReplies:!0}))},t.prototype.render=function(){var e=this.props,t=e.account,n=e.comment,a=e.intl,o=e.statusIds,i=e.isSubmitting,r=e.forward,s=e.onClose;if(!t)return null;var l=t.get("acct").split("@")[1];return c()("div",{className:"modal-root__modal report-modal"},void 0,c()("div",{className:"report-modal__target"},void 0,c()(P.a,{className:"media-modal__close",title:a.formatMessage(I.close),icon:"times",onClick:s,size:16}),c()(O.b,{id:"report.target",defaultMessage:"Report {target}",values:{target:c()("strong",{},void 0,t.get("acct"))}})),c()("div",{className:"report-modal__container"},void 0,c()("div",{className:"report-modal__comment"},void 0,c()("p",{},void 0,c()(O.b,{id:"report.hint",defaultMessage:"The report will be sent to your instance moderators. You can provide an explanation of why you are reporting this account below:"})),c()("textarea",{className:"setting-text light",placeholder:a.formatMessage(I.placeholder),value:n,onChange:this.handleCommentChange,disabled:i}),l&&c()("div",{},void 0,c()("p",{},void 0,c()(O.b,{id:"report.forward_hint",defaultMessage:"The account is from another server. Send an anonymized copy of the report there as well?"})),c()("div",{className:"setting-toggle"},void 0,c()(N.a,{id:"report-forward",checked:r,disabled:i,onChange:this.handleForwardChange}),c()("label",{htmlFor:"report-forward",className:"setting-toggle__label"},void 0,c()(O.b,{id:"report.forward",defaultMessage:"Forward to {target}",values:{target:l}})))),c()(x.a,{disabled:i,text:a.formatMessage(I.submit),onClick:this.handleSubmit})),c()("div",{className:"report-modal__statuses"},void 0,c()("div",{},void 0,o.map(function(e){return c()(j.a,{id:e,disabled:i},e)})))))},t}(S.a),i.propTypes={isSubmitting:y.a.bool,account:w.a.map,statusIds:w.a.orderedSet.isRequired,comment:y.a.string.isRequired,forward:y.a.bool,dispatch:y.a.func.isRequired,intl:y.a.object.isRequired},o=r))||o)||o},882:function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 s(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 c=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},l=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}}(),d=n(0),u=a(d),h=n(10),f=a(h),p=n(5),v=a(p),g=n(883),m=a(g),b=n(884),k=a(b),y=n(885),_=function(e){function t(e){i(this,t);var n=r(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 s(t,e),l(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,o(t,["className","icons"])),i=(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 u.default.createElement("div",{className:i,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},u.default.createElement("div",{className:"react-toggle-track"},u.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),u.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),u.default.createElement("div",{className:"react-toggle-thumb"}),u.default.createElement("input",c({},a,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(d.PureComponent);t.default=_,_.displayName="Toggle",_.defaultProps={icons:{checked:u.default.createElement(m.default,null),unchecked:u.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})])}},883:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(){return o.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},o.default.createElement("title",null,"switch-check"),o.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"}))}},884:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(){return o.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},o.default.createElement("title",null,"switch-x"),o.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"}))}},885: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}});
//# sourceMappingURL=report_modal.js.map