Skip to content

Implement ContactPage submission flow and remove placeholder TODO - #4

Merged
naved42 merged 1 commit into
mainfrom
copilot/update-repo-with-comments
Sep 6, 2026
Merged

naved42 merged 1 commit into
mainfrom
copilot/update-repo-with-comments

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The contact page had a non-functional submit handler with a TODO and debug logging. This change wires the form to a usable submission path and adds minimal UX state handling around submission.

  • Submission behavior

    • Replaced placeholder submit logic with a mailto:-based flow that pre-fills subject and body from form inputs.
    • Standardized subject prefix to [WhyAnalyst] for inbound triage consistency.
  • Form state and UX

    • Added isSubmitting state to disable the submit button during submit initiation.
    • Added submitError state to surface failures when an email client cannot be opened.
    • Preserved success feedback and reset form fields after successful submission trigger.
  • Code cleanup

    • Removed TODO/debug-style submission placeholder behavior (console.log-only path) from ContactPage.
const emailSubject = encodeURIComponent(`[WhyAnalyst] ${formData.subject.trim()}`);
const emailBody = encodeURIComponent(
  `Name: ${formData.name.trim()}\nEmail: ${formData.email.trim()}\n\n${formData.message.trim()}`
);
window.location.href = `mailto:support@whyanalyst.com?subject=${emailSubject}&body=${emailBody}`;

Co-authored-by: naved42 <237417103+naved42@users.noreply.github.com>
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
whyanalyst Error Error Sep 3, 2026 4:25pm UTC

@naved42
naved42 requested review from naved42 and a lite review from Copilot September 3, 2026 16:25

@naved42 naved42 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Updated whyanalyst repo.

@naved42
naved42 marked this pull request as ready for review September 3, 2026 16:26
@naved42

naved42 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The current isSubmitting/error-handling logic is ineffective due to synchronous state batching and a try/catch that likely never triggers for mailto: navigation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR implements a working submission flow for the ContactPage by replacing the placeholder submit handler with a mailto:-based submission, and adds basic submission UI states (submitting + error feedback).

Changes:

  • Replaced the TODO/console.log submit handler with a mailto: URL that pre-fills subject/body.
  • Added isSubmitting and submitError UI state, including disabling the submit button and rendering an error message.
File summaries
File Description
src/components/ContactPage.tsx Implements mailto: submission flow and adds minimal submission UX state (submitting + error message).
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +29 to +44
try {
// Route submissions through the user's email client until a backend contact endpoint is added.
const emailSubject = encodeURIComponent(`[WhyAnalyst] ${formData.subject.trim()}`);
const emailBody = encodeURIComponent(
`Name: ${formData.name.trim()}\nEmail: ${formData.email.trim()}\n\n${formData.message.trim()}`
);
window.location.href = `mailto:support@whyanalyst.com?subject=${emailSubject}&body=${emailBody}`;

setSubmitted(true);
setFormData({ name: '', email: '', subject: '', message: '' });
setTimeout(() => setSubmitted(false), 3000);
} catch {
setSubmitError('Unable to open your email client. Please email support@whyanalyst.com directly.');
} finally {
setIsSubmitting(false);
}
Comment on lines 211 to 215
<button
type="submit"
disabled={isSubmitting}
className="w-full py-3 bg-brand-primary text-white font-bold rounded-lg hover:bg-brand-primary/90 transition-all flex items-center justify-center gap-2"
>
@naved42
naved42 merged commit 5d2a867 into main Sep 6, 2026
2 of 3 checks passed
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.

3 participants