spc-pleroma/priv/static/packs/features/account_gallery.js

2 lines
4.4 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{711:function(a,e,t){"use strict";t.r(e);var r=t(0),n=t(3),o=t(7),s=t(1),c=(t(2),t(24)),i=t(27),l=t.n(i),d=t(5),p=t.n(d),u=t(26),b=t(35),h=t(272),m=t(625),O=t(628),j=t(25),f=t(199),v=t(378),g=t(23),I=t(30),y=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(s.a)(Object(n.a)(a),"state",{visible:"hide_all"!==g.f&&!a.props.media.getIn(["status","sensitive"])||"show_all"===g.f}),Object(s.a)(Object(n.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"),n=100*(t.getIn(["meta","focus","x"])/2+.5),s=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=n+"% "+s+"%"):e=Object(r.a)("span",{className:"account-gallery__item__icons"},void 0,Object(r.a)(I.a,{id:"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}(j.a);Object(s.a)(y,"propTypes",{media:l.a.map.isRequired});var _,L,M,w=t(913),S=t(426),k=t(981);t.d(e,"default",function(){return x});var T=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(s.a)(Object(n.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)(k.a,{disabled:this.props.disabled,onClick:this.handleLoadMore})},a}(j.a);Object(s.a)(T,"propTypes",{shouldUpdateScroll:p.a.func,maxId:p.a.string,onLoadMore:p.a.func.isRequired});var x=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"])}})((M=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(s.a)(Object(n.a)(o),"handleScrollToBottom",function(){o.props.hasMore&&o.handleLoadMore(0<o.props.medias.size?o.props.medias.last().getIn(["status","id"]):void 0)}),Object(s.a)(Object(n.a)(o),"handleScroll",function(a){var e=a.target,t=e.scrollTop;e.scrollHeight-t-e.clientHeight<150&&!o.props.isLoading&&o.handleScrollToBottom()}),Object(s.a)(Object(n.a)(o),"handleLoadMore",function(a){o.props.dispatch(Object(b.o)(o.props.params.accountId,{maxId:a}))}),Object(s.a)(Object(n.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.o)(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.o)(this.props.params.accountId)))},e.render=function(){var t=this,a=this.props,o=a.medias,e=a.shouldUpdateScroll,c=a.isLoading,n=a.hasMore,s=null;return!o&&c?Object(r.a)(m.a,{},void 0,Object(r.a)(h.a,{})):(!n||c&&0===o.size||(s=Object(r.a)(k.a,{visible:!c,onClick:this.handleLoadOlder})),Object(r.a)(m.a,{},void 0,Object(r.a)(O.a,{}),Object(r.a)(S.a,{scrollKey:"account_gallery",shouldUpdateScroll:e},void 0,Object(r.a)("div",{className:"scrollable scrollable--flex",onScroll:this.handleScroll},void 0,Object(r.a)(w.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)(T,{maxId:0<e?o.getIn(e-1,"id"):null,onLoadMore:t.handleLoadMore},"more:"+o.getIn(e+1,"id")):Object(r.a)(y,{media:a},a.get("id"))}),s),c&&0===o.size&&Object(r.a)("div",{className:"scrollable__append"},void 0,Object(r.a)(h.a,{}))))))},a}(j.a),Object(s.a)(L,"propTypes",{params:p.a.object.isRequired,dispatch:p.a.func.isRequired,medias:l.a.list.isRequired,isLoading:p.a.bool,hasMore:p.a.bool}),_=M))||_}}]);
//# sourceMappingURL=account_gallery.js.map