-
Notifications
You must be signed in to change notification settings - Fork 2
/
dashboard-accounts.83be72caff5cb03db207.js
2 lines (2 loc) · 9.49 KB
/
dashboard-accounts.83be72caff5cb03db207.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{1753:function(t,e,n){"use strict";n.d(e,"b",function(){return w}),n.d(e,"a",function(){return y});var a=n(0),s=n.n(a),i=n(1),o=n.n(i),r=n(5),c=n.n(r),u=n(35),l=n(23),p=n(22),d=n(14),h=n.n(d),f=n(2073),m=function(){function t(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,n,a){return n&&t(e.prototype,n),a&&t(e,a),e}}();function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var y=function(t){function e(){return b(this,e),g(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return v(e,s.a.Component),m(e,[{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.index,a=t.changeTab,i=t.title,o=t.className,r=t.updatedTab,u=t.disabled,l=t.subText,p=c()({"is-active":e},o);return"string"==typeof i&&i.indexOf(".")>0&&(i=h.a.translate(i)),this.props.collapsed?("string"==typeof l&&(l=l.trim()),s.a.createElement("option",{value:n,"data-is-link-to":this.props.isLinkTo},s.a.createElement("span",{className:"tab-title"},i,r?"*":"",l&&" (",l&&l,l&&")"))):s.a.createElement("li",{className:p,onClick:u?null:a.bind(this,n,this.props.isLinkTo)},s.a.createElement("a",null,s.a.createElement("span",{className:"tab-title"},i,r?"*":""),l&&s.a.createElement("div",{className:"tab-subtext"},l)))}}]),e}();y.propTypes={changeTab:o.a.func,isActive:o.a.bool.isRequired,index:o.a.number.isRequired,className:o.a.string,isLinkTo:o.a.string,subText:o.a.oneOfType([o.a.object,o.a.string])},y.defaultProps={isActive:!1,index:0,className:"",isLinkTo:"",subText:null};var w=function(t){function e(t){b(this,e);var n=g(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.state={activeTab:t.setting?t.viewSettings.get(t.setting,t.defaultActiveTab):t.defaultActiveTab,width:window.innerWidth},n._setDimensions=n._setDimensions.bind(n),n}return v(e,s.a.Component),m(e,[{key:"componentDidMount",value:function(){this._setDimensions(),window.addEventListener("resize",this._setDimensions,{capture:!1,passive:!0})}},{key:"componentWillReceiveProps",value:function(t){var e=t.viewSettings.get(t.setting);e!==this.props.viewSettings.get(this.props.setting)&&this.setState({activeTab:e})}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._setDimensions)}},{key:"_setDimensions",value:function(){var t=window.innerWidth;t!==this.state.width&&this.setState({width:t})}},{key:"_changeTab",value:function(t,e){t!==this.state.activeTab&&(""!==e&&this.props.history.push(e),this.props.setting&&l.a.changeViewSetting(function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}({},this.props.setting,t)),this.setState({activeTab:t}),this.props.onChangeTab&&this.props.onChangeTab(t))}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,a=e.contentClass,i=e.tabsClass,o=e.style,r=e.segmented,u=this.state.width<900&&s.a.Children.count(n)>2,l=null,p=s.a.Children.map(n,function(e,n){if(!e)return null;if(u&&e.props.disabled)return null;var a=n===t.state.activeTab;return a&&(l=e.props.children),s.a.cloneElement(e,{collapsed:u,isActive:a,changeTab:t._changeTab.bind(t),index:n})}).filter(function(t){return null!==t});return l||(l=p[0].props.children),s.a.createElement("div",{className:c()(this.props.actionButtons?"with-buttons":"",this.props.className)},s.a.createElement("div",{className:"service-selector"},s.a.createElement("ul",{style:o,className:c()("button-group no-margin",i,{segmented:r})},u?s.a.createElement("li",{style:{paddingLeft:10,paddingRight:10,minWidth:"15rem"}},s.a.createElement("select",{value:this.state.activeTab,style:{marginTop:10,marginBottom:10},className:"bts-select",onChange:function(e){var n=parseInt(e.target.value,10);t._changeTab(n,e.target[n].attributes["data-is-link-to"].value)}},p)):p,this.props.actionButtons?s.a.createElement("li",{className:"tabs-action-buttons"},this.props.actionButtons):null)),s.a.createElement("div",{className:c()("tab-content",a)},l))}}]),e}();w.propTypes={setting:o.a.string,defaultActiveTab:o.a.number,segmented:o.a.bool},w.defaultProps={active:0,defaultActiveTab:0,segmented:!0,contentClass:"",style:{}},w=Object(u.a)(w,{listenTo:function(){return[p.a]},getProps:function(){return{viewSettings:p.a.getState().viewSettings}}}),w=Object(f.a)(w)},2061:function(t,e,n){"use strict";n.r(e);var a=n(0),s=n.n(a),i=n(11),o=n.n(i),r=n(1861),c=n(1766),u=n(41),l=n(546),p=n(23),d=n(22),h=n(26),f=n(251),m=n(1753),b=n(129),g=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},v=function(){function t(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,n,a){return n&&t(e.prototype,n),a&&t(e,a),e}}();function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var T=function(t){function e(){return y(this,e),w(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return E(e,s.a.Component),v(e,[{key:"render",value:function(){return s.a.createElement(b.a,{stores:[h.a,d.a,f.a],inject:{contacts:function(){return h.a.getState().accountContacts},myActiveAccounts:function(){return h.a.getState().myActiveAccounts},myHiddenAccounts:function(){return h.a.getState().myHiddenAccounts},accountsReady:function(){return h.a.getState().accountsLoaded&&h.a.getState().refsLoaded},passwordAccount:function(){return h.a.getState().passwordAccount},currentEntry:d.a.getState().viewSettings.get("dashboardEntry","accounts")}},s.a.createElement(_,this.props))}}]),e}(),_=function(t){function e(t){y(this,e);var n=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.state={width:null,showIgnored:!1,currentEntry:t.currentEntry},n._setDimensions=n._setDimensions.bind(n),n}return E(e,s.a.Component),v(e,[{key:"componentDidMount",value:function(){this._setDimensions(),window.addEventListener("resize",this._setDimensions,{capture:!1,passive:!0})}},{key:"shouldComponentUpdate",value:function(t,e){return t.myActiveAccounts!==this.props.myActiveAccounts||t.contacts!==this.props.contacts||t.ignoredAccounts!==this.props.ignoredAccounts||t.passwordAccount!==this.props.passwordAccount||e.width!==this.state.width||t.accountsReady!==this.props.accountsReady||e.showIgnored!==this.state.showIgnored||e.currentEntry!==this.state.currentEntry}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._setDimensions)}},{key:"_setDimensions",value:function(){var t=window.innerWidth;t!==this.state.width&&this.setState({width:t})}},{key:"_onToggleIgnored",value:function(){this.setState({showIgnored:!this.state.showIgnored})}},{key:"_onSwitchType",value:function(t){this.setState({currentEntry:t}),p.a.changeViewSetting({dashboardEntry:t})}},{key:"render",value:function(){var t=this.props,e=t.myActiveAccounts,n=t.myHiddenAccounts,a=t.accountsReady,i=t.passwordAccount,p=this.state,d=p.width,h=p.showIgnored;i&&!e.has(i)&&(e=e.add(i));var f=e.toArray().sort();i&&-1===f.indexOf(i)&&f.push(i);var b=n.toArray().sort(),g=e.size+n.size+(i?1:0);if(!a)return s.a.createElement(u.a,null);if(!g)return s.a.createElement(l.a,null);var v=this.props.contacts.toArray();return s.a.createElement("div",{ref:"wrapper",className:"grid-block page-layout vertical"},s.a.createElement("div",{ref:"container",className:"tabs-container generic-bordered-box"},s.a.createElement(m.b,{setting:"accountTab",className:"account-tabs",defaultActiveTab:1,segmented:!1,tabsClass:"account-overview no-padding bordered-header content-block"},s.a.createElement(m.a,{title:"account.accounts"},s.a.createElement("div",{className:"generic-bordered-box"},s.a.createElement("div",{className:"box-content"},s.a.createElement(r.a,{accounts:o.a.List(f),ignoredAccounts:o.a.List(b),width:d,onToggleIgnored:this._onToggleIgnored.bind(this),showIgnored:h,showMyAccounts:!0})))),s.a.createElement(m.a,{title:"account.contacts"},s.a.createElement("div",{className:"generic-bordered-box"},s.a.createElement("div",{className:"box-content"},s.a.createElement(r.a,{accounts:v,passwordAccount:i,ignoredAccounts:o.a.List(b),width:d,onToggleIgnored:this._onToggleIgnored.bind(this),showIgnored:h,isContactsList:!0})))),s.a.createElement(m.a,{title:"account.recent"},s.a.createElement(c.a,{accountsList:e,limit:10,compactView:!1,fullHeight:!0,showFilters:!0,dashboard:!0})))))}}]),e}();e.default=function(t){return s.a.createElement(T,g({},t,{onlyAccounts:!0}))}}}]);
//# sourceMappingURL=dashboard-accounts.js.map