/* global React, Icons */ // ============================================================ // Contact — support page with a working contact form // Operated by Nestaa · get-resume // ============================================================ const { useState } = React; const CONTACT_EMAIL = "care@get-resume.com"; const TOPICS = ["General question", "Billing & Pro", "Bug report", "Feature request", "Partnership", "Other"]; const CHANNELS = [ { ic: Icons.mail, label: "Email us", value: CONTACT_EMAIL, sub: "We read every message", href: `mailto:${CONTACT_EMAIL}` }, { ic: Icons.bolt, label: "Response time", value: "Within 2 business days", sub: "Usually much faster" }, { ic: Icons.globe, label: "Operated by", value: "Nestaa", sub: "Mon–Fri · 9am–6pm IST" }, ]; const isEmail = (s) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s); function ContactPage({ onHome, onBack }) { React.useEffect(() => { window.scrollTo(0, 0); }, []); const [form, setForm] = useState({ name: "", email: "", topic: TOPICS[0], message: "" }); const [touched, setTouched] = useState({}); const [sent, setSent] = useState(false); const [busy, setBusy] = useState(false); const [stored, setStored] = useState(false); const set = (k, v) => setForm((f) => ({ ...f, [k]: v })); const blur = (k) => setTouched((t) => ({ ...t, [k]: true })); const errs = { name: form.name.trim() ? "" : "Please tell us your name", email: isEmail(form.email.trim()) ? "" : "Enter a valid email address", message: form.message.trim().length >= 10 ? "" : "Add a little more detail (10+ characters)", }; const valid = !errs.name && !errs.email && !errs.message; const submit = async (e) => { e.preventDefault(); setTouched({ name: true, email: true, message: true }); if (!valid || busy) return; // Persist to the contact_messages table when the backend is connected. if (window.sb) { setBusy(true); try { const uid = (window.RBAuth && window.RBAuth.user()) ? window.RBAuth.user().id : null; const { error } = await window.sb.from("contact_messages").insert({ name: form.name.trim(), email: form.email.trim(), topic: form.topic, message: form.message.trim(), user_id: uid, }); if (error) throw error; setStored(true); } catch (e2) { console.warn("contact insert failed, falling back to mailto:", e2); setStored(false); } setBusy(false); } setSent(true); }; const mailtoHref = `mailto:${CONTACT_EMAIL}?subject=${encodeURIComponent("[" + form.topic + "] from " + (form.name || "a visitor"))}&body=${encodeURIComponent(form.message + "\n\n— " + form.name + " (" + form.email + ")")}`; return (
Thanks, {form.name.split(" ")[0] || "there"}! We've logged your message and will reply to {form.email} within 2 business days.
> ) : ( <>Thanks, {form.name.split(" ")[0] || "there"}! Tap below to send it from your mail app — we'll reply to {form.email} within 2 business days.
Open in mail app