Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide delegates onboarding in guest mode - Closes #2108 #2118

Merged
merged 1 commit into from Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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