Created
April 9, 2018 20:53
-
-
Save jakelear/ca2ae641e06286e004edda71ce37c8ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/components/solar/solar.component.jsx b/src/components/solar/solar.component.jsx | |
| index f60301ea..9409325f 100644 | |
| --- a/src/components/solar/solar.component.jsx | |
| +++ b/src/components/solar/solar.component.jsx | |
| @@ -8,6 +8,7 @@ import './solar.scss'; | |
| export default class Solar extends React.Component { | |
| static propTypes = { | |
| hasPremiumWindPlan: PropTypes.bool.isRequired, | |
| + hasSolar: PropTypes.bool.isRequired, | |
| accounts: PropTypes.array.isRequired, | |
| isEligible: PropTypes.bool.isRequired, | |
| }; | |
| @@ -16,12 +17,8 @@ export default class Solar extends React.Component { | |
| window.scrollTo(0, 0); | |
| } | |
| - get hasPanels () { | |
| - return !!this.props.accounts.length; | |
| - } | |
| - | |
| render () { | |
| - if (this.hasPanels) return <SolarHasPanels {...this.props} />; | |
| + if (this.props.hasSolar) return <SolarHasPanels {...this.props} />; | |
| else if (this.props.isEligible) return <SolarEligible hasPremiumWindPlan={this.props.hasPremiumWindPlan} />; | |
| else return <SolarIneligible />; | |
| } | |
| diff --git a/src/components/solar/solar.container.jsx b/src/components/solar/solar.container.jsx | |
| index 213199c6..fbbaf1b7 100644 | |
| --- a/src/components/solar/solar.container.jsx | |
| +++ b/src/components/solar/solar.container.jsx | |
| @@ -9,6 +9,7 @@ function PageContainer (props) { | |
| function mapState ({ userData }) { | |
| return { | |
| + hasSolar: userData.hasSolar, | |
| accounts: userData.solarAccounts, | |
| hasPremiumWindPlan: userData.user.hasPremiumAccount, | |
| isEligible: userData.user.hasSupportedUtility, | |
| diff --git a/src/mappers/user-booleans.js b/src/mappers/user-booleans.js | |
| index 94ff0627..0cb1e8e0 100644 | |
| --- a/src/mappers/user-booleans.js | |
| +++ b/src/mappers/user-booleans.js | |
| @@ -1,6 +1,7 @@ | |
| export default class { | |
| constructor (data) { | |
| this.data = data; | |
| + this.accounts = this.data.accounts.filter((a) => a.status !== 'deleted'); | |
| } | |
| getProps () { | |
| @@ -21,19 +22,19 @@ export default class { | |
| } | |
| canUseChecking () { | |
| - return this.data.accounts.filter((a) => a.canUseChecking).length > 0; | |
| + return this.accounts.filter((a) => a.canUseChecking).length > 0; | |
| } | |
| hasActiveAccount () { | |
| - return this.data.accounts.filter((a) => a.status === 'active').length > 0; | |
| + return this.accounts.filter((a) => a.status === 'active').length > 0; | |
| } | |
| hasConsolidatedAccount () { | |
| - return this.data.accounts.filter((a) => a.planType !== 'evergreen').length > 0; | |
| + return this.accounts.filter((a) => a.planType !== 'evergreen').length > 0; | |
| } | |
| hasPremiumAccount () { | |
| - return this.data.accounts.filter((a) => a.planType === 'premium').length > 0; | |
| + return this.accounts.filter((a) => a.planType === 'premium').length > 0; | |
| } | |
| hasBrokerage () { | |
| @@ -49,11 +50,11 @@ export default class { | |
| } | |
| hasSolar () { | |
| - return this.data.solarAccounts.length > 0; | |
| + return this.data.solarAccounts.filter((a) => a.status === 'active').length > 0; | |
| } | |
| hasSupportedUtility () { | |
| - return this.data.utilities.filter((u) => u.supported).length > 0; | |
| + return this.accounts.filter((a) => a.hasSupportedUtility).length > 0; | |
| } | |
| hasVerifiedCredentials () { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment