Skip to content

Commit

Permalink
🐛 Hide delegates onboarding in guest mode
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Jun 6, 2019
1 parent 3570a0b commit 72fc8c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/components/delegatesV2/delegatesV2.js
Expand Up @@ -46,16 +46,19 @@ class DelegatesV2 extends React.Component {
}];
}
render() {
const { t, votes } = this.props;
const { t, votes, account } = this.props;
const { votingModeEnabled } = this.state;
return (
<div className={`${grid.row} ${styles.wrapper}`} ref={(el) => { this.root = el; }}>
<Onboarding
slides={this.getOnboardingSlides()}
finalCallback={this.toggleVotingMode}
ctaLabel={t('Start voting')}
name={'delegateOnboarding'}
/>
{ account && account.address ?
<Onboarding
slides={this.getOnboardingSlides()}
finalCallback={this.toggleVotingMode}
ctaLabel={t('Start voting')}
name={'delegateOnboarding'}
/> :
null
}
<VotingHeader
t={t}
votingModeEnabled={votingModeEnabled}
Expand Down
8 changes: 8 additions & 0 deletions src/components/delegatesV2/delegatesV2.test.js
Expand Up @@ -11,6 +11,7 @@ import votingReducer from '../../store/reducers/voting';
import DelegatesV2 from './delegatesV2';
import history from '../../history';
import i18n from '../../i18n';
import accounts from '../../../test/constants/accounts';

describe('DelegatesV2', () => {
let wrapper;
Expand Down Expand Up @@ -65,5 +66,12 @@ describe('DelegatesV2', () => {
wrapper.find('.cancel-voting-button').at(0).simulate('click');
expect(wrapper.find('.addedVotes')).to.have.lengthOf(0);
});

it('should show onboarding if not in guest mode', () => {
wrapper = mount(<Router>
<DelegatesV2 {...props} account={accounts.genesis} />
</Router>, options);
expect(wrapper.find('Onboarding')).to.have.lengthOf(1);
});
});

1 change: 1 addition & 0 deletions src/components/delegatesV2/index.js
Expand Up @@ -6,6 +6,7 @@ import { clearVotes } from '../../actions/voting';

const mapStateToProps = state => ({
votes: state.voting.votes,
account: state.account,
});

const mapDispatchToProps = {
Expand Down

0 comments on commit 72fc8c7

Please sign in to comment.