From b24746db8e5cf81bb7ee15b208265bf4b6eb54b4 Mon Sep 17 00:00:00 2001 From: pengyu Date: Sun, 2 Mar 2025 21:49:04 -0500 Subject: [PATCH 01/11] update the gray area hover in modal in chat area --- frontend/src/components/root/prompt-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/root/prompt-form.tsx b/frontend/src/components/root/prompt-form.tsx index 408e489a..3fca2bff 100644 --- a/frontend/src/components/root/prompt-form.tsx +++ b/frontend/src/components/root/prompt-form.tsx @@ -211,7 +211,7 @@ export const PromptForm = forwardRef( > Date: Mon, 3 Mar 2025 00:34:19 -0500 Subject: [PATCH 02/11] fix bug click create button sign in will not able to trigger form --- frontend/src/app/(main)/page.tsx | 43 +++++++++++++------ frontend/src/components/auth-choice-modal.tsx | 21 ++++++++- 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/frontend/src/app/(main)/page.tsx b/frontend/src/app/(main)/page.tsx index e6842819..5d1c31e8 100644 --- a/frontend/src/app/(main)/page.tsx +++ b/frontend/src/app/(main)/page.tsx @@ -9,9 +9,18 @@ import { ProjectsSection } from '@/components/root/projects-section'; import { PromptForm, PromptFormRef } from '@/components/root/prompt-form'; import { ProjectContext } from '@/components/chat/code-engine/project-context'; +// ✅ Import your SignInModal and SignUpModal +import { SignInModal } from '@/components/sign-in-modal'; +import { SignUpModal } from '@/components/sign-up-modal'; + export default function HomePage() { + // States for AuthChoiceModal const [showAuthChoice, setShowAuthChoice] = useState(false); + // ✅ Add states for sign in / sign up modals + const [showSignIn, setShowSignIn] = useState(false); + const [showSignUp, setShowSignUp] = useState(false); + const promptFormRef = useRef(null); const { isAuthorized } = useAuthContext(); const { createProjectFromPrompt, isLoading } = useContext(ProjectContext); @@ -19,30 +28,22 @@ export default function HomePage() { const handleSubmit = async () => { if (!promptFormRef.current) return; - // Get form data from the prompt form const { message, isPublic, model } = promptFormRef.current.getPromptData(); - if (!message.trim()) return; try { - // Create the project const result = await createProjectFromPrompt(message, isPublic, model); - - // If successful, clear the input if (result) { promptFormRef.current.clearMessage(); - - // Note: No need to navigate here as the ProjectContext's onCompleted handler - // in the createProject mutation will handle navigation to the chat page + // No need to navigate here, ProjectContext handles navigation } } catch (error) { console.error('Error creating project:', error); - // Error handling is done via toast in ProjectContext } }; return ( -
+
setShowAuthChoice(true)} isLoading={isLoading} /> @@ -85,19 +87,36 @@ export default function HomePage() {
- {/* Modals */} + {/* Choice Modal */} setShowAuthChoice(false)} onSignUpClick={() => { + // 1) Close the AuthChoice setShowAuthChoice(false); + // 2) Then open SignUpModal + setTimeout(() => { + setShowSignUp(true); + }, 100); }} onSignInClick={() => { setShowAuthChoice(false); + setTimeout(() => { + setShowSignIn(true); + }, 100); }} /> - {/* Add this to your global CSS for the subtle pulse animation */} + {/* SignInModal & SignUpModal */} + setShowSignIn(false)} + /> + setShowSignUp(false)} + /> +