removes analytics onboarding if incognito mode is (already) on (#4115)

This commit is contained in:
Dimitri Mitropoulos 2021-10-14 17:11:01 -04:00 committed by GitHub
parent 177d6adf38
commit cabaa7ebdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,10 @@ class WrapperOnboarding extends PureComponent<Props, State> {
this.props.wrapperProps.handleGoToNextActivity();
}
hasStep1() {
return this.props.wrapperProps.settings.incognitoMode === false;
}
renderStep1() {
return (
<Analytics
@ -119,16 +123,21 @@ class WrapperOnboarding extends PureComponent<Props, State> {
const {
settings: { enableAnalytics },
} = this.props.wrapperProps;
const lastStep = this.hasStep1() ? (
<p className="notice success text-left margin-top margin-bottom">
<a href="#" className="pull-right" onClick={this._handleBackStep}>
Back
</a>
{enableAnalytics
? `Thanks for helping make ${getAppName()} better!`
: 'Opted out of analytics'}
</p>
) : null;
return (
<Fragment>
<p className="notice success text-left margin-top margin-bottom">
<a href="#" className="pull-right" onClick={this._handleBackStep}>
Back
</a>
{enableAnalytics
? `Thanks for helping make ${getAppName()} better!`
: 'Opted out of analytics'}
</p>
{lastStep}
<p>Import an OpenAPI spec to get started:</p>
<button key="file" className="btn btn--clicky" onClick={this._handleImportFile}>
From File
@ -147,7 +156,7 @@ class WrapperOnboarding extends PureComponent<Props, State> {
const { step } = this.state;
let stepBody;
if (step === 1) {
if (step === 1 && this.hasStep1()) {
stepBody = this.renderStep1();
} else {
stepBody = this.renderStep2();