Skip to content

Conversation

@dekanbro
Copy link

@dekanbro dekanbro commented Jan 26, 2026

Summary by CodeRabbit

  • New Features
    • Email-referral flow added: Join form now captures only email and optional referral.
    • Referral values can be supplied via URL and are forwarded with submissions.
    • New server-side endpoint to submit email referrals, with improved validation and clearer success/error feedback.
    • UI copy and success state updated to reflect the streamlined email referral experience.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
website Ready Ready Preview, Comment Jan 26, 2026 10:02pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Adds an email-referral flow: new POST API route at src/app/api/email-referrals/route.ts, streamlines the JoinUs form to only collect email + optional referral, updates validation, and adds two environment variables for the external API integration.

Changes

Cohort / File(s) Summary
Configuration
env.sample
Adds EMAIL_REFERRALS_API_URL and FORM_INGEST_API_KEY; reintroduces NEXT_PUBLIC_API_URL.
API Endpoint
src/app/api/email-referrals/route.ts
New POST route: validates { email, referral? } with zod, requires env vars, forwards to external API with API key header, handles varied content-types and propagates errors/statuses.
UI — Join Form
src/components/JoinUs.tsx
Replaces multi-field application form with email-only form, accepts referral?: string prop, posts to /api/email-referrals, updates copy/messages and success state.
Component Plumbing
src/app/join/page.tsx, src/components/JoinUsSection.tsx
Page and section components now accept/forward optional ref/referral search param to JoinUs as a prop.
Validation & Helpers
src/lib/validation.ts
Removes ancillary fields from joinUsFormSchema (keeps only email) and deletes transformApplicationDataToApiFormat.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant JoinUs as rgba(66,135,245,0.5) JoinUs Component
    participant Route as rgba(34,197,94,0.5) /api/email-referrals
    participant External as rgba(219,39,119,0.5) External Email API

    User->>JoinUs: submit email (+ optional referral)
    JoinUs->>JoinUs: client-side validation (zod)
    JoinUs->>Route: POST { email, referral? }
    Route->>Route: server validation + env var checks
    Route->>External: POST JSON with API key header
    External-->>Route: 200/4xx/5xx + body (json/text/html)
    Route->>Route: parse response, map status/messages
    Route-->>JoinUs: success or error JSON
    JoinUs->>User: render success or error feedback
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

  • adds link and form events #51 — Modifies JoinUs.tsx and adjusts submission behavior; likely overlaps with endpoint/payload changes.
  • join us success state #35 — Changes submission flow and headers in JoinUs; may conflict with the new API route and payload format.
  • prep deploy #34 — Reworks JoinUs.tsx form structure and fields; could overlap with this PR's field removals.

Poem

🐰 A tiny hop to a brand new route,
An email sent, no fields to flout.
I nibble code, I forward the key,
Friends get listed—join the spree! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective: transforming the application form into an email-focused onboarding flow with referral support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/JoinUs.tsx`:
- Around line 38-40: The JoinUs component uses useSearchParams() which in
Next.js 15 requires a Suspense boundary; update the parent component
(JoinUsSection) to either wrap the <JoinUs /> render in a React.Suspense
boundary (e.g., <Suspense fallback={...}><JoinUs /></Suspense>) or convert
JoinUsSection into a Client Component by adding "use client" at the top of
JoinUsSection.tsx so it can safely call useSearchParams; modify the file that
renders <JoinUs /> (JoinUsSection) and ensure an appropriate fallback is
provided when using Suspense.
🧹 Nitpick comments (1)
src/app/api/email-referrals/route.ts (1)

43-50: Consider adding a timeout to the external API call.

The fetch request has no timeout, which could cause the request to hang indefinitely if the external API is slow or unresponsive. This could exhaust server resources under load.

⏱️ Suggested fix with timeout
     const response = await fetch(apiUrl, {
       method: "POST",
       headers: {
         "Content-Type": "application/json",
         "x-form-api-key": apiKey,
       },
       body: JSON.stringify(validationResult.data),
+      signal: AbortSignal.timeout(10000), // 10 second timeout
     });

Comment on lines 38 to 40
const searchParams = useSearchParams();
const referral =
searchParams.get("referral") ?? searchParams.get("ref") ?? undefined;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if JoinUs component is wrapped in Suspense where it's used
rg -n -A 5 -B 2 '<JoinUs' --type tsx --type ts

# Also check for dynamic import with ssr disabled as alternative
rg -n 'dynamic.*JoinUs' --type tsx --type ts

Repository: raid-guild/website

Length of output: 117


🏁 Script executed:

#!/bin/bash
# Find all TypeScript/TSX files and search for JoinUs usage
fd -e tsx -e ts | xargs rg -n -A 5 -B 2 '<JoinUs'

# Also search for dynamic imports
fd -e tsx -e ts | xargs rg -n 'dynamic.*JoinUs'

# Check the JoinUs.tsx file itself to see imports
cat -n src/components/JoinUs.tsx | head -30

Repository: raid-guild/website

Length of output: 2137


🏁 Script executed:

#!/bin/bash
# Check JoinUsSection.tsx fully
cat -n src/components/JoinUsSection.tsx

# Check join/page.tsx for Suspense or other wrappers
cat -n src/app/join/page.tsx

# Search for Suspense imports in the codebase
rg -n 'import.*Suspense' --type-list | head -20

# Check if Suspense is used anywhere with JoinUs or JoinUsSection
rg -n 'Suspense' src/app/join/page.tsx src/components/JoinUsSection.tsx

Repository: raid-guild/website

Length of output: 1706


🏁 Script executed:

#!/bin/bash
# Search for Suspense usage in codebase
rg -n 'Suspense' --type-list

# Correct search for Suspense
rg -n 'Suspense'

# Check if there's a "use client" in JoinUsSection
cat src/components/JoinUsSection.tsx

# Check root layout or other parent components
cat -n src/app/layout.tsx 2>/dev/null | head -50

Repository: raid-guild/website

Length of output: 2008


🏁 Script executed:

#!/bin/bash
# Check the Providers component
cat -n src/providers/providers.tsx 2>/dev/null || cat -n src/providers.tsx 2>/dev/null

# Check if there are any other Suspense boundaries in the join path
rg -n 'Suspense' src/app/join/ src/components/Join*

# Check Next.js version to confirm it's 15
cat package.json | grep -A 2 -B 2 '"next"'

Repository: raid-guild/website

Length of output: 8958


Add Suspense boundary around JoinUs component.

In Next.js 15, useSearchParams() requires a Suspense boundary to prevent the entire parent tree from becoming dynamic. Wrap <JoinUs /> in JoinUsSection.tsx with <Suspense>, or alternatively mark JoinUsSection as a Client Component with "use client".

🤖 Prompt for AI Agents
In `@src/components/JoinUs.tsx` around lines 38 - 40, The JoinUs component uses
useSearchParams() which in Next.js 15 requires a Suspense boundary; update the
parent component (JoinUsSection) to either wrap the <JoinUs /> render in a
React.Suspense boundary (e.g., <Suspense fallback={...}><JoinUs /></Suspense>)
or convert JoinUsSection into a Client Component by adding "use client" at the
top of JoinUsSection.tsx so it can safely call useSearchParams; modify the file
that renders <JoinUs /> (JoinUsSection) and ensure an appropriate fallback is
provided when using Suspense.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/JoinUs.tsx`:
- Line 51: Remove or redact PII from console logs in the JoinUs component:
eliminate the console.log("Join Us email submitted:", data) in the submit
handler (and any other console.log calls in the same component around lines
73-85) so emails/submit results are not written to client logs; if lightweight
debugging is required, log only non-PII (e.g., success/failure boolean or
anonymized/id-only info) using the same handler functions or submitEmail
function names to locate the places to change.

if (isSubmitting) return; // Prevent multiple submissions

console.log("Join Us form submitted:", data);
console.log("Join Us email submitted:", data);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid logging emails/results to the console (PII exposure).
Client logs can be captured by monitoring tools or shared devices; redact or remove.

🧹 Proposed fix (remove/redact PII from logs)
-    console.log("Join Us email submitted:", data);
+    console.log("Join Us email submitted");

...
-        console.log("Email referral submitted successfully:", result);
+        console.log("Email referral submitted successfully");

...
-        console.error("Failed to submit email referral:", result);
+        console.error("Failed to submit email referral");

Also applies to: 73-85

🤖 Prompt for AI Agents
In `@src/components/JoinUs.tsx` at line 51, Remove or redact PII from console logs
in the JoinUs component: eliminate the console.log("Join Us email submitted:",
data) in the submit handler (and any other console.log calls in the same
component around lines 73-85) so emails/submit results are not written to client
logs; if lightweight debugging is required, log only non-PII (e.g.,
success/failure boolean or anonymized/id-only info) using the same handler
functions or submitEmail function names to locate the places to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants