Skip to content

Commit

Permalink
add step, fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
frostyfan109 committed Sep 11, 2024
1 parent 83e5ae2 commit 204d2a5
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions src/contexts/tour-context/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,41 +397,81 @@ export const TourProvider = ({ children }: ITourProvider ) => {
when: (() => {
const getFullscreenBtn = () => document.querySelector<HTMLButtonElement>(".concept-modal-fullscreen-btn")

let stillOnStep = true
return {
show: function() {
stillOnStep = true

const fullscreenBtn = getFullscreenBtn()!
fullscreenBtn.disabled = true

// The root component is demounted (and so picked up), not the nested `.concept-modal`
waitForNoElement(".ant-modal-root", null).then((resolve) => {
// If the modal was closed but we're still on this step, then the
// user closed the modal manually = advance to the next step.
const currentStep = tour.getCurrentStep()!
if (currentStep.id === this.id) tour.next()
if (stillOnStep) tour.next()
})

resultModalDomMask.showMask()
},
hide: () => {
stillOnStep = false

const fullscreenBtn = getFullscreenBtn()
if (fullscreenBtn) fullscreenBtn.disabled = false

resultModalDomMask.hideMask()
},
cancel: () => {
stillOnStep = false

const fullscreenBtn = getFullscreenBtn()!
if (fullscreenBtn) fullscreenBtn.disabled = false

resultModalDomMask.hideMask()
},
complete: () => {
stillOnStep = false

const fullscreenBtn = getFullscreenBtn()
if (fullscreenBtn) fullscreenBtn.disabled = false

resultModalDomMask.hideMask()
}
}
})()
}
},
{
id: "main.search.concept.search-rankings",
attachTo: {
element: "head"
},
title: "Concept rankings",
text: renderToStaticMarkup(
<div>
Search results are scored based on their search term relevance.
Higher scoring, more relevant results are shown first. Further down
the results, you&apos;ll see concepts less directly relevant to your original
query but still potentially of unexpected interest.
</div>
),
buttons: [
{
classes: 'shepherd-button-secondary',
text: 'Back',
action: function() {
const expandBtn = getExpandButton()!
expandBtn.click()
this.back()
}
},
{
classes: 'shepherd-button-primary',
text: 'Next',
type: 'next'
}
],
},
]
return []
}, [searchBarDomMask, basePath, navigate, doSearch])
Expand Down

0 comments on commit 204d2a5

Please sign in to comment.