-
Notifications
You must be signed in to change notification settings - Fork 67
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 #4383 from FlowFuse/2721-product-tour
Product Tour - Welcome to FlowFuse
- Loading branch information
Showing
11 changed files
with
381 additions
and
4 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
2 changes: 1 addition & 1 deletion
2
frontend/src/pages/team/Applications/components/compact/DevicesWrapper.vue
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
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,115 @@ | ||
// eslint-disable-next-line n/no-extraneous-import | ||
import { offset } from '@floating-ui/dom' | ||
import { useShepherd } from 'vue-shepherd' | ||
|
||
import { useStore } from 'vuex' | ||
|
||
import Product from '../services/product.js' | ||
|
||
// eslint-disable-next-line n/no-extraneous-import | ||
import 'shepherd.js/dist/css/shepherd.css' | ||
import './tour-theme.scss' | ||
|
||
function create (id, tourJson) { | ||
const store = useStore() | ||
Product.capture('ff-tour-start', { | ||
tour_id: id | ||
}) | ||
const tour = useShepherd({ | ||
useModalOverlay: true, | ||
defaultStepOptions: { | ||
arrow: true, | ||
classes: 'shepherd-theme-ff', | ||
scrollTo: false, | ||
cancelIcon: { | ||
enabled: true | ||
}, | ||
floatingUIOptions: { | ||
middleware: [offset({ mainAxis: 12, crossAxis: 0 })] | ||
} | ||
} | ||
}) | ||
|
||
function onCancel () { | ||
const index = tour.steps.indexOf(tour.currentStep) | ||
store.dispatch('ux/deactivateTour', id) | ||
Product.capture('ff-tour-cancel', { | ||
tour_id: id, | ||
tour_step: index | ||
}) | ||
} | ||
|
||
function onComplete () { | ||
store.dispatch('ux/deactivateTour', id) | ||
Product.capture('ff-tour-complete', { | ||
tour_id: id | ||
}) | ||
} | ||
|
||
function onBack () { | ||
tour.back() | ||
const index = tour.steps.indexOf(tour.currentStep) | ||
Product.capture('ff-tour-step-back', { | ||
tour_id: id, | ||
tour_step: index | ||
}) | ||
} | ||
|
||
function onNext () { | ||
tour.next() | ||
const index = tour.steps.indexOf(tour.currentStep) | ||
Product.capture('ff-tour-step-forward', { | ||
tour_id: id, | ||
tour_step: index | ||
}) | ||
} | ||
|
||
tour.on('cancel', onCancel) | ||
tour.on('complete', onComplete) | ||
|
||
// loop over steps and add them to the tour | ||
const steps = tourJson.length | ||
|
||
tourJson.forEach((step, i) => { | ||
const buttons = [] | ||
|
||
// which secondary button do we need? | ||
if (i === 0) { | ||
buttons.push({ | ||
text: 'Exit', | ||
action: tour.cancel, | ||
secondary: true | ||
}) | ||
} else { | ||
buttons.push({ | ||
text: 'Back', | ||
action: onBack, | ||
secondary: true | ||
}) | ||
} | ||
|
||
// which primary button do we need? | ||
if (i !== steps - 1) { | ||
buttons.push({ | ||
text: 'Next', | ||
action: onNext | ||
}) | ||
} else { | ||
buttons.push({ | ||
text: 'Finish', | ||
action: tour.complete | ||
}) | ||
} | ||
|
||
tour.addStep({ | ||
...step, | ||
buttons | ||
}) | ||
}) | ||
|
||
return tour | ||
} | ||
|
||
export default { | ||
create | ||
} |
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,51 @@ | ||
.shepherd-theme-ff { | ||
&.shepherd-has-title[data-popper-placement^=bottom]>.shepherd-arrow:before { | ||
background-color: $ff-grey-800; | ||
} | ||
.shepherd-content { | ||
.shepherd-header { | ||
background-color: $ff-grey-800; | ||
padding: 0.5rem 1rem; | ||
line-height: 2rem; | ||
} | ||
.shepherd-title { | ||
color: white; | ||
font-weight: 500; | ||
} | ||
.shepherd-cancel-icon { | ||
color: $ff-white; | ||
} | ||
.shepherd-text { | ||
padding: 1rem; | ||
p { | ||
margin-bottom: 0.75rem; | ||
} | ||
} | ||
} | ||
.shepherd-footer { | ||
display: flex; | ||
gap: 0; | ||
padding: 0; | ||
border-top: 1px solid $ff-grey-300; | ||
.shepherd-button { | ||
flex-grow: 1; | ||
border-radius: 0; | ||
background-color: white; | ||
font-weight: 500; | ||
padding: 0.5rem 1rem; | ||
line-height: 2rem; | ||
font-weight: bold; | ||
margin: 0; | ||
} | ||
.shepherd-button:last-child { | ||
background-color: $ff-blue-900; | ||
&:hover { | ||
background-color: $ff-indigo-800; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.shepherd-modal-overlay-container.shepherd-modal-is-visible path { | ||
transition: 0.3s all; | ||
} |
Oops, something went wrong.