-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2088 from avivtur/guided-tour
CNV-44656: Openshift Virtualization guided tour - UI
- Loading branch information
Showing
29 changed files
with
651 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { FC } from 'react'; | ||
import Joyride, { ACTIONS, CallBackProps, EVENTS } from 'react-joyride'; | ||
import { useLocation, useNavigate } from 'react-router-dom-v5-compat'; | ||
|
||
import { isEmpty } from '@kubevirt-utils/utils/utils'; | ||
import { useSignals } from '@preact/signals-react/runtime'; | ||
|
||
import TourPopover from './components/TourPopover/TourPopover'; | ||
import { | ||
nextStep, | ||
prevStep, | ||
runningTourSignal, | ||
stepIndexSignal, | ||
stopTour, | ||
tourSteps, | ||
} from './utils/constants'; | ||
|
||
const GuidedTour: FC = () => { | ||
const location = useLocation(); | ||
const navigate = useNavigate(); | ||
|
||
useSignals(); | ||
return ( | ||
<Joyride | ||
callback={(callbackProps: CallBackProps) => { | ||
const { action, index, size, step, type } = callbackProps; | ||
const route = step?.data?.route; | ||
|
||
if (!isEmpty(route) && location.pathname !== route) { | ||
navigate(route); | ||
} | ||
|
||
if (action === ACTIONS.CLOSE) { | ||
stopTour(); | ||
return; | ||
} | ||
|
||
if (type === EVENTS.STEP_AFTER) { | ||
if (action === ACTIONS.PREV) { | ||
prevStep(); | ||
return; | ||
} | ||
if (action === ACTIONS.NEXT) { | ||
if (index === size - 1) { | ||
stopTour(); | ||
return; | ||
} | ||
nextStep(); | ||
return; | ||
} | ||
} | ||
}} | ||
styles={{ | ||
options: { | ||
zIndex: 10000, | ||
}, | ||
}} | ||
continuous | ||
disableScrollParentFix | ||
floaterProps={{ disableAnimation: true }} | ||
run={runningTourSignal.value} | ||
stepIndex={stepIndexSignal.value} | ||
steps={tourSteps} | ||
tooltipComponent={TourPopover as any} | ||
/> | ||
); | ||
}; | ||
|
||
export default GuidedTour; |
17 changes: 17 additions & 0 deletions
17
src/utils/components/GuidedTour/components/AddVolumeContent/AddVolumeContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { FC } from 'react'; | ||
import { Trans } from 'react-i18next'; | ||
|
||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
|
||
const AddVolumeContent: FC = () => { | ||
const { t } = useKubevirtTranslation(); | ||
|
||
return ( | ||
<Trans t={t}> | ||
When selecting a DataSource that your virtual machines can boot from, you can add a volume | ||
that is not listed by clicking the <b>Add volume</b> button. | ||
</Trans> | ||
); | ||
}; | ||
|
||
export default AddVolumeContent; |
30 changes: 30 additions & 0 deletions
30
src/utils/components/GuidedTour/components/EndTourContent/EndTourContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { FC } from 'react'; | ||
import { Trans } from 'react-i18next'; | ||
import { Link } from 'react-router-dom-v5-compat'; | ||
|
||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
|
||
const EndTourContent: FC = () => { | ||
const { t } = useKubevirtTranslation(); | ||
|
||
return ( | ||
<Trans t={t}> | ||
Thank you for taking the tour. | ||
<br /> | ||
Stay up-to-date with Openshift Virtualization on our{' '} | ||
<Link target="_blank" to="https://www.redhat.com/en/blog/channel/red-hat-openshift"> | ||
Blog | ||
</Link>{' '} | ||
or continue to learn more in our{' '} | ||
<Link | ||
target="_blank" | ||
to="https://docs.openshift.com/container-platform/4.16/virt/about_virt/about-virt.html" | ||
> | ||
documentation | ||
</Link> | ||
. | ||
</Trans> | ||
); | ||
}; | ||
|
||
export default EndTourContent; |
4 changes: 4 additions & 0 deletions
4
src/utils/components/GuidedTour/components/EndTourFooter/EndTourFooter.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.kv-tour-popover__feedback-footer { | ||
background-color: var(--pf-v5-global--BackgroundColor--dark-transparent-100); | ||
padding: var(--pf-v5-global--spacer--md); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/utils/components/GuidedTour/components/EndTourFooter/EndTourFooter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { FC } from 'react'; | ||
import { Trans } from 'react-i18next'; | ||
import { Link } from 'react-router-dom-v5-compat'; | ||
|
||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
|
||
const EndTourFooter: FC = () => { | ||
const { t } = useKubevirtTranslation(); | ||
|
||
return ( | ||
<div className="kv-tour-popover__feedback-footer"> | ||
<Trans t={t}> | ||
We hope you found this tour helpful. | ||
<br /> | ||
If you have any{' '} | ||
<Link target="_blank" to={'mailto:[email protected]'}> | ||
feedback | ||
</Link> | ||
, we would appreciate hearing from you. | ||
</Trans> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EndTourFooter; |
Oops, something went wrong.