diff --git a/apps/web/src/app/sitemap.ts b/apps/web/src/app/sitemap.ts index 4acd4d4..c0f34d1 100644 --- a/apps/web/src/app/sitemap.ts +++ b/apps/web/src/app/sitemap.ts @@ -57,6 +57,12 @@ export const sitemapRoutes: MetadataRoute.Sitemap = [ changeFrequency: "weekly", priority: 0.7, }, + { + url: "/support", + lastModified: new Date(), + changeFrequency: "monthly", + priority: 0.6, + }, { url: "/privacy", lastModified: new Date(), diff --git a/apps/web/src/app/support/page.tsx b/apps/web/src/app/support/page.tsx new file mode 100644 index 0000000..2debf8a --- /dev/null +++ b/apps/web/src/app/support/page.tsx @@ -0,0 +1,187 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { Navbar } from "@/components/landing/navbar"; +import { Footer } from "@/components/landing/footer"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { authClient } from "@/lib/auth-client"; +import { AlertTriangle, ExternalLink, Github, Mail } from "lucide-react"; + + +const categories = [ + { value: "bug", label: "Bug Report" }, + { value: "feature", label: "Feature Request" }, + { value: "question", label: "Question" }, + { value: "billing", label: "Billing" }, + { value: "other", label: "Other" }, +] as const; + +const GITHUB_NEW_ISSUE = "https://github.com/snhsish/crosscode/issues/new"; + +export default function SupportPage() { + const [category, setCategory] = useState("question"); + const [title, setTitle] = useState(""); + const [description, setDescription] = useState(""); + const [email, setEmail] = useState(""); + + useEffect(() => { + authClient.getSession().then(({ data }) => { + if (data?.user?.email) setEmail(data.user.email); + }); + }, []); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + const issueTitle = `[${categories.find((c) => c.value === category)?.label ?? category}] ${title}`.slice(0, 120); + const bodyParts = [description]; + if (email.trim()) bodyParts.push(`\n---\nContact: ${email.trim()}`); + bodyParts.push("\n_via /support_"); + const body = bodyParts.join("\n\n"); + const params = new URLSearchParams({ + title: issueTitle, + body, + labels: `support,${category}`, + }); + window.location.href = `${GITHUB_NEW_ISSUE}?${params.toString()}`; + }; + + return ( +
+ +
+
+
+

Support

+

+ Need help? Create a GitHub issue and we'll get back to you. +

+
+ +
+
+
+ +
+

This will be public

+

+ Issues created from this form are visible publicly on GitHub. For sensitive or private support, email{" "} + + support@crosscode.site + + {" "}instead. +

+
+
+
+ + + +
+
+ +
+
+ Create a support issue + You'll be redirected to GitHub to submit +
+
+
+ +
+
+ + +
+ +
+ + setTitle(e.target.value)} + required + maxLength={120} + /> +
+ +
+ +