Skip to content

Commit

Permalink
onboarding exit button always visible
Browse files Browse the repository at this point in the history
New modals logic do not require hiding "exit" button from onboarding if device is not ready to work with.
It also somewhat mitigates #1046 Seems like if there are less renders, the chance it happens is smaller.
  • Loading branch information
mroz22 committed Jan 10, 2020
1 parent 95a1415 commit 04502c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ describe('Device settings', () => {
.click()
.getTestElement('@modal/firmware/exit-button')
.click()
.getTestElement('@modal/firmware/exit-button').should('not.be.visible');
.getTestElement('@modal/firmware/exit-button')
.should('not.be.visible');
});

// TODO: upload custom image
Expand Down
10 changes: 3 additions & 7 deletions packages/suite/src/views/onboarding/steps/Welcome/Container.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { AppState, Dispatch } from '@suite-types';
import { Dispatch } from '@suite-types';
import * as suiteActions from '@suite-actions/suiteActions';
import * as onboardingActions from '@onboarding-actions/onboardingActions';

import Step from './index';

const mapStateToProps = (state: AppState) => ({
device: state.suite.device,
});

const mapDispatchToProps = (dispatch: Dispatch) => ({
goToNextStep: bindActionCreators(onboardingActions.goToNextStep, dispatch),
addPath: bindActionCreators(onboardingActions.addPath, dispatch),
closeModalApp: bindActionCreators(suiteActions.closeModalApp, dispatch),
});

export type Props = ReturnType<typeof mapStateToProps> & ReturnType<typeof mapDispatchToProps>;
export type Props = ReturnType<typeof mapDispatchToProps>;

export default connect(mapStateToProps, mapDispatchToProps)(Step);
export default connect(null, mapDispatchToProps)(Step);
26 changes: 8 additions & 18 deletions packages/suite/src/views/onboarding/steps/Welcome/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ const Base = styled.div`
`;

const WelcomeStep = (props: Props) => {
const { device } = props;

const shouldDisplayLeaveButton = () => {
if (device && device.features && !device.features.initialized) {
return false;
}
// rather show than not
return true;
};
console.log('render');

return (
<Wrapper.Step data-test="onboarding_first_page">
Expand Down Expand Up @@ -67,15 +59,13 @@ const WelcomeStep = (props: Props) => {
</Wrapper.Options>
</Wrapper.StepBody>
<Wrapper.StepFooter>
{shouldDisplayLeaveButton() && (
<OnboardingButton.Back
data-test="button-use-wallet"
onClick={() => props.closeModalApp()}
>
{/* TODO proper texts, I dunno */}
<Translation {...messages.TR_BACK} />
</OnboardingButton.Back>
)}
<OnboardingButton.Back
data-test="button-use-wallet"
onClick={() => props.closeModalApp()}
>
{/* TODO proper texts, I dunno */}
<Translation {...messages.TR_BACK} />
</OnboardingButton.Back>
</Wrapper.StepFooter>
</Wrapper.Step>
);
Expand Down

0 comments on commit 04502c7

Please sign in to comment.