mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Revert earlier commit sans re-using the prompt for onboarding.
This commit is contained in:
1 parent
2f8439d6ac
commit
95f3ebc1e0
2 files changed
+40
-67
No files matched your search
@@ -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));
|
||||
|
||||
+38
-63
@@ -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<HTMLTextAreaElement>) => {
|
||||
@@ -202,33 +195,24 @@ export default function Index() {
|
||||
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
|
||||
disabled={isCreating}
|
||||
/>
|
||||
{user ? (
|
||||
<Button
|
||||
onClick={handleCreateProject}
|
||||
disabled={!prompt.trim() || isCreating}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCreating ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Creating Project...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Project
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
) : (
|
||||
<div className="text-center space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
Log in or sign up to create your first project
|
||||
</p>
|
||||
<LoginArea className="max-w-xs mx-auto" />
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
onClick={handleCreateProject}
|
||||
disabled={!prompt.trim() || isCreating}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCreating ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Creating Project...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Project
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
@@ -382,33 +366,24 @@ export default function Index() {
|
||||
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
|
||||
disabled={isCreating}
|
||||
/>
|
||||
{user ? (
|
||||
<Button
|
||||
onClick={handleCreateProject}
|
||||
disabled={!prompt.trim() || isCreating}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCreating ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Creating Project...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Project
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
) : (
|
||||
<div className="text-center space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
Log in or sign up to create your first project
|
||||
</p>
|
||||
<LoginArea className="max-w-xs mx-auto" />
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
onClick={handleCreateProject}
|
||||
disabled={!prompt.trim() || isCreating}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCreating ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Creating Project...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Project
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user