Skip to content

Connect Contact Form to API#23

Draft
WebCraftPhil wants to merge 2 commits into
mainfrom
connect-contact-form-to-api-10625935743152677322
Draft

Connect Contact Form to API#23
WebCraftPhil wants to merge 2 commits into
mainfrom
connect-contact-form-to-api-10625935743152677322

Conversation

@WebCraftPhil

@WebCraftPhil WebCraftPhil commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Successfully replaced the mock setTimeout functionality in ContactSection.tsx with a real API call to the /api/contact backend endpoint. The implementation uses the existing apiRequest utility and follows the project's established patterns for form submission, error handling, and toast notifications. Verified the changes through manual code review and chunked file reading.


PR created automatically by Jules for task 10625935743152677322 started by @WebCraftPhil

Summary by Sourcery

Connect the contact form submission to the backend contact API instead of using a mock delay.

New Features:

  • Send contact form data to the /api/contact endpoint using the shared API request utility.

Enhancements:

  • Add success and error toast handling around contact form submission, including proper submit state cleanup.

Replaced the mock `setTimeout` functionality in `ContactSection.tsx` with a functional call to the `/api/contact` endpoint using the `apiRequest` utility. Added proper error handling, form-reset logic, and user notifications via the `toast` hook.

Summary of changes:
- Imported `apiRequest` in `client/src/components/ContactSection.tsx`
- Refactored `handleSubmit` to perform an asynchronous POST request
- Integrated success and error toasts for user feedback
- Cleared form state on successful submission

Co-authored-by: WebCraftPhil <118385120+WebCraftPhil@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
philgreene-net Ready Ready Preview, Comment Apr 22, 2026 1:53am

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7edfd624-88b5-4d80-8b27-5ec800bd04a6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch connect-contact-form-to-api-10625935743152677322

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.

@sourcery-ai

sourcery-ai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces the mocked contact form submission delay with a real POST request to the /api/contact endpoint using the shared apiRequest helper, adding success and error toasts and ensuring submit state is correctly reset in all cases.

Sequence diagram for contact form submission via /api/contact

sequenceDiagram
  actor User
  participant ContactSection
  participant apiRequest
  participant Backend_api_contact

  User->>ContactSection: Submit contact form
  activate ContactSection
  ContactSection->>ContactSection: setIsSubmitting(true)
  ContactSection->>apiRequest: apiRequest(POST, /api/contact, formData)
  activate apiRequest
  apiRequest->>Backend_api_contact: POST /api/contact
  Backend_api_contact-->>apiRequest: Response (success or error)
  deactivate apiRequest
  alt Successful submission
    apiRequest-->>ContactSection: Resolved response
    ContactSection->>ContactSection: toast(Message Sent)
    ContactSection->>ContactSection: reset formData
  else Failed submission
    apiRequest-->>ContactSection: Thrown error
    ContactSection->>ContactSection: toast(Error, destructive)
  end
  ContactSection->>ContactSection: setIsSubmitting(false)
  deactivate ContactSection
Loading

File-Level Changes

Change Details Files
Wire contact form submission to backend API with proper success, error handling, and submit-state cleanup.
  • Import shared apiRequest helper for HTTP calls.
  • Replace setTimeout-based mock submission with an awaited POST request to the /api/contact endpoint using the current form data.
  • Show existing success toast and reset form fields on successful request.
  • Add error toast that surfaces the error message when available and uses a destructive style variant.
  • Ensure isSubmitting is reset in a finally block so the submit button state recovers after both success and failure.
client/src/components/ContactSection.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@WebCraftPhil

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

@google-labs-jules

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

I have verified that there are no merge conflicts with the main branch in this pull request. The changes are ready to be merged.

Replaced the mock `setTimeout` functionality in `ContactSection.tsx` with a functional call to the `/api/contact` endpoint using the `apiRequest` utility. Added proper error handling, form-reset logic, and user notifications via the `toast` hook.

Summary of changes:
- Imported `apiRequest` in `client/src/components/ContactSection.tsx`
- Refactored `handleSubmit` to perform an asynchronous POST request
- Integrated success and error toasts for user feedback
- Cleared form state on successful submission

Co-authored-by: WebCraftPhil <118385120+WebCraftPhil@users.noreply.github.com>
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.

1 participant