From d9a8115bade02e5c0ddeb4ce8dcb7d6d40d5cd88 Mon Sep 17 00:00:00 2001 From: Sam Rizvi Date: Fri, 10 Nov 2023 18:13:35 -0800 Subject: [PATCH] fix: pricing page display issue #42 - fix TypeError by adding optional chaining to subscriptionPlan - couldn't resist making a style change or two - made the checkmarks more shadcn'y - made the heading more tailwindy - improved messaging for interval - updated copy - made the switch more andvoila'y Closes #42 --- app/components/pricing-cards.tsx | 63 +++++++++++++++----------------- app/components/ui/switch.tsx | 4 +- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/app/components/pricing-cards.tsx b/app/components/pricing-cards.tsx index 1f4cc9be..78315c59 100644 --- a/app/components/pricing-cards.tsx +++ b/app/components/pricing-cards.tsx @@ -18,7 +18,7 @@ interface PricingCardsProps { } export function PricingCards({ userId, subscriptionPlan }: PricingCardsProps) { - const isYearlyDefault = subscriptionPlan!.interval === 'year' ? true : false; + const isYearlyDefault = subscriptionPlan?.interval === 'year' ? true : false; const [isYearly, setIsYearly] = useState(!!isYearlyDefault); const signInModal = useSigninModal(); @@ -28,13 +28,18 @@ export function PricingCards({ userId, subscriptionPlan }: PricingCardsProps) { return (
-
+

- Pricing + Membership Plans

-

- Start at full speed ! +

+ Crush your marketing goals

+

+ Propel your digital marketing journey with Early Access. Dive into a + world of cutting-edge Playbooks, AI-enhanced tools, and a vibrant + community that’s always one step ahead. +

@@ -54,44 +59,34 @@ export function PricingCards({ userId, subscriptionPlan }: PricingCardsProps) { className="relative flex flex-col overflow-hidden rounded-xl border bg-card" key={offer.title} > -
+

{offer.title}

- -
-
-
- {isYearly && offer.prices.monthly > 0 ? ( - <> - - ${offer.prices.monthly} - - ${Math.floor(offer.prices.yearly / 12)} - - ) : ( - `$${offer.prices.monthly}` - )} -
-
-
/mo
-
-
+
+ + {isYearly && offer.prices.monthly > 0 ? ( + <> + ${Math.floor(offer.prices.yearly / 12)} + + ) : offer.prices.monthly > 0 ? ( + `$${offer.prices.monthly}` + ) : ( + 'Free' + )} + + {offer.prices.monthly > 0 && ( + + /month{isYearly ? ', billed yearly' : ''} + + )}
- {offer.prices.monthly > 0 ? ( -
- {isYearly - ? `You'll be billed $${offer.prices.yearly} now for the year.` - : 'billed monthly'} -
- ) : null}
-
    {offer.benefits.map((feature) => (
  • - +

    {feature}

  • ))} diff --git a/app/components/ui/switch.tsx b/app/components/ui/switch.tsx index d33dbfc5..aca94f31 100644 --- a/app/components/ui/switch.tsx +++ b/app/components/ui/switch.tsx @@ -11,7 +11,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => (