diff --git a/src/hooks/useSasquatchGuide.ts b/src/hooks/useSasquatchGuide.ts index 9de9634..37bf6f1 100644 --- a/src/hooks/useSasquatchGuide.ts +++ b/src/hooks/useSasquatchGuide.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; +import { useLocation, useNavigate } from 'react-router-dom'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import type { GuideMessage } from '@/components/SasquatchGuide'; @@ -9,6 +9,7 @@ import type { GuideMessage } from '@/components/SasquatchGuide'; */ export function useSasquatchGuide() { const location = useLocation(); + const navigate = useNavigate(); const { user } = useCurrentUser(); const [currentMessage, setCurrentMessage] = useState(); @@ -35,7 +36,7 @@ export function useSasquatchGuide() { action: { label: 'Learn More', onClick: () => { - window.location.href = '/onboarding'; + navigate('/onboarding'); }, }, enableChat: true, @@ -66,7 +67,7 @@ export function useSasquatchGuide() { label: user ? 'Start exploring' : 'Login to begin', onClick: () => { if (user) { - window.location.href = '/map'; + navigate('/map'); } else { // Scroll to login section const loginSection = document.getElementById('login-section'); @@ -109,7 +110,7 @@ export function useSasquatchGuide() { action: user ? undefined : { label: 'Login to Offer Services', onClick: () => { - window.location.href = '/onboarding'; + navigate('/onboarding'); }, }, enableChat: true, @@ -136,7 +137,7 @@ export function useSasquatchGuide() { action: user ? undefined : { label: 'Login to Create a Crew', onClick: () => { - window.location.href = '/onboarding'; + navigate('/onboarding'); }, }, enableChat: true, @@ -151,7 +152,7 @@ export function useSasquatchGuide() { } setCurrentMessage(message); - }, [location.pathname, user]); + }, [location.pathname, user, navigate]); const dismissCurrentMessage = () => { setCurrentMessage(undefined);