"use client"; import { useState } from "react"; import { setAccessCode } from "@/lib/api"; import { BidArcade } from "./BidArcade"; // Simple shared-code gate. Not real auth — one code shared with viewers — // but it stops anonymous bots from spending the owner's API credits. The // code is entered at runtime and kept in sessionStorage, never in the bundle. export function AccessGate({ onUnlock, rejected = false, }: { onUnlock: () => void; rejected?: boolean; }) { const [code, setCode] = useState(""); function submit() { const c = code.trim(); if (!c) return; setAccessCode(c); onUnlock(); } return (
Ask more, know faster, pay less
{/* the bots warming up — same auction animation shown before a query */}this demo needs an invite code to keep it free for everyone. enter the code you were given.
setCode(e.target.value)} onKeyDown={(e) => e.key === "Enter" && submit()} placeholder="invite code" autoFocus className="w-full border-2 border-stone-700 bg-black px-3 py-2 text-center text-stone-200 outline-none placeholder:text-stone-600 focus:border-orange-500" /> {rejected && (that code didn't work — try again.
)}