Repository navigation
feat: beta label, feedback modal, and privacy update #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
26a6b9c
feat: add beta label to navbar and feedback modal with email via Resend
holkexyz 29981ce
Merge pull request #23 from hypercerts-org/feat/beta-label-feedback
holkexyz 7f5d486
feat: add beta label to navbar and feedback modal with email via Resend
holkexyz 1d172e6
fix: reuse bottom-sheet component for mobile feedback drawer
holkexyz e5d6092
fix: improve mobile feedback drawer UX and persist form content
holkexyz c511057
feat: add More Feedback button to success screen
holkexyz 8eaa164
docs: add Vercel Web Analytics disclosure to privacy policy
holkexyz b9a05fd
fix: address code review feedback from PR #24
holkexyz ec0d4d1
fix: harden CSRF check, fix ARIA placement, add group accounts to ToS
holkexyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { Resend } from "resend"; | ||
|
|
||
| if (!process.env.RESEND_API_KEY) { | ||
| console.warn("RESEND_API_KEY is not set — feedback emails will fail"); | ||
| } | ||
|
|
||
| const resend = new Resend(process.env.RESEND_API_KEY); | ||
| const SUPPORT_EMAIL = "support@hypercerts.org"; | ||
| const FROM_EMAIL = process.env.RESEND_FROM_EMAIL || "Certified <no-reply@certified.one>"; | ||
|
|
||
| export async function POST(req: NextRequest) { | ||
| try { | ||
| // CSRF origin check | ||
| const origin = req.headers.get("origin"); | ||
| const host = req.headers.get("host"); | ||
| if (!origin || !host || !origin.includes(host.split(":")[0])) { | ||
| return NextResponse.json({ error: "Forbidden" }, { status: 403 }); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| const { message, email } = await req.json(); | ||
|
|
||
| if (!message || typeof message !== "string" || !message.trim()) { | ||
| return NextResponse.json({ error: "Message is required" }, { status: 400 }); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| if (email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { | ||
| return NextResponse.json({ error: "Invalid email address" }, { status: 400 }); | ||
| } | ||
|
|
||
| // Send feedback to support | ||
| await resend.emails.send({ | ||
| from: FROM_EMAIL, | ||
| to: SUPPORT_EMAIL, | ||
| subject: "New feedback for Certified.app", | ||
| text: [ | ||
| "New feedback received:", | ||
| "", | ||
| message, | ||
| "", | ||
| email ? `Reply-to: ${email}` : "No email provided", | ||
| ].join("\n"), | ||
| ...(email ? { replyTo: email } : {}), | ||
| }); | ||
|
|
||
| // Send confirmation to user if they provided an email | ||
| if (email) { | ||
| await resend.emails.send({ | ||
| from: FROM_EMAIL, | ||
| to: email, | ||
| subject: "Thank you for your feedback to Certified.app", | ||
| text: [ | ||
| "Thank you for sharing your feedback with us!", | ||
| "", | ||
| "We've received the following message:", | ||
| "", | ||
| `"${message}"`, | ||
| "", | ||
| "We appreciate your input and will review it carefully.", | ||
| "", | ||
| "Best regards,", | ||
| "The Certified Team", | ||
| ].join("\n"), | ||
| }); | ||
| } | ||
|
|
||
| return NextResponse.json({ success: true }); | ||
| } catch (error) { | ||
| console.error("Feedback error:", error); | ||
| return NextResponse.json({ error: "Failed to send feedback" }, { status: 500 }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validation for missing API key.
If
RESEND_API_KEYis not set, the Resend client initialization succeeds but email sending will fail at runtime with an unclear error. Consider failing fast with a clear message.Proposed fix
Or alternatively, return a more helpful error in the handler if the key is missing.
📝 Committable suggestion
🤖 Prompt for AI Agents