import { Badge } from '@/components/ui/Badge'; import { Button } from '@/components/ui/Button'; import { BorderGlow } from '@/components/effects/BorderGlow'; import { cn } from '@/lib/cn'; import { formatPrice, formatQuota } from '@/lib/billing-format'; import { RECOMMENDED_PLAN, SUBSCRIPTION_PLANS } from '@/lib/constants'; import { MODULE_COLOR } from '@/lib/module-colors'; import type { PlanPublic, SubscriptionPlan } from '@/types'; const mc = MODULE_COLOR.billing; interface PlanGridProps { plans: PlanPublic[]; currentPlan: SubscriptionPlan | undefined; selectedPlan: SubscriptionPlan | undefined; onSelect: (plan: SubscriptionPlan) => void; } export function PlanGrid({ plans, currentPlan, selectedPlan, onSelect }: PlanGridProps) { const priced = new Map(plans.map((p) => [p.plan, p])); return (
{SUBSCRIPTION_PLANS.map((copy) => { const pricing = priced.get(copy.plan); if (!pricing) return undefined; const isCurrent = currentPlan === copy.plan; const isSelected = selectedPlan === copy.plan; const isRecommended = copy.plan === RECOMMENDED_PLAN; return (

{copy.name}

{isCurrent && Current} {!isCurrent && isRecommended && Popular}

{formatPrice(pricing.price_cents, pricing.currency)}

/ mo

{formatQuota(pricing.quota_tokens)}

{copy.tagline}

    {copy.features.map((feature) => (
  • > {feature}
  • ))}
); })}
); }