import React, { useState } from 'react'; import { PlanCard } from './PlanCard'; import type { SubscriptionPlan, BillingCycle } from '../types'; interface PlanSelectorProps { plans: SubscriptionPlan[]; selectedPlanId?: string; currentPlanId?: string; onSelect: (plan: SubscriptionPlan, billingCycle: BillingCycle) => void; isLoading?: boolean; } export const PlanSelector: React.FC = ({ plans, selectedPlanId, currentPlanId, onSelect, isLoading = false, }) => { const [billingCycle, setBillingCycle] = useState('monthly'); const activePlans = plans.filter((plan) => plan.isActive && plan.isPublic); if (isLoading) { return (
); } if (activePlans.length === 0) { return (

No hay planes disponibles

); } return (
{activePlans.map((plan) => ( onSelect(p, billingCycle)} /> ))}
); };