diff --git a/src/hooks/useOnboarding.ts b/src/hooks/useOnboarding.ts index 09d7ed21..25aaca0e 100644 --- a/src/hooks/useOnboarding.ts +++ b/src/hooks/useOnboarding.ts @@ -1,6 +1,5 @@ import { useState, useEffect } from 'react'; import { useLocalStorage } from './useLocalStorage'; -import { useCurrentUser } from './useCurrentUser'; export function useOnboarding() { const [hasCompletedOnboarding, setHasCompletedOnboarding] = useLocalStorage( @@ -9,14 +8,13 @@ export function useOnboarding() { ); const [currentStep, setCurrentStep] = useState(0); const [isOnboardingOpen, setIsOnboardingOpen] = useState(false); - const { user } = useCurrentUser(); // Check if onboarding should be shown on first load useEffect(() => { - if (!hasCompletedOnboarding && user) { + if (!hasCompletedOnboarding) { setIsOnboardingOpen(true); } - }, [hasCompletedOnboarding, user]); + }, [hasCompletedOnboarding]); const handleNextStep = () => { setCurrentStep(prev => Math.min(prev + 1, 2)); diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 20c0c91e..8d540d59 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -3,11 +3,9 @@ import { useNavigate } from 'react-router-dom'; import { type Project } from '@/lib/ProjectsManager'; import { useProjectsManager } from '@/hooks/useProjectsManager'; import { useOnboarding } from '@/hooks/useOnboarding'; -import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useLocalStorage } from '@/hooks/useLocalStorage'; import { ProjectSidebar } from '@/components/ProjectSidebar'; import { OnboardingDialog } from '@/components/onboarding'; -import { LoginArea } from '@/components/auth/LoginArea'; import { Button } from '@/components/ui/button'; import { Textarea } from '@/components/ui/textarea'; @@ -36,7 +34,7 @@ export default function Index() { handlePreviousStep, handleCompleteOnboarding, } = useOnboarding(); - const { user } = useCurrentUser(); + const [isSidebarVisible, setIsSidebarVisible] = useState(() => { // Check if we're on mobile immediately to set correct initial state if (typeof window !== 'undefined') { @@ -66,12 +64,7 @@ export default function Index() { loadProjects(); }, [loadProjects]); - // Restore prompt from storage when user logs in - useEffect(() => { - if (user && storedPrompt && !prompt) { - setPrompt(storedPrompt); - } - }, [user, storedPrompt, prompt]); + // Sync prompt with local storage const handlePromptChange = (e: React.ChangeEvent) => { @@ -202,33 +195,24 @@ export default function Index() { className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed" disabled={isCreating} /> - {user ? ( - - ) : ( -
-

- Log in or sign up to create your first project -

- -
- )} + @@ -382,33 +366,24 @@ export default function Index() { className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed" disabled={isCreating} /> - {user ? ( - - ) : ( -
-

- Log in or sign up to create your first project -

- -
- )} +