"use client"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { api, errorText } from "@/lib/api"; /** * Person packages: a few more persons, or any number. Until Stripe is * connected the payment is a stand-in (MOCK_PAYMENTS) that grants it at once. */ export function PersonPacks({ packSize, canPay }: { packSize: number; canPay: boolean }) { const router = useRouter(); const [busy, setBusy] = useState(null); const [error, setError] = useState(null); async function buy(pkg: "persons" | "persons_unlimited") { setBusy(pkg); setError(null); try { await api("/payments/mock", { body: { package: pkg } }); router.refresh(); } catch (e) { setError(errorText(e)); } finally { setBusy(null); } } if (!canPay) { return

További személyekhez csomag kell; a csomagok hamarosan elérhetők.

; } return (
+{packSize} személy Még {packSize} ember képlete és elemzése.
Korlátlan Bárkit felvehetsz, nincs felső határ.
{error && (

{error}

)}

Tesztüzem: a fizetés még nincs bekötve, a gomb nem terhel semmit.

); }