Skip to content

Commit 112e132

Browse files
committed
[Guided onboarding] Hide the button when the user quits a guide
1 parent a2ec2c7 commit 112e132

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/plugins/guided_onboarding/public/components/guide_button.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ export const GuideButton = ({
5151

5252
// if there is no active guide
5353
if (!pluginState || !pluginState.activeGuide || !pluginState.activeGuide.isActive) {
54-
// if still active period and the user has not started a guide, quit or skipped the guide,
54+
// if still active period and the user has not started a guide or skipped the guide,
5555
// display the button that redirects to the landing page
5656
if (
57-
pluginState?.isActivePeriod &&
58-
(pluginState?.status === 'not_started' ||
59-
pluginState?.status === 'quit' ||
60-
pluginState?.status === 'skipped')
57+
!(
58+
pluginState?.isActivePeriod &&
59+
(pluginState?.status === 'not_started' || pluginState?.status === 'skipped')
60+
)
6161
) {
62+
return null;
63+
} else {
6264
return (
6365
<EuiButton
6466
onClick={navigateToLandingPage}
@@ -73,8 +75,6 @@ export const GuideButton = ({
7375
</EuiButton>
7476
);
7577
}
76-
77-
return null;
7878
}
7979
const stepNumber = getStepNumber(pluginState.activeGuide);
8080
const stepReadyToComplete = pluginState.activeGuide.steps.find(

src/plugins/guided_onboarding/public/components/guide_panel.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ describe('Guided setup', () => {
145145
expect(exists('guideButton')).toBe(false);
146146
});
147147

148-
test('shows redirect button when a user quit the guide', async () => {
148+
test('shows redirect button when a user skipped on the landing page', async () => {
149149
const { exists } = await setupComponentWithPluginStateMock(httpClient, {
150-
status: 'quit',
150+
status: 'skipped',
151151
isActivePeriod: true,
152152
});
153153

154154
expect(exists('guideButtonRedirect')).toBe(true);
155155
expect(exists('guideButton')).toBe(false);
156156
});
157157

158-
test('shows redirect button when a user skipped on the landing page', async () => {
158+
test('hides redirect button when a user quit the guide', async () => {
159159
const { exists } = await setupComponentWithPluginStateMock(httpClient, {
160-
status: 'skipped',
160+
status: 'quit',
161161
isActivePeriod: true,
162162
});
163163

164-
expect(exists('guideButtonRedirect')).toBe(true);
164+
expect(exists('guideButtonRedirect')).toBe(false);
165165
expect(exists('guideButton')).toBe(false);
166166
});
167167

0 commit comments

Comments
 (0)