Conversation
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
📝 WalkthroughWalkthroughThis pull request refactors form components to simplify signup flows from multi-field forms to email-only submissions, updates CSS with new theme variants for form inputs, and removes redundant UI sections including desktop navigation logic and self-assessment content. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/components/CohortHero.tsx`:
- Around line 20-51: The handler handleSubmit currently treats any 2xx fetch as
success; change it to inspect the parsed response object (result) and require
result.success === true before setting submissionStatus("success"), calling
trackEvent("cohort-hero-email-signup"), or clearing email; otherwise set
submissionStatus("error") and setErrorMessage(result.error || "Failed to submit.
Please try again."). Ensure the JSON is parsed (const result = await
response.json()) before the success check and do not call trackEvent or clear
the email on failure.
In `@src/components/JoinUs.tsx`:
- Around line 21-52: The submit flow in handleSubmit currently treats any 2xx
response as success; change the post-response logic to require both response.ok
and result.success === true before calling trackEvent, setting
submissionStatus("success"), and clearing email (setEmail("")). If response.ok
is true but result.success is false, set submissionStatus("error"),
setErrorMessage(result.error || a fallback message), and do NOT call trackEvent
or clear the email; ensure isSubmitting is still reset appropriately after both
branches. Use the existing variables/functions (handleSubmit, response, result,
setSubmissionStatus, setErrorMessage, setEmail, trackEvent) to implement this
conditional check.
| const [email, setEmail] = useState(""); | ||
| const [isSubmitting, setIsSubmitting] = useState(false); | ||
| const [submissionStatus, setSubmissionStatus] = useState< | ||
| "idle" | "success" | "error" | ||
| >("idle"); | ||
| const [errorMessage, setErrorMessage] = useState(""); | ||
|
|
||
| const handleSubmit = async (e: React.FormEvent) => { | ||
| e.preventDefault(); | ||
| if (isSubmitting || !email) return; | ||
|
|
||
| setIsSubmitting(true); | ||
| setSubmissionStatus("idle"); | ||
| setErrorMessage(""); | ||
|
|
||
| try { | ||
| const response = await fetch("/api/cohort-signup", { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ email }), | ||
| }); | ||
|
|
||
| const result = await response.json(); | ||
|
|
||
| if (response.ok) { | ||
| setSubmissionStatus("success"); | ||
| trackEvent("cohort-hero-email-signup"); | ||
| setEmail(""); | ||
| } else { | ||
| setSubmissionStatus("error"); | ||
| setErrorMessage(result.error || "Failed to submit. Please try again."); | ||
| } |
There was a problem hiding this comment.
Check result.success before treating the signup as successful.
The API contract returns { success: false, error } on failure; treating any 2xx as success can show a success state and fire analytics incorrectly.
🛠️ Suggested fix
- if (response.ok) {
+ if (response.ok && result?.success) {
setSubmissionStatus("success");
trackEvent("cohort-hero-email-signup");
setEmail("");
} else {
setSubmissionStatus("error");
- setErrorMessage(result.error || "Failed to submit. Please try again.");
+ setErrorMessage(result?.error || "Failed to submit. Please try again.");
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const [email, setEmail] = useState(""); | |
| const [isSubmitting, setIsSubmitting] = useState(false); | |
| const [submissionStatus, setSubmissionStatus] = useState< | |
| "idle" | "success" | "error" | |
| >("idle"); | |
| const [errorMessage, setErrorMessage] = useState(""); | |
| const handleSubmit = async (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| if (isSubmitting || !email) return; | |
| setIsSubmitting(true); | |
| setSubmissionStatus("idle"); | |
| setErrorMessage(""); | |
| try { | |
| const response = await fetch("/api/cohort-signup", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ email }), | |
| }); | |
| const result = await response.json(); | |
| if (response.ok) { | |
| setSubmissionStatus("success"); | |
| trackEvent("cohort-hero-email-signup"); | |
| setEmail(""); | |
| } else { | |
| setSubmissionStatus("error"); | |
| setErrorMessage(result.error || "Failed to submit. Please try again."); | |
| } | |
| const [email, setEmail] = useState(""); | |
| const [isSubmitting, setIsSubmitting] = useState(false); | |
| const [submissionStatus, setSubmissionStatus] = useState< | |
| "idle" | "success" | "error" | |
| >("idle"); | |
| const [errorMessage, setErrorMessage] = useState(""); | |
| const handleSubmit = async (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| if (isSubmitting || !email) return; | |
| setIsSubmitting(true); | |
| setSubmissionStatus("idle"); | |
| setErrorMessage(""); | |
| try { | |
| const response = await fetch("/api/cohort-signup", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ email }), | |
| }); | |
| const result = await response.json(); | |
| if (response.ok && result?.success) { | |
| setSubmissionStatus("success"); | |
| trackEvent("cohort-hero-email-signup"); | |
| setEmail(""); | |
| } else { | |
| setSubmissionStatus("error"); | |
| setErrorMessage(result?.error || "Failed to submit. Please try again."); | |
| } |
🤖 Prompt for AI Agents
In `@src/components/CohortHero.tsx` around lines 20 - 51, The handler handleSubmit
currently treats any 2xx fetch as success; change it to inspect the parsed
response object (result) and require result.success === true before setting
submissionStatus("success"), calling trackEvent("cohort-hero-email-signup"), or
clearing email; otherwise set submissionStatus("error") and
setErrorMessage(result.error || "Failed to submit. Please try again."). Ensure
the JSON is parsed (const result = await response.json()) before the success
check and do not call trackEvent or clear the email on failure.
| const [email, setEmail] = useState(""); | ||
| const [isSubmitting, setIsSubmitting] = useState(false); | ||
| const [submissionStatus, setSubmissionStatus] = useState< | ||
| "idle" | "success" | "error" | ||
| >("idle"); | ||
| const [errorMessage, setErrorMessage] = useState<string>(""); | ||
|
|
||
| const form = useForm<JoinUsFormData>({ | ||
| resolver: zodResolver(joinUsFormSchema), | ||
| defaultValues: { | ||
| name: "", | ||
| email: "", | ||
| discordHandle: "", | ||
| showcaseComments: "", | ||
| showcaseUrl: "", | ||
| introduction: "", | ||
| }, | ||
| }); | ||
| const [errorMessage, setErrorMessage] = useState(""); | ||
|
|
||
| const onSubmit = async (data: JoinUsFormData) => { | ||
| if (isSubmitting) return; // Prevent multiple submissions | ||
| const handleSubmit = async (e: React.FormEvent) => { | ||
| e.preventDefault(); | ||
| if (isSubmitting || !email) return; | ||
|
|
||
| console.log("Join Us form submitted:", data); | ||
|
|
||
| // Reset states | ||
| setIsSubmitting(true); | ||
| setSubmissionStatus("idle"); | ||
| setErrorMessage(""); | ||
|
|
||
| try { | ||
| const applicationData = transformApplicationDataToApiFormat(data); | ||
|
|
||
| const response = await fetch("/api/applications", { | ||
| const response = await fetch("/api/cohort-signup", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ applicationData }), | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ email }), | ||
| }); | ||
|
|
||
| const result = await response.json(); | ||
|
|
||
| if (response.ok) { | ||
| console.log("Application submitted successfully:", result); | ||
| setSubmissionStatus("success"); | ||
|
|
||
| //tracking | ||
| trackEvent("join-us-submission"); | ||
| // Reset form after successful submission | ||
| form.reset(); | ||
| trackEvent("join-us-email-signup"); | ||
| setEmail(""); | ||
| } else { | ||
| console.error("Failed to submit application:", result); | ||
| setSubmissionStatus("error"); | ||
| setErrorMessage( | ||
| result.error || "Failed to submit application. Please try again.", | ||
| ); | ||
| setErrorMessage(result.error || "Failed to submit. Please try again."); | ||
| } |
There was a problem hiding this comment.
Honor result.success from /api/cohort-signup.
If the backend returns { success: false } with a 2xx status, the UI will incorrectly show success and log analytics.
🛠️ Suggested fix
- if (response.ok) {
+ if (response.ok && result?.success) {
setSubmissionStatus("success");
trackEvent("join-us-email-signup");
setEmail("");
} else {
setSubmissionStatus("error");
- setErrorMessage(result.error || "Failed to submit. Please try again.");
+ setErrorMessage(result?.error || "Failed to submit. Please try again.");
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const [email, setEmail] = useState(""); | |
| const [isSubmitting, setIsSubmitting] = useState(false); | |
| const [submissionStatus, setSubmissionStatus] = useState< | |
| "idle" | "success" | "error" | |
| >("idle"); | |
| const [errorMessage, setErrorMessage] = useState<string>(""); | |
| const form = useForm<JoinUsFormData>({ | |
| resolver: zodResolver(joinUsFormSchema), | |
| defaultValues: { | |
| name: "", | |
| email: "", | |
| discordHandle: "", | |
| showcaseComments: "", | |
| showcaseUrl: "", | |
| introduction: "", | |
| }, | |
| }); | |
| const [errorMessage, setErrorMessage] = useState(""); | |
| const onSubmit = async (data: JoinUsFormData) => { | |
| if (isSubmitting) return; // Prevent multiple submissions | |
| const handleSubmit = async (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| if (isSubmitting || !email) return; | |
| console.log("Join Us form submitted:", data); | |
| // Reset states | |
| setIsSubmitting(true); | |
| setSubmissionStatus("idle"); | |
| setErrorMessage(""); | |
| try { | |
| const applicationData = transformApplicationDataToApiFormat(data); | |
| const response = await fetch("/api/applications", { | |
| const response = await fetch("/api/cohort-signup", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| }, | |
| body: JSON.stringify({ applicationData }), | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ email }), | |
| }); | |
| const result = await response.json(); | |
| if (response.ok) { | |
| console.log("Application submitted successfully:", result); | |
| setSubmissionStatus("success"); | |
| //tracking | |
| trackEvent("join-us-submission"); | |
| // Reset form after successful submission | |
| form.reset(); | |
| trackEvent("join-us-email-signup"); | |
| setEmail(""); | |
| } else { | |
| console.error("Failed to submit application:", result); | |
| setSubmissionStatus("error"); | |
| setErrorMessage( | |
| result.error || "Failed to submit application. Please try again.", | |
| ); | |
| setErrorMessage(result.error || "Failed to submit. Please try again."); | |
| } | |
| const [email, setEmail] = useState(""); | |
| const [isSubmitting, setIsSubmitting] = useState(false); | |
| const [submissionStatus, setSubmissionStatus] = useState< | |
| "idle" | "success" | "error" | |
| >("idle"); | |
| const [errorMessage, setErrorMessage] = useState(""); | |
| const handleSubmit = async (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| if (isSubmitting || !email) return; | |
| setIsSubmitting(true); | |
| setSubmissionStatus("idle"); | |
| setErrorMessage(""); | |
| try { | |
| const response = await fetch("/api/cohort-signup", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ email }), | |
| }); | |
| const result = await response.json(); | |
| if (response.ok && result?.success) { | |
| setSubmissionStatus("success"); | |
| trackEvent("join-us-email-signup"); | |
| setEmail(""); | |
| } else { | |
| setSubmissionStatus("error"); | |
| setErrorMessage(result?.error || "Failed to submit. Please try again."); | |
| } |
🤖 Prompt for AI Agents
In `@src/components/JoinUs.tsx` around lines 21 - 52, The submit flow in
handleSubmit currently treats any 2xx response as success; change the
post-response logic to require both response.ok and result.success === true
before calling trackEvent, setting submissionStatus("success"), and clearing
email (setEmail("")). If response.ok is true but result.success is false, set
submissionStatus("error"), setErrorMessage(result.error || a fallback message),
and do NOT call trackEvent or clear the email; ensure isSubmitting is still
reset appropriately after both branches. Use the existing variables/functions
(handleSubmit, response, result, setSubmissionStatus, setErrorMessage, setEmail,
trackEvent) to implement this conditional check.
Replaced CohortHero buttons and JoinUs full application form with email-only signup forms, both POST to
/api/cohort-signup(not yet implemented)py-12 lg:py-24cohort-hero-email-signup, `join-us-email-signupBackend: New
/api/cohort-signupendpointThe old multi-field application form (
/api/applications) is no longer used on the join page. It's been replaced by two email-only forms (hero and bottom of page) that both POST to/api/cohort-signup.What's needed:
src/app/api/cohort-signup/route.ts{ "email": "..." }, validate it{ "success": true }on 200 or{ "success": false, "error": "..." }on failureOpen questions:
Summary by CodeRabbit
Release Notes
New Features
Style