diff --git a/src/hooks/useRudderstack.ts b/src/hooks/useRudderstack.ts index 89e30b3..4ed63d2 100644 --- a/src/hooks/useRudderstack.ts +++ b/src/hooks/useRudderstack.ts @@ -2,23 +2,49 @@ import { analytics } from '../lib/analytics'; import { UserTraits } from '../types/analytics'; export function useRudderstack() { + const isDevelopment = process.env.NODE_ENV === 'development'; + const isLocalhost = typeof window !== 'undefined' && + (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'); + + const shouldTrack = !isDevelopment && !isLocalhost; + const track = (eventName: string, properties?: Record) => { + if (!shouldTrack) { + console.log('Evento não rastreado em desenvolvimento:', eventName, properties); + return; + } analytics.track(eventName, properties); }; const page = (name?: string, properties?: Record) => { + if (!shouldTrack) { + console.log('Página não rastreada em desenvolvimento:', name, properties); + return; + } analytics.page(name, properties); }; const identify = (userId: string, traits?: UserTraits) => { + if (!shouldTrack) { + console.log('Usuário não identificado em desenvolvimento:', userId, traits); + return; + } analytics.identify({ id: userId, user_metadata: traits } as any); }; const group = (groupId: string, traits?: Record) => { + if (!shouldTrack) { + console.log('Grupo não rastreado em desenvolvimento:', groupId, traits); + return; + } analytics.group(groupId, traits); }; const reset = () => { + if (!shouldTrack) { + console.log('Reset não executado em desenvolvimento'); + return; + } analytics.reset(); }; @@ -27,6 +53,6 @@ export function useRudderstack() { page, identify, group, - reset, + reset }; } \ No newline at end of file diff --git a/src/pages/student-dashboard/StudentDashboardLayout.tsx b/src/pages/student-dashboard/StudentDashboardLayout.tsx index bb6e6eb..e77c984 100644 --- a/src/pages/student-dashboard/StudentDashboardLayout.tsx +++ b/src/pages/student-dashboard/StudentDashboardLayout.tsx @@ -54,6 +54,21 @@ export function StudentDashboardLayout() { {!isCollapsed && Minhas Histórias} + + `flex items-center gap-2 px-4 py-2 rounded-lg text-sm ${ + isActive + ? 'bg-purple-50 text-purple-700' + : 'text-gray-600 hover:bg-gray-50' + }` + } + > + + {!isCollapsed && Redações} + + Painel} - - `flex items-center gap-2 px-4 py-2 rounded-lg text-sm ${ - isActive - ? 'bg-purple-50 text-purple-700' - : 'text-gray-600 hover:bg-gray-50' - }` - } - > - - {!isCollapsed && Redações} - - {/*