distraction.party/priv/static/packs/features/account_gallery.js
2019-01-31 10:35:44 +01:00

2 lines
No EOL
4.5 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{721:function(a,e,t){"use strict";t.r(e);var r=t(1),o=t(6),s=t(0),n=t(2),c=(t(3),t(20)),i=t(26),l=t.n(i),d=t(5),p=t.n(d),u=t(27),b=t(36),h=t(289),O=t(640),j=t(642),m=t(24),f=t(154),v=t(407),g=t(23),I=function(c){function a(){for(var a,e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return a=c.call.apply(c,[this].concat(t))||this,Object(n.a)(Object(s.a)(Object(s.a)(a)),"state",{visible:"hide_all"!==g.f&&!a.props.media.getIn(["status","sensitive"])||"show_all"===g.f}),Object(n.a)(Object(s.a)(Object(s.a)(a)),"handleClick",function(){return!a.state.visible&&(a.setState({visible:!0}),!0)}),a}return Object(o.a)(a,c),a.prototype.render=function(){var a,e,t=this.props.media,o=this.state.visible,c=t.get("status"),s=100*(t.getIn(["meta","focus","x"])/2+.5),n=100*(t.getIn(["meta","focus","y"])/-2+.5),i={};return"gifv"===t.get("type")&&(a=Object(r.a)("span",{className:"media-gallery__gifv__label"},void 0,"GIF")),o?(i.backgroundImage="url("+t.get("preview_url")+")",i.backgroundPosition=s+"% "+n+"%"):e=Object(r.a)("span",{className:"account-gallery__item__icons"},void 0,Object(r.a)("i",{className:"fa fa-eye-slash"})),Object(r.a)("div",{className:"account-gallery__item"},void 0,Object(r.a)(v.a,{to:"/statuses/"+c.get("id"),href:c.get("url"),style:i,onInterceptClick:this.handleClick},void 0,e,a))},a}(m.a);Object(n.a)(I,"propTypes",{media:l.a.map.isRequired});var y,_,L,M=t(902),w=t(295),S=t(652);t.d(e,"default",function(){return N});var k=function(c){function a(){for(var a,e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return a=c.call.apply(c,[this].concat(t))||this,Object(n.a)(Object(s.a)(Object(s.a)(a)),"handleLoadMore",function(){a.props.onLoadMore(a.props.maxId)}),a}return Object(o.a)(a,c),a.prototype.render=function(){return Object(r.a)(S.a,{disabled:this.props.disabled,onClick:this.handleLoadMore})},a}(m.a);Object(n.a)(k,"propTypes",{shouldUpdateScroll:p.a.func,maxId:p.a.string,onLoadMore:p.a.func.isRequired});var N=Object(c.connect)(function(a,e){return{medias:Object(f.a)(a,e.params.accountId),isLoading:a.getIn(["timelines","account:"+e.params.accountId+":media","isLoading"]),hasMore:a.getIn(["timelines","account:"+e.params.accountId+":media","hasMore"])}})((L=_=function(c){function a(){for(var o,a=arguments.length,e=new Array(a),t=0;t<a;t++)e[t]=arguments[t];return o=c.call.apply(c,[this].concat(e))||this,Object(n.a)(Object(s.a)(Object(s.a)(o)),"handleScrollToBottom",function(){o.props.hasMore&&o.handleLoadMore(0<o.props.medias.size?o.props.medias.last().getIn(["status","id"]):void 0)}),Object(n.a)(Object(s.a)(Object(s.a)(o)),"handleScroll",function(a){var e=a.target,t=e.scrollTop;e.scrollHeight-t-e.clientHeight<150&&!o.props.isLoading&&o.handleScrollToBottom()}),Object(n.a)(Object(s.a)(Object(s.a)(o)),"handleLoadMore",function(a){o.props.dispatch(Object(b.m)(o.props.params.accountId,{maxId:a}))}),Object(n.a)(Object(s.a)(Object(s.a)(o)),"handleLoadOlder",function(a){a.preventDefault(),o.handleScrollToBottom()}),o}Object(o.a)(a,c);var e=a.prototype;return e.componentDidMount=function(){this.props.dispatch(Object(u.A)(this.props.params.accountId)),this.props.dispatch(Object(b.m)(this.props.params.accountId))},e.componentWillReceiveProps=function(a){a.params.accountId!==this.props.params.accountId&&a.params.accountId&&(this.props.dispatch(Object(u.A)(a.params.accountId)),this.props.dispatch(Object(b.m)(this.props.params.accountId)))},e.render=function(){var t=this,a=this.props,o=a.medias,e=a.shouldUpdateScroll,c=a.isLoading,s=a.hasMore,n=null;return!o&&c?Object(r.a)(O.a,{},void 0,Object(r.a)(h.a,{})):(!s||c&&0===o.size||(n=Object(r.a)(S.a,{visible:!c,onClick:this.handleLoadOlder})),Object(r.a)(O.a,{},void 0,Object(r.a)(j.a,{}),Object(r.a)(w.a,{scrollKey:"account_gallery",shouldUpdateScroll:e},void 0,Object(r.a)("div",{className:"scrollable scrollable--flex",onScroll:this.handleScroll},void 0,Object(r.a)(M.a,{accountId:this.props.params.accountId}),Object(r.a)("div",{role:"feed",className:"account-gallery__container"},void 0,o.map(function(a,e){return null===a?Object(r.a)(k,{maxId:0<e?o.getIn(e-1,"id"):null,onLoadMore:t.handleLoadMore},"more:"+o.getIn(e+1,"id")):Object(r.a)(I,{media:a},a.get("id"))}),n),c&&0===o.size&&Object(r.a)("div",{className:"scrollable__append"},void 0,Object(r.a)(h.a,{}))))))},a}(m.a),Object(n.a)(_,"propTypes",{params:p.a.object.isRequired,dispatch:p.a.func.isRequired,medias:l.a.list.isRequired,isLoading:p.a.bool,hasMore:p.a.bool}),y=L))||y}}]);
//# sourceMappingURL=account_gallery.js.map