An admin can pick a package when inviting: each invitee gets a promo code (in the e-mail and its preview, kept on resend), redeemed by itself at sign up; revoking the invitation withdraws it, and the list shows the package. Redeeming a promo code now fills the units up to the package's amounts: used units come back, more than that stays. A code that would add nothing stays open, with a message saying so; the answer tells what was added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { Metadata } from "next";
|
|
|
|
import { RedeemCode } from "@/components/RedeemCode";
|
|
import { requireMe } from "@/lib/server";
|
|
|
|
export const metadata: Metadata = { title: "Promókód beváltása", robots: { index: false } };
|
|
|
|
type Props = { searchParams: Promise<{ kod?: string }> };
|
|
|
|
/** Redeeming a promo code; `?kod=` fills it in (links in invitations). */
|
|
export default async function RedeemPage({ searchParams }: Props) {
|
|
const { kod } = await searchParams;
|
|
await requireMe(kod ? `/bevaltas?kod=${encodeURIComponent(kod)}` : "/bevaltas");
|
|
return (
|
|
<main className="page" style={{ maxWidth: 640 }}>
|
|
<div className="page-head">
|
|
<span className="eyebrow">Promókód</span>
|
|
<h1>Promókód beváltása</h1>
|
|
<p className="muted">
|
|
Írd be a kapott kódot. Az egyenlegedet azonnal feltöltjük a csomag szintjéig: amit már elhasználtál belőle,
|
|
visszakapod, ami ennél több van, megmarad. Egy kód egyszer váltható be.
|
|
</p>
|
|
</div>
|
|
<section className="card">
|
|
<RedeemCode initial={kod ?? ""} />
|
|
</section>
|
|
</main>
|
|
);
|
|
}
|