Skip to content

Commit 388984b

Browse files
committed
refactor(ui): move onboarding tour from + button to Add new tutorial title
- Remove OnboardingTour from Group component + button - Add OnboardingTour wrapper around Add new tutorial title in UploadTutorialForm - Pass isPageOpened prop to UploadTutorialForm for proper onboarding visibility
1 parent 8855fff commit 388984b

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/Group/Group.tsx

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {
1010
} from 'uiSrc/telemetry'
1111
import { workbenchCustomTutorialsSelector } from 'uiSrc/slices/workbench/wb-custom-tutorials'
1212
import { EAItemActions } from 'uiSrc/constants'
13-
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
1413

1514
import { RiAccordion } from 'uiSrc/components/base/display/accordion/RiAccordion'
1615
import { Col, Row } from 'uiSrc/components/base/layout/flex'
17-
import { RiTooltip, OnboardingTour } from 'uiSrc/components'
16+
import { RiTooltip } from 'uiSrc/components'
1817
import { Text } from 'uiSrc/components/base/text'
1918
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
2019

@@ -34,7 +33,6 @@ export interface Props {
3433
initialIsOpen?: boolean
3534
forceState?: 'open' | 'closed'
3635
onToggle?: (isOpen: boolean) => void
37-
isPageOpened?: boolean
3836
isShowActions?: boolean
3937
isShowFolder?: boolean
4038
hasChildren?: boolean
@@ -53,7 +51,6 @@ const Group = (props: Props) => {
5351
onToggle,
5452
onCreate,
5553
onDelete,
56-
isPageOpened,
5754
isShowFolder,
5855
hasChildren = true,
5956
} = props
@@ -92,23 +89,15 @@ const Group = (props: Props) => {
9289
{actions?.includes(EAItemActions.Create) &&
9390
hasChildren &&
9491
(isGroupOpen || forceState === 'open') && (
95-
<OnboardingTour
96-
options={ONBOARDING_FEATURES.EXPLORE_CUSTOM_TUTORIALS}
97-
anchorPosition="downLeft"
98-
anchorWrapperClassName="onboardingPopoverAnchor"
99-
panelClassName={cx({ hide: isPageOpened })}
100-
preventPropagation
101-
>
102-
<RiTooltip content="Upload tutorial">
103-
<S.GroupHeaderButton
104-
role="presentation"
105-
onClick={handleCreate}
106-
data-testid="open-upload-tutorial-btn"
107-
>
108-
<RiIcon type="PlusSlimIcon" size="m" />
109-
</S.GroupHeaderButton>
110-
</RiTooltip>
111-
</OnboardingTour>
92+
<RiTooltip content="Upload tutorial">
93+
<S.GroupHeaderButton
94+
role="presentation"
95+
onClick={handleCreate}
96+
data-testid="open-upload-tutorial-btn"
97+
>
98+
<RiIcon type="PlusSlimIcon" size="m" />
99+
</S.GroupHeaderButton>
100+
</RiTooltip>
112101
)}
113102
{actions?.includes(EAItemActions.Delete) && (
114103
<DeleteTutorialButton

redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/Navigation/Navigation.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ const Navigation = (props: Props) => {
171171
)}
172172
onCreate={() => setIsCreateOpen((v) => !v)}
173173
onDelete={onDeleteCustomTutorial}
174-
isPageOpened={isInternalPageVisible}
175174
hasChildren={hasChildren}
176175
forceState={
177176
isCustomTutorials && isCustomTutorialsOnboarding
@@ -184,14 +183,18 @@ const Navigation = (props: Props) => {
184183
actions?.includes(EAItemActions.Create) &&
185184
(children?.length === 0 ? (
186185
<Col gap="l">
187-
<UploadTutorialForm onSubmit={submitCreate} />
186+
<UploadTutorialForm
187+
onSubmit={submitCreate}
188+
isPageOpened={isInternalPageVisible}
189+
/>
188190
<UploadWarning />
189191
</Col>
190192
) : (
191193
isCreateOpen && (
192194
<UploadTutorialForm
193195
onSubmit={submitCreate}
194196
onCancel={() => setIsCreateOpen(false)}
197+
isPageOpened={isInternalPageVisible}
195198
/>
196199
)
197200
))}

redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/UploadTutorialForm/UploadTutorialForm.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import React, { useState } from 'react'
22
import { useFormik } from 'formik'
33
import { FormikErrors } from 'formik/dist/types'
44
import { isEmpty } from 'lodash'
5+
import cx from 'classnames'
56

67
import { TextInput } from 'uiSrc/components/base/inputs'
78
import { Nullable } from 'uiSrc/utils'
89
import validationErrors from 'uiSrc/constants/validationErrors'
9-
import { RiFilePicker, RiTooltip } from 'uiSrc/components'
10+
import { RiFilePicker, RiTooltip, OnboardingTour } from 'uiSrc/components'
11+
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
1012

1113
import { Spacer } from 'uiSrc/components/base/layout/spacer'
1214
import { Row } from 'uiSrc/components/base/layout/flex'
@@ -29,10 +31,11 @@ export interface FormValues {
2931
export interface Props {
3032
onSubmit: (data: FormValues) => void
3133
onCancel?: () => void
34+
isPageOpened?: boolean
3235
}
3336

3437
const UploadTutorialForm = (props: Props) => {
35-
const { onSubmit, onCancel } = props
38+
const { onSubmit, onCancel, isPageOpened } = props
3639
const [errors, setErrors] = useState<FormikErrors<FormValues>>({})
3740

3841
const initialValues: FormValues = {
@@ -79,7 +82,15 @@ const UploadTutorialForm = (props: Props) => {
7982

8083
return (
8184
<S.Wrapper className={styles.wrapper} data-testid="upload-tutorial-form">
82-
<Text>Add new tutorial</Text>
85+
<OnboardingTour
86+
options={ONBOARDING_FEATURES.EXPLORE_CUSTOM_TUTORIALS}
87+
anchorPosition="downLeft"
88+
anchorWrapperClassName="onboardingPopoverAnchor"
89+
panelClassName={cx({ hide: isPageOpened })}
90+
preventPropagation
91+
>
92+
<Text>Add new tutorial</Text>
93+
</OnboardingTour>
8394
<Spacer size="m" />
8495
<div>
8596
<div className={styles.uploadFileWrapper}>

0 commit comments

Comments
 (0)