diff --git a/src/middleware.ts b/src/middleware.ts index 9a70278..c4a8bdc 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -164,10 +164,21 @@ async function handlePayuReturn(fetchEvent: any): Promise { }); } +// Pre-launch: nxtgauge.com/www.nxtgauge.com show the coming-soon page instead +// of the real app. This is the *only* difference between that domain and the +// live app (same deployment, same ingress backend) - flip it off by deleting +// this block (and the /coming-soon route) once ready to launch. +const COMING_SOON_HOSTS = new Set(["nxtgauge.com", "www.nxtgauge.com"]); + export default createMiddleware({ onRequest: async (fetchEvent) => { const url = new URL(fetchEvent.request.url); const path = url.pathname; + const host = fetchEvent.request.headers.get("host")?.split(":")[0] ?? ""; + + if (COMING_SOON_HOSTS.has(host) && path === "/") { + return Response.redirect(new URL("/coming-soon", url), 302); + } // Only handle /api/* paths if (!path.startsWith("/api/")) return; diff --git a/src/routes/coming-soon.tsx b/src/routes/coming-soon.tsx new file mode 100644 index 0000000..f6f4cb9 --- /dev/null +++ b/src/routes/coming-soon.tsx @@ -0,0 +1,309 @@ +import { createSignal, Show } from "solid-js"; +import { Title, Meta, Link } from "@solidjs/meta"; + +async function apiFetch(path: string, opts?: RequestInit) { + return fetch(path, { + ...opts, + headers: { + "Content-Type": "application/json", + ...(opts?.headers ?? {}), + }, + }); +} + +export default function ComingSoonPage() { + const [email, setEmail] = createSignal(""); + const [submitting, setSubmitting] = createSignal(false); + const [submitted, setSubmitted] = createSignal(false); + const [error, setError] = createSignal(false); + + const handleSubmit = async (e: Event) => { + e.preventDefault(); + const value = email().trim(); + if (!value || submitting()) return; + + setError(false); + setSubmitting(true); + try { + const res = await apiFetch("/api/waitlist", { + method: "POST", + body: JSON.stringify({ email: value }), + }); + if (!res.ok) throw new Error("Request failed"); + setSubmitted(true); + } catch { + setError(true); + } finally { + setSubmitting(false); + } + }; + + return ( + <> + Nxtgauge — Coming Soon + + + + + + + + + +
+