seo update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useRef } from 'react'
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { driver, type DriveStep } from 'driver.js'
|
||||
import 'driver.js/dist/driver.css'
|
||||
@@ -128,14 +128,17 @@ function getSettingsSteps(isMobile: boolean): DriveStep[] {
|
||||
export function useOnboardingTour() {
|
||||
const navigate = useNavigate()
|
||||
const driverRef = useRef<ReturnType<typeof driver> | null>(null)
|
||||
const [isTourActive, setIsTourActive] = useState(false)
|
||||
|
||||
const startTour = useCallback(() => {
|
||||
const isMobile = window.innerWidth < 860
|
||||
setIsTourActive(true)
|
||||
|
||||
const driverObj = driver({
|
||||
...driverDefaults(),
|
||||
onDestroyStarted: () => {
|
||||
clearPendingTourStep()
|
||||
setIsTourActive(false)
|
||||
driverObj.destroy()
|
||||
},
|
||||
onNextClick: () => {
|
||||
@@ -145,6 +148,7 @@ export function useOnboardingTour() {
|
||||
// Last home step → navigate to /history
|
||||
if (activeIndex === steps.length - 1) {
|
||||
localStorage.setItem(TOUR_PENDING_KEY, 'history')
|
||||
setIsTourActive(false)
|
||||
driverObj.destroy()
|
||||
navigate('/history')
|
||||
return
|
||||
@@ -206,7 +210,7 @@ export function useOnboardingTour() {
|
||||
if (activeIndex === steps.length - 1) {
|
||||
clearPendingTourStep()
|
||||
driverObj.destroy()
|
||||
navigate('/')
|
||||
navigate('/write')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -219,5 +223,5 @@ export function useOnboardingTour() {
|
||||
setTimeout(() => driverObj.drive(), 300)
|
||||
}, [navigate])
|
||||
|
||||
return { startTour, continueTourOnHistory, continueTourOnSettings }
|
||||
return { startTour, continueTourOnHistory, continueTourOnSettings, isTourActive }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user