"use client"; import Link from "next/link"; import { useState } from "react"; import { CREDIT_PRICE_CENTS, CREDIT_PURCHASE_MAX, CREDIT_PURCHASE_MIN, formatCreditPrice, } from "@/lib/credits"; export function PaygPriceCalculator() { const [videos, setVideos] = useState(CREDIT_PURCHASE_MIN); const total = formatCreditPrice(videos); const unit = formatCreditPrice(1); return (

Pay as you go

Choose how many videos you need

{unit} per video · minimum {CREDIT_PURCHASE_MIN} videos ( {formatCreditPrice(CREDIT_PURCHASE_MIN)})

{ const n = Math.floor(Number(e.target.value)); if (!Number.isFinite(n)) return; setVideos( Math.min(CREDIT_PURCHASE_MAX, Math.max(CREDIT_PURCHASE_MIN, n)), ); }} className="w-20 rounded border border-gray-600 bg-surface-dark px-3 py-2 text-center text-lg font-semibold text-white focus:border-accent focus:outline-none" />
setVideos(Number(e.target.value))} className="mt-4 w-full accent-amber-400" aria-valuemin={CREDIT_PURCHASE_MIN} aria-valuemax={CREDIT_PURCHASE_MAX} aria-valuenow={videos} aria-label="Number of videos" />
{CREDIT_PURCHASE_MIN} {CREDIT_PURCHASE_MAX}

Total

{total}

{videos} × {unit}{" "} (€{(CREDIT_PRICE_CENTS / 100).toFixed(2)} each)

Buy credits
); }