Files
cal.diy/apps/web/components/settings/platform/pricing/billing-card/index.tsx
T
Rajiv SahalandPeer Richelsen 3371602e0f feat: billing tab for platform (#16755)
* modules for platform plans and billing pages

* add platform billing and plans related pages

* update platform navigation to include billing tab

* custom hook to upgrade team subscription

* refactors

* export cta row component

* fixup

* only pass in subscription id instead of whole subscription

* refactor :teamId/subscribe endpoint logic, add endpoint for upgrading stripe and shift all webhooks logic into services

* refactor team subscription logic, add logic for upgrading stripe and  webhooks logic from billing controller

---------

Co-authored-by: Peer Richelsen <[email protected]>
2024-09-23 13:36:03 +03:00

71 lines
1.8 KiB
TypeScript

import { Button } from "@calcom/ui";
type PlatformBillingCardProps = {
plan: string;
description: string;
pricing?: number;
includes: string[];
isLoading?: boolean;
currentPlan?: boolean;
handleSubscribe?: () => void;
};
export const PlatformBillingCard = ({
plan,
description,
pricing,
includes,
isLoading,
handleSubscribe,
currentPlan,
}: PlatformBillingCardProps) => {
return (
<div className="border-subtle max-w-[450px] rounded-2xl border p-5 md:mx-4">
<div className="pb-5">
<h1 className="border-b-[1px] pb-2 pt-1 text-center text-2xl font-bold">
{plan}
{currentPlan && (
<>
<Button
type="button"
StartIcon="circle-check"
className="bg-default hover:bg-default cursor-none text-green-500 hover:cursor-pointer"
tooltip="This is your current plan"
/>
</>
)}
</h1>
<p className="pb-5 pt-3 text-base">{description}</p>
<h1 className="text-3xl font-semibold">
{pricing && (
<>
US${pricing} <span className="text-sm">per month</span>
</>
)}
</h1>
</div>
{!currentPlan && (
<div>
<Button
loading={isLoading}
onClick={handleSubscribe}
className="flex w-[100%] items-center justify-center">
{pricing ? "Subscribe" : "Schedule a time"}
</Button>
</div>
)}
<div className="mt-5">
<p>This includes:</p>
{includes.map((feature) => {
return (
<div key={feature} className="my-2 flex">
<div className="pr-2">&bull;</div>
<div>{feature}</div>
</div>
);
})}
</div>
</div>
);
};