diff --git a/app/pricing/components/comparison-table.tsx b/app/pricing/components/comparison-table.tsx index 0ff13d5..7def779 100644 --- a/app/pricing/components/comparison-table.tsx +++ b/app/pricing/components/comparison-table.tsx @@ -16,29 +16,27 @@ export function ComparisonTable({ show }: ComparisonTableProps) { } return ( - + {/* Compare plans title */} -
-
-

- Compare plans -

+
+
+

Compare plans

- + {/* Responsive Table Display */} -
+
- -
+ +
diff --git a/app/pricing/components/mobile-comparison-table.tsx b/app/pricing/components/mobile-comparison-table.tsx index fe7f17f..025fe8b 100644 --- a/app/pricing/components/mobile-comparison-table.tsx +++ b/app/pricing/components/mobile-comparison-table.tsx @@ -12,9 +12,10 @@ export function MobileComparisonTable() { const [selectedPlan, setSelectedPlan] = useState(comparisonPlans[0]); const [isUpgradeDialogOpen, setIsUpgradeDialogOpen] = useState(false); const [isContactDialogOpen, setIsContactDialogOpen] = useState(false); + const [openTooltips, setOpenTooltips] = useState>(new Set()); const handlePlanChange = (planId: string) => { - const plan = comparisonPlans.find(p => p.id === planId); + const plan = comparisonPlans.find((p) => p.id === planId); if (plan) { setSelectedPlan(plan); @@ -29,47 +30,73 @@ export function MobileComparisonTable() { setIsContactDialogOpen(true); }; + const handleTooltipToggle = (featureId: string) => { + setOpenTooltips((prev) => { + const newSet = new Set(prev); + + if (newSet.has(featureId)) { + newSet.delete(featureId); + } else { + newSet.add(featureId); + } + + return newSet; + }); + }; + return ( -
+
{/* Plan Selector */} -
+
- + - + {selectedPlan.name} Plan - - - + + + - + - - + + {comparisonPlans.map((plan) => ( -
- +
+ {plan.name} - + {plan.price.amount} {plan.price.period && ` / ${plan.price.period}`}
- - - + + + @@ -81,45 +108,52 @@ export function MobileComparisonTable() {
{/* Selected Plan Details */} -
-
-

+
+
+

{selectedPlan.name}

- -
+ +
{selectedPlan.price.period ? (
- + {selectedPlan.price.amount} {selectedPlan.price.period && ( - + / {selectedPlan.price.period} )}
) : ( - + {selectedPlan.price.amount} )}
- + {selectedPlan.billingInfo && ( -
+
{selectedPlan.billingInfo}
)} - + {selectedPlan.id !== 'free' && ( - )} @@ -127,47 +161,66 @@ export function MobileComparisonTable() {
{/* Features by Group */} -
+
{comparisonFeatureGroups.map((group) => ( -
+
{/* Group Title */} -
-

+
+

{group.title}

- + {/* Features */} -
+
{group.features.map((feature) => ( -
-
- +
+
+ {feature.name} {feature.tooltip && ( - + { + if (!open) { + setOpenTooltips((prev) => { + const newSet = new Set(prev); + + newSet.delete(feature.id); + + return newSet; + }); + } + }} + > -
+
handleTooltipToggle(feature.id)} + >
{feature.tooltip} - + )}
- -
+ +
{typeof feature.support[selectedPlan.id] === 'string' ? ( - + {feature.support[selectedPlan.id]} ) : feature.support[selectedPlan.id] === true ? ( @@ -182,16 +235,10 @@ export function MobileComparisonTable() {
))}
- - setIsUpgradeDialogOpen(false)} - /> - - + + setIsUpgradeDialogOpen(false)} /> + +
); } \ No newline at end of file