Deux courbes partagées dans lib/motion.ts, pour que le CSS et Framer aient le même feeling, et quatre primitives que Tailwind ne sait pas exprimer : reflet de bouton, halo qui suit le curseur, soulignement qui se dessine, secousse d'erreur. Nouveaux composants : Stagger (les collections se distribuent une par une), Spotlight (trouve son parent tout seul, donc les cartes restent des composants serveur), ScrollProgress, BackToTop, Parallax, Spinner, CheckMark. Reveal accepte maintenant une direction. Côté rendu : le trait de nav glisse d'un onglet à l'autre, les cartes se soulèvent, le hero réagit au scroll, les piliers entrent en zig-zag, la lightbox glisse dans le sens demandé et les formulaires répondent. prefers-reduced-motion est respecté partout : Framer coupe via useReducedMotion, le CSS via la media query déjà en place. Le commit embarque aussi la réorganisation des composants par domaine qui était en cours dans l'arbre de travail — les deux étaient trop imbriquées pour être séparées proprement. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+44
-3
@@ -1,6 +1,8 @@
|
||||
"use server";
|
||||
|
||||
import { Resend } from "resend";
|
||||
import { autoReplyEmail, staffNotificationEmail } from "@/lib/emails";
|
||||
import { CONTACT_CHANNELS } from "@/lib/site";
|
||||
|
||||
export type ContactState = {
|
||||
status: "idle" | "success" | "error";
|
||||
@@ -20,6 +22,14 @@ export async function sendContact(
|
||||
const message = String(formData.get("message") ?? "").trim();
|
||||
const honeypot = String(formData.get("website") ?? "");
|
||||
|
||||
// Which desk the message is for. Never trusted as-is: it only counts when it
|
||||
// matches a declared channel, so a crafted request cannot inject a label
|
||||
// into the staff email subject.
|
||||
const rawTopic = String(formData.get("topic") ?? "").trim();
|
||||
const topic = CONTACT_CHANNELS.some((channel) => channel.label === rawTopic)
|
||||
? rawTopic
|
||||
: null;
|
||||
|
||||
if (honeypot) {
|
||||
return { status: "success", message: "Thanks for reaching out." };
|
||||
}
|
||||
@@ -54,23 +64,54 @@ export async function sendContact(
|
||||
};
|
||||
}
|
||||
|
||||
// The studio inbox is a single address, so the desk is carried in the
|
||||
// subject line — that is what makes it filterable.
|
||||
const contact = {
|
||||
name,
|
||||
email,
|
||||
subject: topic ? `[${topic}] ${subject}` : subject,
|
||||
message,
|
||||
};
|
||||
|
||||
try {
|
||||
const resend = new Resend(apiKey);
|
||||
|
||||
// Critical: notify the studio staff. If this fails, surface an error.
|
||||
const staff = staffNotificationEmail(contact);
|
||||
const { error } = await resend.emails.send({
|
||||
from,
|
||||
to,
|
||||
replyTo: email,
|
||||
subject: `[Contact] ${subject}`,
|
||||
text: `From: ${name} <${email}>\n\n${message}`,
|
||||
subject: staff.subject,
|
||||
html: staff.html,
|
||||
text: staff.text,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error("[contact] Resend error:", error);
|
||||
console.error("[contact] Resend error (staff):", error);
|
||||
return {
|
||||
status: "error",
|
||||
message: "Something went wrong sending your message. Please try again.",
|
||||
};
|
||||
}
|
||||
|
||||
// Best-effort: send an acknowledgement to the visitor. A failure here
|
||||
// shouldn't fail the whole submission — the staff was already notified.
|
||||
try {
|
||||
const reply = autoReplyEmail(contact);
|
||||
const { error: replyError } = await resend.emails.send({
|
||||
from,
|
||||
to: email,
|
||||
subject: reply.subject,
|
||||
html: reply.html,
|
||||
text: reply.text,
|
||||
});
|
||||
if (replyError) {
|
||||
console.error("[contact] Resend error (auto-reply):", replyError);
|
||||
}
|
||||
} catch (replyErr) {
|
||||
console.error("[contact] Auto-reply failed:", replyErr);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[contact] Unexpected error:", err);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user