From 5df06340607a8897177bdd1cea8b7917dfb39266 Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 20 Oct 2021 20:29:21 +0200 Subject: [PATCH] remove free plan and features from /settings/billing --- app/public-area/pages/pricing.tsx | 1 - app/settings/components/billing/plans.tsx | 97 +++++++++-------------- 2 files changed, 39 insertions(+), 59 deletions(-) diff --git a/app/public-area/pages/pricing.tsx b/app/public-area/pages/pricing.tsx index b629800..64bd15a 100644 --- a/app/public-area/pages/pricing.tsx +++ b/app/public-area/pages/pricing.tsx @@ -1,7 +1,6 @@ import type { BlitzPage } from "blitz"; import { Link, Routes } from "blitz"; import { HiCheck } from "react-icons/hi"; -import clsx from "clsx"; import * as Panelbear from "@panelbear/panelbear-js"; import BaseLayout from "../components/base-layout"; diff --git a/app/settings/components/billing/plans.tsx b/app/settings/components/billing/plans.tsx index 597f28c..ac0bb47 100644 --- a/app/settings/components/billing/plans.tsx +++ b/app/settings/components/billing/plans.tsx @@ -1,29 +1,28 @@ -import { HiCheck } from "react-icons/hi"; import * as Panelbear from "@panelbear/panelbear-js"; import clsx from "clsx"; +import type { Subscription } from "db"; +import { SubscriptionStatus } from "db"; import useSubscription from "app/core/hooks/use-subscription"; export default function Plans() { const { hasActiveSubscription, subscription, subscribe, changePlan } = useSubscription(); return ( -
+
{pricing.tiers.map((tier) => { - const isFreeTier = tier.planId === -1; const isCurrentTier = subscription?.paddlePlanId === tier.planId; - const isActiveTier = (!hasActiveSubscription && isFreeTier) || (hasActiveSubscription && isCurrentTier); - const cta = isActiveTier ? "Current plan" : !!subscription ? `Switch to ${tier.title}` : "Subscribe"; + const isActiveTier = hasActiveSubscription && isCurrentTier; + const cta = getCTA({ subscription, tier }); return (
-
+

{tier.title}

{tier.yearly ? (

@@ -38,24 +37,6 @@ export default function Plans() {

Billed yearly ({tier.price * 12}€)

) : null}

{tier.description}

- -
    - {tier.features.map((feature) => ( -
  • -
  • - ))} - {tier.unavailableFeatures.map((feature) => ( -
  • - - {~feature.indexOf("(coming soon)") - ? feature.slice(0, feature.indexOf("(coming soon)")) - : feature} - -
  • - ))} -