diff --git a/src/hooks/useOnboardingTour.ts b/src/hooks/useOnboardingTour.ts index 551ec08..154aa97 100644 --- a/src/hooks/useOnboardingTour.ts +++ b/src/hooks/useOnboardingTour.ts @@ -1,7 +1,6 @@ import { useState, useEffect } from 'react'; import { useLocation } from 'react-router-dom'; -import { useWhatsAppInstances } from '@/hooks/useWhatsAppInstances'; import { listWhatsAppGroups } from '@/services/whatsAppGroupsService'; const TOUR_SESSION_KEY = 'onboarding_tour_shown'; @@ -12,17 +11,22 @@ export const useOnboardingTour = () => { const [shouldShowTour, setShouldShowTour] = useState(false); const [tourShownThisSession, setTourShownThisSession] = useState(false); const location = useLocation(); - const { instances } = useWhatsAppInstances(); // Verificar se o tour deve ser exibido const checkTourConditions = async () => { try { + // Só mostrar o tour na página inicial (dashboard) + if (location.pathname !== '/') { + console.log('❌ Tour só aparece no dashboard'); + setShouldShowTour(false); + return; + } + // Verificar se já foi mostrado nesta sessão const shownThisSession = sessionStorage.getItem(TOUR_SESSION_KEY) === 'true'; console.log('🔍 Verificando condições do tour:', { shownThisSession, - instances: instances.length, location: location.pathname }); @@ -33,21 +37,6 @@ export const useOnboardingTour = () => { return; } - // Verificar se há instâncias conectadas - const hasConnectedInstance = instances.some(instance => - instance.status === 'connected' || instance.connectionState === 'open' - ); - - console.log('📱 Status das instâncias:', { - totalInstances: instances.length, - hasConnectedInstance, - instancesDetails: instances.map(i => ({ - name: i.instanceName, - status: i.status, - connectionState: i.connectionState - })) - }); - // Verificar se há grupos cadastrados let hasGroups = false; try { @@ -59,11 +48,10 @@ export const useOnboardingTour = () => { hasGroups = false; } - // Tour deve aparecer se NÃO tiver instância conectada OU NÃO tiver grupos - const shouldShow = !hasConnectedInstance || !hasGroups; + // Tour deve aparecer se NÃO tiver grupos + const shouldShow = !hasGroups; console.log('🎯 Resultado da verificação:', { - hasConnectedInstance, hasGroups, shouldShow, currentPath: location.pathname @@ -89,11 +77,11 @@ export const useOnboardingTour = () => { } }; - // Verificar condições quando instâncias mudarem ou na inicialização + // Verificar condições quando a localização mudar ou na inicialização useEffect(() => { console.log('🔄 Efeito disparado - verificando condições do tour'); checkTourConditions(); - }, [instances, location.pathname]); + }, [location.pathname]); // Limpar tour ao mudar de sessão useEffect(() => { diff --git a/src/pages/WhatsApp.tsx b/src/pages/WhatsApp.tsx index 799cdbd..002a9a1 100644 --- a/src/pages/WhatsApp.tsx +++ b/src/pages/WhatsApp.tsx @@ -9,7 +9,6 @@ import { useWhatsAppActions } from '@/hooks/useWhatsAppActions'; import { useWhatsAppInstance, WHATSAPP_INSTANCE_KEY } from '@/hooks/whatsApp/useWhatsAppInstance'; import { usePeriodicStatusCheck } from '@/hooks/whatsApp/usePeriodicStatusCheck'; import { useExistingInstanceCheck } from '@/hooks/whatsapp/useExistingInstanceCheck'; -import { Button } from '@/components/ui/button'; const WhatsApp = () => { const { @@ -84,12 +83,6 @@ const WhatsApp = () => { } }; - // Função para resetar o tour (apenas para debug) - const resetTour = () => { - sessionStorage.removeItem('onboarding_tour_shown'); - window.location.reload(); - }; - if (checkingExistingInstance || isLoading) { return ( @@ -107,24 +100,6 @@ const WhatsApp = () => { isRefreshing={checkingExistingInstance} /> - {/* Botão temporário para debug do tour */} - {process.env.NODE_ENV === 'development' && ( -
-

Debug do Tour:

- - - (Este botão só aparece em desenvolvimento) - -
- )} -