Pleroma/priv/static/packs/features/notifications.js
Haelwenn (lanodan) Monnier 2a850abbeb
MastoFE: Bundle 2020-01-20
2020-02-29 06:41:13 +01:00

2 lines
25 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[42],{808:function(t,e,i){"use strict";i.r(e);var o,a,n,s,c,l,r,d,u,f,b=i(0),h=i(2),g=i(7),p=i(1),O=i(62),j=i.n(O),v=i(3),m=i.n(v),_=i(13),M=i(736),w=i(733),C=i(53),y=i(250),P=i(206),k=i(14),N=i.n(k),x=i(6),I=i(295),q=i(5),S=i.n(q),F=i(18),R=i(20),W=i(1053),H=i(1026),T=i(111),D=i(118),L=i(294),B=i(50),U=Object(x.f)({authorize:{id:"follow_request.authorize",defaultMessage:"Authorize"},reject:{id:"follow_request.reject",defaultMessage:"Reject"}}),A=Object(x.g)((n=a=function(t){function e(){return t.apply(this,arguments)||this}return Object(g.a)(e,t),e.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(b.a)(v.Fragment,{},void 0,o.get("display_name"),o.get("username")):Object(b.a)("div",{className:"account"},void 0,Object(b.a)("div",{className:"account__wrapper"},void 0,Object(b.a)(L.a,{className:"account__display-name",title:o.get("acct"),href:o.get("url"),to:"/accounts/"+o.get("id")},o.get("id"),Object(b.a)("div",{className:"account__avatar-wrapper"},void 0,Object(b.a)(T.a,{account:o,size:36})),Object(b.a)(D.a,{account:o})),Object(b.a)("div",{className:"account__relationship"},void 0,Object(b.a)(B.a,{title:e.formatMessage(U.authorize),icon:"check",onClick:a}),Object(b.a)(B.a,{title:e.formatMessage(U.reject),icon:"times",onClick:n})))):Object(b.a)("div",{})},e}(F.a),Object(p.a)(a,"propTypes",{account:N.a.map.isRequired,onAuthorize:S.a.func.isRequired,onReject:S.a.func.isRequired,intl:S.a.object.isRequired}),o=n))||o,z=i(25),K=Object(_.connect)((function(){var t=Object(P.d)();return function(e,i){return{account:t(e,i.id)}}}),(function(t,e){var i=e.id;return{onAuthorize:function(){t(Object(z.v)(i))},onReject:function(){t(Object(z.I)(i))}}}))(A),Y=i(26),G=Object(x.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"}}),J=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(", ")},V=Object(x.g)((l=c=function(t){function e(){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(p.a)(Object(h.a)(e),"handleMoveUp",(function(){var t=e.props,i=t.notification;(0,t.onMoveUp)(i.get("id"))})),Object(p.a)(Object(h.a)(e),"handleMoveDown",(function(){var t=e.props,i=t.notification;(0,t.onMoveDown)(i.get("id"))})),Object(p.a)(Object(h.a)(e),"handleOpen",(function(){var t=e.props.notification;t.get("status")?e.context.router.history.push("/statuses/"+t.get("status")):e.handleOpenProfile()})),Object(p.a)(Object(h.a)(e),"handleOpenProfile",(function(){var t=e.props.notification;e.context.router.history.push("/accounts/"+t.getIn(["account","id"]))})),Object(p.a)(Object(h.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(p.a)(Object(h.a)(e),"handleHotkeyFavourite",(function(){var t=e.props.status;t&&e.props.onFavourite(t)})),Object(p.a)(Object(h.a)(e),"handleHotkeyBoost",(function(t){var i=e.props.status;i&&e.props.onReblog(i,t)})),Object(p.a)(Object(h.a)(e),"handleHotkeyToggleHidden",(function(){var t=e.props.status;t&&e.props.onToggleHidden(t)})),e}Object(g.a)(e,t);var i=e.prototype;return i.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}},i.renderFollow=function(t,e,i){var o=this.props.intl;return Object(b.a)(I.HotKeys,{handlers:this.getHandlers()},void 0,Object(b.a)("div",{className:"notification notification-follow focusable",tabIndex:"0","aria-label":J(o,o.formatMessage(G.follow,{name:e.get("acct")}),t.get("created_at"))},void 0,Object(b.a)("div",{className:"notification__message"},void 0,Object(b.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(b.a)(Y.a,{id:"user-plus",fixedWidth:!0})),Object(b.a)("span",{title:t.get("created_at")},void 0,Object(b.a)(x.b,{id:"notification.follow",defaultMessage:"{name} followed you",values:{name:i}}))),Object(b.a)(H.a,{id:e.get("id"),hidden:this.props.hidden})))},i.renderFollowRequest=function(t,e,i){var o=this.props.intl;return Object(b.a)(I.HotKeys,{handlers:this.getHandlers()},void 0,Object(b.a)("div",{className:"notification notification-follow-request focusable",tabIndex:"0","aria-label":J(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(b.a)("div",{className:"notification__message"},void 0,Object(b.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(b.a)(Y.a,{id:"user",fixedWidth:!0})),Object(b.a)("span",{title:t.get("created_at")},void 0,Object(b.a)(x.b,{id:"notification.follow_request",defaultMessage:"{name} has requested to follow you",values:{name:i}}))),Object(b.a)(K,{id:e.get("id"),withNote:!1,hidden:this.props.hidden})))},i.renderMention=function(t){return Object(b.a)(W.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})},i.renderFavourite=function(t,e){var i=this.props.intl;return Object(b.a)(I.HotKeys,{handlers:this.getHandlers()},void 0,Object(b.a)("div",{className:"notification notification-favourite focusable",tabIndex:"0","aria-label":J(i,i.formatMessage(G.favourite,{name:t.getIn(["account","acct"])}),t.get("created_at"))},void 0,Object(b.a)("div",{className:"notification__message"},void 0,Object(b.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(b.a)(Y.a,{id:"star",className:"star-icon",fixedWidth:!0})),Object(b.a)("span",{title:t.get("created_at")},void 0,Object(b.a)(x.b,{id:"notification.favourite",defaultMessage:"{name} favourited your status",values:{name:e}}))),Object(b.a)(W.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})))},i.renderReblog=function(t,e){var i=this.props.intl;return Object(b.a)(I.HotKeys,{handlers:this.getHandlers()},void 0,Object(b.a)("div",{className:"notification notification-reblog focusable",tabIndex:"0","aria-label":J(i,i.formatMessage(G.reblog,{name:t.getIn(["account","acct"])}),t.get("created_at"))},void 0,Object(b.a)("div",{className:"notification__message"},void 0,Object(b.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(b.a)(Y.a,{id:"retweet",fixedWidth:!0})),Object(b.a)("span",{title:t.get("created_at")},void 0,Object(b.a)(x.b,{id:"notification.reblog",defaultMessage:"{name} boosted your status",values:{name:e}}))),Object(b.a)(W.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})))},i.renderPoll=function(t,e){var i=this.props.intl,o=R.n===e.get("id"),a=o?i.formatMessage(G.ownPoll):i.formatMessage(G.poll);return Object(b.a)(I.HotKeys,{handlers:this.getHandlers()},void 0,Object(b.a)("div",{className:"notification notification-poll focusable",tabIndex:"0","aria-label":J(i,a,t.get("created_at"))},void 0,Object(b.a)("div",{className:"notification__message"},void 0,Object(b.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(b.a)(Y.a,{id:"tasks",fixedWidth:!0})),Object(b.a)("span",{title:t.get("created_at")},void 0,o?Object(b.a)(x.b,{id:"notification.own_poll",defaultMessage:"Your poll has ended"}):Object(b.a)(x.b,{id:"notification.poll",defaultMessage:"A poll you have voted in has ended"}))),Object(b.a)(W.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})))},i.render=function(){var t=this.props.notification,e=t.get("account"),i={__html:e.get("display_name_html")},o=Object(b.a)("bdi",{},void 0,Object(b.a)(L.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},e}(F.a),Object(p.a)(c,"contextTypes",{router:S.a.object}),Object(p.a)(c,"propTypes",{notification:N.a.map.isRequired,hidden:S.a.bool,onMoveUp:S.a.func.isRequired,onMoveDown:S.a.func.isRequired,onMention:S.a.func.isRequired,onFavourite:S.a.func.isRequired,onReblog:S.a.func.isRequired,onToggleHidden:S.a.func.isRequired,status:N.a.map,intl:S.a.object.isRequired,getScrollPosition:S.a.func,updateScrollBottom:S.a.func,cacheMediaWidth:S.a.func,cachedMediaWidth:S.a.number}),s=l))||s,E=i(47),Q=i(21),X=i(45),Z=i(85),$=Object(_.connect)((function(){var t=Object(P.e)(),e=Object(P.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(Q.cb)(e,i))},onModalReblog:function(e){t(Object(X.t)(e))},onReblog:function(e,i){e.get("reblogged")?t(Object(X.x)(e)):i.shiftKey||!R.b?this.onModalReblog(e):t(Object(E.d)("BOOST",{status:e,onReblog:this.onModalReblog}))},onFavourite:function(e){e.get("favourited")?t(Object(X.v)(e)):t(Object(X.p)(e))},onToggleHidden:function(e){e.get("hidden")?t(Object(Z.l)(e.get("id"))):t(Object(Z.j)(e.get("id")))}}}))(V),tt=function(t){function e(){return t.apply(this,arguments)||this}return Object(g.a)(e,t),e.prototype.render=function(){return Object(b.a)("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.props.onClick},void 0,Object(b.a)(Y.a,{id:"eraser"})," ",Object(b.a)(x.b,{id:"notifications.clear",defaultMessage:"Clear notifications"}))},e}(m.a.PureComponent),et=i(1079),it=function(t){function e(){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(p.a)(Object(h.a)(e),"onPushChange",(function(t,i){e.props.onChange(["push"].concat(t),i)})),e}return Object(g.a)(e,t),e.prototype.render=function(){var t=this.props,e=t.settings,i=t.pushSettings,o=t.onChange,a=t.onClear,n=Object(b.a)(x.b,{id:"notifications.column_settings.filter_bar.show",defaultMessage:"Show"}),s=Object(b.a)(x.b,{id:"notifications.column_settings.filter_bar.advanced",defaultMessage:"Display all categories"}),c=Object(b.a)(x.b,{id:"notifications.column_settings.alert",defaultMessage:"Desktop notifications"}),l=Object(b.a)(x.b,{id:"notifications.column_settings.show",defaultMessage:"Show in column"}),r=Object(b.a)(x.b,{id:"notifications.column_settings.sound",defaultMessage:"Play sound"}),d=i.get("browserSupport")&&i.get("isSubscribed"),u=d&&Object(b.a)(x.b,{id:"notifications.column_settings.push",defaultMessage:"Push notifications"});return Object(b.a)("div",{},void 0,Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(tt,{onClick:a})),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-filter-bar"},void 0,Object(b.a)("span",{id:"notifications-filter-bar",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.filter_bar.category",defaultMessage:"Quick filter bar"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","show"],onChange:o,label:n}),Object(b.a)(et.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","advanced"],onChange:o,label:s}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-follow"},void 0,Object(b.a)("span",{id:"notifications-follow",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.follow",defaultMessage:"New followers:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","follow"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","follow"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow"],onChange:o,label:r}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-follow-request"},void 0,Object(b.a)("span",{id:"notifications-follow-request",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.follow_request",defaultMessage:"New follow requests:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow_request"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","follow_request"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","follow_request"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow_request"],onChange:o,label:r}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-favourite"},void 0,Object(b.a)("span",{id:"notifications-favourite",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.favourite",defaultMessage:"Favourites:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","favourite"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","favourite"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","favourite"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","favourite"],onChange:o,label:r}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-mention"},void 0,Object(b.a)("span",{id:"notifications-mention",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.mention",defaultMessage:"Mentions:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","mention"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","mention"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","mention"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","mention"],onChange:o,label:r}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-reblog"},void 0,Object(b.a)("span",{id:"notifications-reblog",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.reblog",defaultMessage:"Boosts:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","reblog"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","reblog"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","reblog"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","reblog"],onChange:o,label:r}))),Object(b.a)("div",{role:"group","aria-labelledby":"notifications-poll"},void 0,Object(b.a)("span",{id:"notifications-poll",className:"column-settings__section"},void 0,Object(b.a)(x.b,{id:"notifications.column_settings.poll",defaultMessage:"Poll results:"})),Object(b.a)("div",{className:"column-settings__row"},void 0,Object(b.a)(et.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","poll"],onChange:o,label:c}),d&&Object(b.a)(et.a,{prefix:"notifications_push",settings:i,settingPath:["alerts","poll"],onChange:this.onPushChange,label:u}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["shows","poll"],onChange:o,label:l}),Object(b.a)(et.a,{prefix:"notifications",settings:e,settingPath:["sounds","poll"],onChange:o,label:r}))))},e}(m.a.PureComponent),ot=i(70),at=i(228),nt=Object(x.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"}}),st=Object(x.g)(Object(_.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(at.e)(e.slice(1),i)):"quickFilter"===e[0]?(t(Object(ot.c)(["notifications"].concat(e),i)),t(Object(C.p)("all"))):t(Object(ot.c)(["notifications"].concat(e),i))},onClear:function(){t(Object(E.d)("CONFIRM",{message:i.formatMessage(nt.clearMessage),confirm:i.formatMessage(nt.clearConfirm),onConfirm:function(){return t(Object(C.k)())}}))}}}))(it)),ct=Object(x.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(x.g)(r=function(t){function e(){return t.apply(this,arguments)||this}Object(g.a)(e,t);var i=e.prototype;return i.onClick=function(t){var e=this;return function(){return e.props.selectFilter(t)}},i.render=function(){var t=this.props,e=t.selectedFilter,i=t.advancedMode,o=t.intl;return i?Object(b.a)("div",{className:"notification__filter-bar"},void 0,Object(b.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(b.a)(x.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(b.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention"),title:o.formatMessage(ct.mentions)},void 0,Object(b.a)(Y.a,{id:"reply-all",fixedWidth:!0})),Object(b.a)("button",{className:"favourite"===e?"active":"",onClick:this.onClick("favourite"),title:o.formatMessage(ct.favourites)},void 0,Object(b.a)(Y.a,{id:"star",fixedWidth:!0})),Object(b.a)("button",{className:"reblog"===e?"active":"",onClick:this.onClick("reblog"),title:o.formatMessage(ct.boosts)},void 0,Object(b.a)(Y.a,{id:"retweet",fixedWidth:!0})),Object(b.a)("button",{className:"poll"===e?"active":"",onClick:this.onClick("poll"),title:o.formatMessage(ct.polls)},void 0,Object(b.a)(Y.a,{id:"tasks",fixedWidth:!0})),Object(b.a)("button",{className:"follow"===e?"active":"",onClick:this.onClick("follow"),title:o.formatMessage(ct.follows)},void 0,Object(b.a)(Y.a,{id:"user-plus",fixedWidth:!0}))):Object(b.a)("div",{className:"notification__filter-bar"},void 0,Object(b.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(b.a)(x.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(b.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention")},void 0,Object(b.a)(x.b,{id:"notifications.filter.mentions",defaultMessage:"Mentions"})))},e}(m.a.PureComponent))||r,rt=Object(_.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(C.p)(e))}}}))(lt),dt=i(54),ut=i(4),ft=i(1023),bt=i(1138);i.d(e,"default",(function(){return pt}));var ht=Object(x.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(_.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}}))(d=Object(x.g)((f=u=function(t){function e(){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(p.a)(Object(h.a)(e),"handleLoadGap",(function(t){e.props.dispatch(Object(C.l)({maxId:t}))})),Object(p.a)(Object(h.a)(e),"handleLoadOlder",j()((function(){var t=e.props.notifications.last();e.props.dispatch(Object(C.l)({maxId:t&&t.get("id")}))}),300,{leading:!0})),Object(p.a)(Object(h.a)(e),"handleLoadPending",(function(){e.props.dispatch(Object(C.m)())})),Object(p.a)(Object(h.a)(e),"handleScrollToTop",j()((function(){e.props.dispatch(Object(C.o)(!0))}),100)),Object(p.a)(Object(h.a)(e),"handleScroll",j()((function(){e.props.dispatch(Object(C.o)(!1))}),100)),Object(p.a)(Object(h.a)(e),"handlePin",(function(){var t=e.props,i=t.columnId,o=t.dispatch;o(i?Object(y.h)(i):Object(y.e)("NOTIFICATIONS",{}))})),Object(p.a)(Object(h.a)(e),"handleMove",(function(t){var i=e.props,o=i.columnId;(0,i.dispatch)(Object(y.g)(o,t))})),Object(p.a)(Object(h.a)(e),"handleHeaderClick",(function(){e.column.scrollTop()})),Object(p.a)(Object(h.a)(e),"setColumnRef",(function(t){e.column=t})),Object(p.a)(Object(h.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(p.a)(Object(h.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}Object(g.a)(e,t);var i=e.prototype;return i.componentWillMount=function(){this.props.dispatch(Object(C.n)())},i.componentWillUnmount=function(){this.handleLoadOlder.cancel(),this.handleScrollToTop.cancel(),this.handleScroll.cancel(),this.props.dispatch(Object(C.o)(!1)),this.props.dispatch(Object(C.q)())},i._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())},i.render=function(){var t=this,e=this.props,i=e.intl,o=e.notifications,a=e.shouldUpdateScroll,n=e.isLoading,s=e.isUnread,c=e.columnId,l=e.multiColumn,r=e.hasMore,d=e.numPending,u=e.showFilterBar,f=!!c,h=Object(b.a)(x.b,{id:"empty_column.notifications",defaultMessage:"You don't have any notifications yet. Interact with others to start the conversation."}),g=null,p=u?Object(b.a)(rt,{}):null;g=n&&this.scrollableContent?this.scrollableContent:o.size>0||r?o.map((function(e,i){return null===e?Object(b.a)(bt.a,{disabled:n,maxId:i>0?o.getIn([i-1,"id"]):null,onClick:t.handleLoadGap},"gap:"+o.getIn([i+1,"id"])):Object(b.a)($,{notification:e,accountId:e.get("account"),onMoveUp:t.handleMoveUp,onMoveDown:t.handleMoveDown},e.get("id"))})):null,this.scrollableContent=g;var O=Object(b.a)(ft.a,{scrollKey:"notifications-"+c,trackScroll:!f,isLoading:n,showLoading:n&&0===o.size,hasMore:r,numPending:d,emptyMessage:h,onLoadMore:this.handleLoadOlder,onLoadPending:this.handleLoadPending,onScrollToTop:this.handleScrollToTop,onScroll:this.handleScroll,shouldUpdateScroll:a,bindToDocument:!l},void 0,g);return m.a.createElement(M.a,{bindToDocument:!l,ref:this.setColumnRef,label:i.formatMessage(ht.title)},Object(b.a)(w.a,{icon:"bell",active:s,title:i.formatMessage(ht.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:f,multiColumn:l},void 0,Object(b.a)(st,{})),p,O)},e}(m.a.PureComponent),Object(p.a)(u,"defaultProps",{trackScroll:!0}),d=f))||d)||d}}]);
//# sourceMappingURL=notifications.js.map