From eb73d10795f509fcd6c28687c31beab85624974f Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 19:55:33 +0000 Subject: [PATCH] Add src/components/sections/pricing/PricingCardOneWithSaving.tsx --- .../pricing/PricingCardOneWithSaving.tsx | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/components/sections/pricing/PricingCardOneWithSaving.tsx diff --git a/src/components/sections/pricing/PricingCardOneWithSaving.tsx b/src/components/sections/pricing/PricingCardOneWithSaving.tsx new file mode 100644 index 0000000..e1455f2 --- /dev/null +++ b/src/components/sections/pricing/PricingCardOneWithSaving.tsx @@ -0,0 +1,78 @@ +'use client'; + +import { useWorkoutStorage } from '@/hooks/useWorkoutStorage'; +import PricingCardOne from './PricingCardOne'; + +interface NutritionPlan { + id: string; + badge: string; + badgeIcon?: any; + price: string; + subtitle: string; + features: string[]; +} + +interface PricingCardOneWithSavingProps { + title: string; + description: string; + tag?: string; + tagIcon?: any; + plans: NutritionPlan[]; + animationType: 'none' | 'opacity' | 'slide-up' | 'scale-rotate' | 'blur-reveal' | 'depth-3d'; + textboxLayout: 'default' | 'split' | 'split-actions' | 'split-description' | 'inline-image'; + useInvertedBackground: boolean; + onNutritionPlanSelected?: (planData: any) => void; +} + +export function PricingCardOneWithSaving({ + title, + description, + tag, + tagIcon, + plans, + animationType, + textboxLayout, + useInvertedBackground, + onNutritionPlanSelected, +}: PricingCardOneWithSavingProps) { + const { saveWorkout } = useWorkoutStorage(); + + const handlePlanSelection = (planId: string, planBadge: string) => { + const nutritionData = { + type: 'nutrition' as const, + date: new Date().toISOString().split('T')[0], + data: { + plan: planBadge, + planId, + selectedAt: Date.now(), + }, + }; + saveWorkout(nutritionData as any); + onNutritionPlanSelected?.(nutritionData); + }; + + const enhancedPlans = plans.map(plan => ({ + ...plan, + buttons: plan.buttons || [ + { + text: 'Selecionar', + onClick: () => handlePlanSelection(plan.id, plan.badge), + }, + ], + })); + + return ( + + ); +} + +export default PricingCardOneWithSaving; \ No newline at end of file