"use client"; import { useActionState } from "react"; import Link from "next/link"; import { useTranslations } from "next-intl"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { TENANT_TIERS, type TenantTier } from "@/lib/plans"; import type { PlatformPlanState } from "@/server/actions/plans-platform"; /** L17 Pakete: operator form (tier, seats, hard limit) with mandatory confirmation checkbox. */ export function PlanForm({ action, tier, seats, hardLimit, maxSeats, closeHref, }: { action: (prev: PlatformPlanState, fd: FormData) => Promise; tier: TenantTier; seats: number; hardLimit: boolean; maxSeats: number; closeHref: string; }) { const t = useTranslations("plans.platform"); const tt = useTranslations("plans"); const [state, formAction, pending] = useActionState(action, { status: "idle" }); return (
{t("tier")}
{TENANT_TIERS.map((v) => ( ))}

{t("downgradeHint")}

{t("seatsHint")}

{state.status === "error" && (

{t.has(`errors.${state.code}`) ? t(`errors.${state.code}`) : t("errors.failed")}

)}
); }