pleroma/priv/static/packs/features/notifications.js
2020-05-20 07:55:14 +02:00

2 lines
No EOL
25 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[42],{834:function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return pt}));var o,a,n,s=i(0),c=i(2),l=(i(9),i(6),i(8)),r=i(1),d=i(65),u=i.n(d),f=i(3),b=i.n(f),h=i(15),g=i(762),p=i(759),O=i(55),j=i(253),v=i(210),m=i(16),_=i.n(m),M=i(7),w=i(301),C=i(5),y=i.n(C),P=i(21),k=i(22),N=i(1080),x=i(1053),I=i(115),q=i(122),S=i(300),F=i(53);var R,W,H,T=Object(M.f)({authorize:{id:"follow_request.authorize",defaultMessage:"Authorize"},reject:{id:"follow_request.reject",defaultMessage:"Reject"}}),D=Object(M.g)((n=a=function(t){Object(l.a)(i,t);var e;e=i;function i(){return t.apply(this,arguments)||this}return i.prototype.render=function(){var t=this.props,e=t.intl,i=t.hidden,o=t.account,a=t.onAuthorize,n=t.onReject;return o?i?Object(s.a)(f.Fragment,{},void 0,o.get("display_name"),o.get("username")):Object(s.a)("div",{className:"account"},void 0,Object(s.a)("div",{className:"account__wrapper"},void 0,Object(s.a)(S.a,{className:"account__display-name",title:o.get("acct"),href:o.get("url"),to:"/accounts/"+o.get("id")},o.get("id"),Object(s.a)("div",{className:"account__avatar-wrapper"},void 0,Object(s.a)(I.a,{account:o,size:36})),Object(s.a)(q.a,{account:o})),Object(s.a)("div",{className:"account__relationship"},void 0,Object(s.a)(F.a,{title:e.formatMessage(T.authorize),icon:"check",onClick:a}),Object(s.a)(F.a,{title:e.formatMessage(T.reject),icon:"times",onClick:n})))):Object(s.a)("div",{})},i}(P.a),Object(r.a)(a,"propTypes",{account:_.a.map.isRequired,onAuthorize:y.a.func.isRequired,onReject:y.a.func.isRequired,intl:y.a.object.isRequired}),o=n))||o,L=i(26),B=Object(h.connect)((function(){var t=Object(v.d)();return function(e,i){return{account:t(e,i.id)}}}),(function(t,e){var i=e.id;return{onAuthorize:function(){t(Object(L.v)(i))},onReject:function(){t(Object(L.I)(i))}}}))(D),U=i(27);var A=Object(M.f)({favourite:{id:"notification.favourite",defaultMessage:"{name} favourited your status"},follow:{id:"notification.follow",defaultMessage:"{name} followed you"},ownPoll:{id:"notification.own_poll",defaultMessage:"Your poll has ended"},poll:{id:"notification.poll",defaultMessage:"A poll you have voted in has ended"},reblog:{id:"notification.reblog",defaultMessage:"{name} boosted your status"}}),z=function(t,e,i){var o=[e];return o.push(t.formatDate(i,{hour:"2-digit",minute:"2-digit",month:"short",day:"numeric"})),o.join(", ")},K=Object(M.g)((H=W=function(t){Object(l.a)(i,t);var e;e=i;function i(){for(var e,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return e=t.call.apply(t,[this].concat(o))||this,Object(r.a)(Object(c.a)(e),"handleMoveUp",(function(){var t=e.props,i=t.notification;(0,t.onMoveUp)(i.get("id"))})),Object(r.a)(Object(c.a)(e),"handleMoveDown",(function(){var t=e.props,i=t.notification;(0,t.onMoveDown)(i.get("id"))})),Object(r.a)(Object(c.a)(e),"handleOpen",(function(){var t=e.props.notification;t.get("status")?e.context.router.history.push("/statuses/"+t.get("status")):e.handleOpenProfile()})),Object(r.a)(Object(c.a)(e),"handleOpenProfile",(function(){var t=e.props.notification;e.context.router.history.push("/accounts/"+t.getIn(["account","id"]))})),Object(r.a)(Object(c.a)(e),"handleMention",(function(t){t.preventDefault();var i=e.props,o=i.notification;(0,i.onMention)(o.get("account"),e.context.router.history)})),Object(r.a)(Object(c.a)(e),"handleHotkeyFavourite",(function(){var t=e.props.status;t&&e.props.onFavourite(t)})),Object(r.a)(Object(c.a)(e),"handleHotkeyBoost",(function(t){var i=e.props.status;i&&e.props.onReblog(i,t)})),Object(r.a)(Object(c.a)(e),"handleHotkeyToggleHidden",(function(){var t=e.props.status;t&&e.props.onToggleHidden(t)})),e}var o=i.prototype;return o.getHandlers=function(){return{reply:this.handleMention,favourite:this.handleHotkeyFavourite,boost:this.handleHotkeyBoost,mention:this.handleMention,open:this.handleOpen,openProfile:this.handleOpenProfile,moveUp:this.handleMoveUp,moveDown:this.handleMoveDown,toggleHidden:this.handleHotkeyToggleHidden}},o.renderFollow=function(t,e,i){var o=this.props.intl;return(Object(s.a)(w.HotKeys,{handlers:this.getHandlers()},void 0,Object(s.a)("div",{className:"notification notification-follow focusable",tabIndex:"0","aria-label":z(o,o.formatMessage(A.follow,{name:e.get("acct")}),t.get("created_at"))},void 0,Object(s.a)("div",{className:"notification__message"},void 0,Object(s.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(s.a)(U.a,{id:"user-plus",fixedWidth:!0})),Object(s.a)("span",{title:t.get("created_at")},void 0,Object(s.a)(M.b,{id:"notification.follow",defaultMessage:"{name} followed you",values:{name:i}}))),Object(s.a)(x.a,{id:e.get("id"),hidden:this.props.hidden}))))},o.renderFollowRequest=function(t,e,i){var o=this.props.intl;return(Object(s.a)(w.HotKeys,{handlers:this.getHandlers()},void 0,Object(s.a)("div",{className:"notification notification-follow-request focusable",tabIndex:"0","aria-label":z(o,o.formatMessage({id:"notification.follow_request",defaultMessage:"{name} has requested to follow you"},{name:e.get("acct")}),t.get("created_at"))},void 0,Object(s.a)("div",{className:"notification__message"},void 0,Object(s.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(s.a)(U.a,{id:"user",fixedWidth:!0})),Object(s.a)("span",{title:t.get("created_at")},void 0,Object(s.a)(M.b,{id:"notification.follow_request",defaultMessage:"{name} has requested to follow you",values:{name:i}}))),Object(s.a)(B,{id:e.get("id"),withNote:!1,hidden:this.props.hidden}))))},o.renderMention=function(t){return Object(s.a)(N.a,{id:t.get("status"),withDismiss:!0,hidden:this.props.hidden,onMoveDown:this.handleMoveDown,onMoveUp:this.handleMoveUp,contextType:"notifications",getScrollPosition:this.props.getScrollPosition,updateScrollBottom:this.props.updateScrollBottom,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth})},o.renderFavourite=function(t,e){var i=this.props.intl;return(Object(s.a)(w.HotKeys,{handlers:this.getHandlers()},void 0,Object(s.a)("div",{className:"notification notification-favourite focusable",tabIndex:"0","aria-label":z(i,i.formatMessage(A.favourite,{name:t.getIn(["account","acct"])}),t.get("created_at"))},void 0,Object(s.a)("div",{className:"notification__message"},void 0,Object(s.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(s.a)(U.a,{id:"star",className:"star-icon",fixedWidth:!0})),Object(s.a)("span",{title:t.get("created_at")},void 0,Object(s.a)(M.b,{id:"notification.favourite",defaultMessage:"{name} favourited your status",values:{name:e}}))),Object(s.a)(N.a,{id:t.get("status"),account:t.get("account"),muted:!0,withDismiss:!0,hidden:!!this.props.hidden,getScrollPosition:this.props.getScrollPosition,updateScrollBottom:this.props.updateScrollBottom,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth}))))},o.renderReblog=function(t,e){var i=this.props.intl;return(Object(s.a)(w.HotKeys,{handlers:this.getHandlers()},void 0,Object(s.a)("div",{className:"notification notification-reblog focusable",tabIndex:"0","aria-label":z(i,i.formatMessage(A.reblog,{name:t.getIn(["account","acct"])}),t.get("created_at"))},void 0,Object(s.a)("div",{className:"notification__message"},void 0,Object(s.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(s.a)(U.a,{id:"retweet",fixedWidth:!0})),Object(s.a)("span",{title:t.get("created_at")},void 0,Object(s.a)(M.b,{id:"notification.reblog",defaultMessage:"{name} boosted your status",values:{name:e}}))),Object(s.a)(N.a,{id:t.get("status"),account:t.get("account"),muted:!0,withDismiss:!0,hidden:this.props.hidden,getScrollPosition:this.props.getScrollPosition,updateScrollBottom:this.props.updateScrollBottom,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth}))))},o.renderPoll=function(t,e){var i=this.props.intl,o=k.n===e.get("id"),a=o?i.formatMessage(A.ownPoll):i.formatMessage(A.poll);return Object(s.a)(w.HotKeys,{handlers:this.getHandlers()},void 0,Object(s.a)("div",{className:"notification notification-poll focusable",tabIndex:"0","aria-label":z(i,a,t.get("created_at"))},void 0,Object(s.a)("div",{className:"notification__message"},void 0,Object(s.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(s.a)(U.a,{id:"tasks",fixedWidth:!0})),Object(s.a)("span",{title:t.get("created_at")},void 0,o?Object(s.a)(M.b,{id:"notification.own_poll",defaultMessage:"Your poll has ended"}):Object(s.a)(M.b,{id:"notification.poll",defaultMessage:"A poll you have voted in has ended"}))),Object(s.a)(N.a,{id:t.get("status"),account:e,muted:!0,withDismiss:!0,hidden:this.props.hidden,getScrollPosition:this.props.getScrollPosition,updateScrollBottom:this.props.updateScrollBottom,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth})))},o.render=function(){var t=this.props.notification,e=t.get("account"),i={__html:e.get("display_name_html")},o=Object(s.a)("bdi",{},void 0,Object(s.a)(S.a,{className:"notification__display-name",href:e.get("url"),title:e.get("acct"),to:"/accounts/"+e.get("id"),dangerouslySetInnerHTML:i}));switch(t.get("type")){case"follow":return this.renderFollow(t,e,o);case"follow_request":return this.renderFollowRequest(t,e,o);case"mention":return this.renderMention(t);case"favourite":return this.renderFavourite(t,o);case"reblog":return this.renderReblog(t,o);case"poll":return this.renderPoll(t,e)}return null},i}(P.a),Object(r.a)(W,"contextTypes",{router:y.a.object}),Object(r.a)(W,"propTypes",{notification:_.a.map.isRequired,hidden:y.a.bool,onMoveUp:y.a.func.isRequired,onMoveDown:y.a.func.isRequired,onMention:y.a.func.isRequired,onFavourite:y.a.func.isRequired,onReblog:y.a.func.isRequired,onToggleHidden:y.a.func.isRequired,status:_.a.map,intl:y.a.object.isRequired,getScrollPosition:y.a.func,updateScrollBottom:y.a.func,cacheMediaWidth:y.a.func,cachedMediaWidth:y.a.number}),R=H))||R,Y=i(48),G=i(23),J=i(46),V=i(89),E=Object(h.connect)((function(){var t=Object(v.e)(),e=Object(v.f)();return function(i,o){var a=t(i,o.notification,o.accountId);return{notification:a,status:a.get("status")?e(i,{id:a.get("status")}):null}}}),(function(t){return{onMention:function(e,i){t(Object(G.cb)(e,i))},onModalReblog:function(e){t(Object(J.t)(e))},onReblog:function(e,i){e.get("reblogged")?t(Object(J.x)(e)):i.shiftKey||!k.b?this.onModalReblog(e):t(Object(Y.d)("BOOST",{status:e,onReblog:this.onModalReblog}))},onFavourite:function(e){e.get("favourited")?t(Object(J.v)(e)):t(Object(J.p)(e))},onToggleHidden:function(e){e.get("hidden")?t(Object(V.l)(e.get("id"))):t(Object(V.j)(e.get("id")))}}}))(K);var Q=function(t){Object(l.a)(i,t);var e;e=i;function i(){return t.apply(this,arguments)||this}return i.prototype.render=function(){return Object(s.a)("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.props.onClick},void 0,Object(s.a)(U.a,{id:"eraser"})," ",Object(s.a)(M.b,{id:"notifications.clear",defaultMessage:"Clear notifications"}))},i}(b.a.PureComponent),X=i(1107);var Z,$=function(t){Object(l.a)(i,t);var e;e=i;function i(){for(var e,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return e=t.call.apply(t,[this].concat(o))||this,Object(r.a)(Object(c.a)(e),"onPushChange",(function(t,i){e.props.onChange(["push"].concat(t),i)})),e}return i.prototype.render=function(){var t=this.props,e=t.settings,i=t.pushSettings,o=t.onChange,a=t.onClear,n=Object(s.a)(M.b,{id:"notifications.column_settings.filter_bar.show",defaultMessage:"Show"}),c=Object(s.a)(M.b,{id:"notifications.column_settings.filter_bar.advanced",defaultMessage:"Display all categories"}),l=Object(s.a)(M.b,{id:"notifications.column_settings.alert",defaultMessage:"Desktop notifications"}),r=Object(s.a)(M.b,{id:"notifications.column_settings.show",defaultMessage:"Show in column"}),d=Object(s.a)(M.b,{id:"notifications.column_settings.sound",defaultMessage:"Play sound"}),u=i.get("browserSupport")&&i.get("isSubscribed"),f=u&&Object(s.a)(M.b,{id:"notifications.column_settings.push",defaultMessage:"Push notifications"});return Object(s.a)("div",{},void 0,Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(Q,{onClick:a})),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-filter-bar"},void 0,Object(s.a)("span",{id:"notifications-filter-bar",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.filter_bar.category",defaultMessage:"Quick filter bar"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","show"],onChange:o,label:n}),Object(s.a)(X.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","advanced"],onChange:o,label:c}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-follow"},void 0,Object(s.a)("span",{id:"notifications-follow",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.follow",defaultMessage:"New followers:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","follow"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","follow"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow"],onChange:o,label:d}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-follow-request"},void 0,Object(s.a)("span",{id:"notifications-follow-request",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.follow_request",defaultMessage:"New follow requests:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow_request"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","follow_request"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","follow_request"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow_request"],onChange:o,label:d}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-favourite"},void 0,Object(s.a)("span",{id:"notifications-favourite",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.favourite",defaultMessage:"Favourites:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","favourite"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","favourite"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","favourite"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","favourite"],onChange:o,label:d}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-mention"},void 0,Object(s.a)("span",{id:"notifications-mention",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.mention",defaultMessage:"Mentions:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","mention"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","mention"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","mention"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","mention"],onChange:o,label:d}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-reblog"},void 0,Object(s.a)("span",{id:"notifications-reblog",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.reblog",defaultMessage:"Boosts:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","reblog"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","reblog"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","reblog"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","reblog"],onChange:o,label:d}))),Object(s.a)("div",{role:"group","aria-labelledby":"notifications-poll"},void 0,Object(s.a)("span",{id:"notifications-poll",className:"column-settings__section"},void 0,Object(s.a)(M.b,{id:"notifications.column_settings.poll",defaultMessage:"Poll results:"})),Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)(X.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","poll"],onChange:o,label:l}),u&&Object(s.a)(X.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","poll"],onChange:this.onPushChange,label:f}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["shows","poll"],onChange:o,label:r}),Object(s.a)(X.a,{prefix:"notifications",settings:e,settingPath:["sounds","poll"],onChange:o,label:d}))))},i}(b.a.PureComponent),tt=i(74),et=i(233),it=Object(M.f)({clearMessage:{id:"notifications.clear_confirmation",defaultMessage:"Are you sure you want to permanently clear all your notifications?"},clearConfirm:{id:"notifications.clear",defaultMessage:"Clear notifications"}}),ot=Object(M.g)(Object(h.connect)((function(t){return{settings:t.getIn(["settings","notifications"]),pushSettings:t.get("push_notifications")}}),(function(t,e){var i=e.intl;return{onChange:function(e,i){"push"===e[0]?t(Object(et.e)(e.slice(1),i)):"quickFilter"===e[0]?(t(Object(tt.c)(["notifications"].concat(e),i)),t(Object(O.p)("all"))):t(Object(tt.c)(["notifications"].concat(e),i))},onClear:function(){t(Object(Y.d)("CONFIRM",{message:i.formatMessage(it.clearMessage),confirm:i.formatMessage(it.clearConfirm),onConfirm:function(){return t(Object(O.k)())}}))}}}))($));var at,nt,st,ct=Object(M.f)({mentions:{id:"notifications.filter.mentions",defaultMessage:"Mentions"},favourites:{id:"notifications.filter.favourites",defaultMessage:"Favourites"},boosts:{id:"notifications.filter.boosts",defaultMessage:"Boosts"},polls:{id:"notifications.filter.polls",defaultMessage:"Poll results"},follows:{id:"notifications.filter.follows",defaultMessage:"Follows"}}),lt=Object(M.g)(Z=function(t){Object(l.a)(i,t);var e;e=i;function i(){return t.apply(this,arguments)||this}var o=i.prototype;return o.onClick=function(t){var e=this;return function(){return e.props.selectFilter(t)}},o.render=function(){var t=this.props,e=t.selectedFilter,i=t.advancedMode,o=t.intl;return i?Object(s.a)("div",{className:"notification__filter-bar"},void 0,Object(s.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(s.a)(M.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(s.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention"),title:o.formatMessage(ct.mentions)},void 0,Object(s.a)(U.a,{id:"reply-all",fixedWidth:!0})),Object(s.a)("button",{className:"favourite"===e?"active":"",onClick:this.onClick("favourite"),title:o.formatMessage(ct.favourites)},void 0,Object(s.a)(U.a,{id:"star",fixedWidth:!0})),Object(s.a)("button",{className:"reblog"===e?"active":"",onClick:this.onClick("reblog"),title:o.formatMessage(ct.boosts)},void 0,Object(s.a)(U.a,{id:"retweet",fixedWidth:!0})),Object(s.a)("button",{className:"poll"===e?"active":"",onClick:this.onClick("poll"),title:o.formatMessage(ct.polls)},void 0,Object(s.a)(U.a,{id:"tasks",fixedWidth:!0})),Object(s.a)("button",{className:"follow"===e?"active":"",onClick:this.onClick("follow"),title:o.formatMessage(ct.follows)},void 0,Object(s.a)(U.a,{id:"user-plus",fixedWidth:!0}))):Object(s.a)("div",{className:"notification__filter-bar"},void 0,Object(s.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(s.a)(M.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(s.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention")},void 0,Object(s.a)(M.b,{id:"notifications.filter.mentions",defaultMessage:"Mentions"})))},i}(b.a.PureComponent))||Z,rt=Object(h.connect)((function(t){return{selectedFilter:t.getIn(["settings","notifications","quickFilter","active"]),advancedMode:t.getIn(["settings","notifications","quickFilter","advanced"])}}),(function(t){return{selectFilter:function(e){t(Object(O.p)(e))}}}))(lt),dt=i(57),ut=i(4),ft=i(1049),bt=i(1171);var ht=Object(M.f)({title:{id:"column.notifications",defaultMessage:"Notifications"}}),gt=Object(dt.a)([function(t){return t.getIn(["settings","notifications","quickFilter","show"])},function(t){return t.getIn(["settings","notifications","quickFilter","active"])},function(t){return Object(ut.List)(t.getIn(["settings","notifications","shows"]).filter((function(t){return!t})).keys())},function(t){return t.getIn(["notifications","items"])}],(function(t,e,i,o){return t&&"all"!==e?o.filter((function(t){return null!==t&&e===t.get("type")})):o.filterNot((function(t){return null!==t&&i.includes(t.get("type"))}))})),pt=Object(h.connect)((function(t){return{showFilterBar:t.getIn(["settings","notifications","quickFilter","show"]),notifications:gt(t),isLoading:t.getIn(["notifications","isLoading"],!0),isUnread:t.getIn(["notifications","unread"])>0||t.getIn(["notifications","pendingItems"]).size>0,hasMore:t.getIn(["notifications","hasMore"]),numPending:t.getIn(["notifications","pendingItems"],Object(ut.List)()).size}}))(at=Object(M.g)((st=nt=function(t){Object(l.a)(i,t);var e;e=i;function i(){for(var e,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return e=t.call.apply(t,[this].concat(o))||this,Object(r.a)(Object(c.a)(e),"handleLoadGap",(function(t){e.props.dispatch(Object(O.l)({maxId:t}))})),Object(r.a)(Object(c.a)(e),"handleLoadOlder",u()((function(){var t=e.props.notifications.last();e.props.dispatch(Object(O.l)({maxId:t&&t.get("id")}))}),300,{leading:!0})),Object(r.a)(Object(c.a)(e),"handleLoadPending",(function(){e.props.dispatch(Object(O.m)())})),Object(r.a)(Object(c.a)(e),"handleScrollToTop",u()((function(){e.props.dispatch(Object(O.o)(!0))}),100)),Object(r.a)(Object(c.a)(e),"handleScroll",u()((function(){e.props.dispatch(Object(O.o)(!1))}),100)),Object(r.a)(Object(c.a)(e),"handlePin",(function(){var t=e.props,i=t.columnId,o=t.dispatch;o(i?Object(j.h)(i):Object(j.e)("NOTIFICATIONS",{}))})),Object(r.a)(Object(c.a)(e),"handleMove",(function(t){var i=e.props,o=i.columnId;(0,i.dispatch)(Object(j.g)(o,t))})),Object(r.a)(Object(c.a)(e),"handleHeaderClick",(function(){e.column.scrollTop()})),Object(r.a)(Object(c.a)(e),"setColumnRef",(function(t){e.column=t})),Object(r.a)(Object(c.a)(e),"handleMoveUp",(function(t){var i=e.props.notifications.findIndex((function(e){return null!==e&&e.get("id")===t}))-1;e._selectChild(i,!0)})),Object(r.a)(Object(c.a)(e),"handleMoveDown",(function(t){var i=e.props.notifications.findIndex((function(e){return null!==e&&e.get("id")===t}))+1;e._selectChild(i,!1)})),e}var o=i.prototype;return o.componentWillMount=function(){this.props.dispatch(Object(O.n)())},o.componentWillUnmount=function(){this.handleLoadOlder.cancel(),this.handleScrollToTop.cancel(),this.handleScroll.cancel(),this.props.dispatch(Object(O.o)(!1)),this.props.dispatch(Object(O.q)())},o._selectChild=function(t,e){var i=this.column.node,o=i.querySelector("article:nth-of-type("+(t+1)+") .focusable");o&&(e&&i.scrollTop>o.offsetTop?o.scrollIntoView(!0):!e&&i.scrollTop+i.clientHeight<o.offsetTop+o.offsetHeight&&o.scrollIntoView(!1),o.focus())},o.render=function(){var t=this,e=this.props,i=e.intl,o=e.notifications,a=e.shouldUpdateScroll,n=e.isLoading,c=e.isUnread,l=e.columnId,r=e.multiColumn,d=e.hasMore,u=e.numPending,f=e.showFilterBar,h=!!l,O=Object(s.a)(M.b,{id:"empty_column.notifications",defaultMessage:"You don't have any notifications yet. Interact with others to start the conversation."}),j=null,v=f?Object(s.a)(rt,{}):null;j=n&&this.scrollableContent?this.scrollableContent:o.size>0||d?o.map((function(e,i){return null===e?Object(s.a)(bt.a,{disabled:n,maxId:i>0?o.getIn([i-1,"id"]):null,onClick:t.handleLoadGap},"gap:"+o.getIn([i+1,"id"])):Object(s.a)(E,{notification:e,accountId:e.get("account"),onMoveUp:t.handleMoveUp,onMoveDown:t.handleMoveDown},e.get("id"))})):null,this.scrollableContent=j;var m=Object(s.a)(ft.a,{scrollKey:"notifications-"+l,trackScroll:!h,isLoading:n,showLoading:n&&0===o.size,hasMore:d,numPending:u,emptyMessage:O,onLoadMore:this.handleLoadOlder,onLoadPending:this.handleLoadPending,onScrollToTop:this.handleScrollToTop,onScroll:this.handleScroll,shouldUpdateScroll:a,bindToDocument:!r},void 0,j);return(b.a.createElement(g.a,{bindToDocument:!r,ref:this.setColumnRef,label:i.formatMessage(ht.title)},Object(s.a)(p.a,{icon:"bell",active:c,title:i.formatMessage(ht.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:h,multiColumn:r},void 0,Object(s.a)(ot,{})),v,m))},i}(b.a.PureComponent),Object(r.a)(nt,"defaultProps",{trackScroll:!0}),at=st))||at)||at}}]);
//# sourceMappingURL=notifications.js.map