MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / PricingView

Function PricingView

src/components/PricingView.tsx:32–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30};
31
32const PricingView = () => {
33 const { t } = useTranslation();
34 const { data: session, status } = useSession();
35
36 const tiers = [
37 {
38 name: t("setting.plan.1-month"),
39 priceId: process.env.NEXT_PUBLIC_STRIPE_PRICE_ID_PRO_1_MONTH_SUBSCRIPTION,
40 priceMonthly: "$10",
41 buyButton: t("setting.plan.purhcase-1-month"),
42 },
43 {
44 name: t("setting.plan.n-months", {
45 count: 3,
46 }),
47 priceId: process.env.NEXT_PUBLIC_STRIPE_PRICE_ID_PRO_3_MONTH_SUBSCRIPTION,
48 priceMonthly: "$15",
49 buyButton: t("setting.plan.purhcase-n-months", {
50 count: 3,
51 }),
52 },
53 {
54 name: t("setting.plan.n-months", {
55 count: 12,
56 }),
57 priceId: process.env.NEXT_PUBLIC_STRIPE_PRICE_ID_PRO_1_YEAR_SUBSCRIPTION,
58 priceMonthly: "$30",
59 buyButton: t("setting.plan.purhcase-n-months", {
60 count: 12,
61 }),
62 },
63 ];
64
65 return (
66 <div className="bg-white dark:bg-zinc-800 py-4">
67 <div className="mx-auto max-w-4xl text-center">
68 <p className="mt-6 text-4xl font-bold tracking-tight sm:text-5xl">
69 {t("setting.plan.n-question-per-month", {
70 count: 1000,
71 })}
72 </p>
73 </div>
74 <div className="mt-12 flow-root">
75 <div className="isolate -mt-16 grid max-w-sm grid-cols-1 gap-y-16 divide-y divide-gray-100 sm:mx-auto lg:-mx-8 lg:mt-0 lg:max-w-none lg:grid-cols-3 lg:divide-x lg:divide-y-0 xl:-mx-4">
76 {tiers.map((tier) => (
77 <div key={tier.priceId} className="pt-16 lg:px-8 lg:pt-0 xl:px-14 flex flex-col justify-center">
78 <h3 id={tier.priceId} className="text-center text-3xl font-semibold leading-7">
79 {tier.name} - {tier.priceMonthly}
80 </h3>
81 <button
82 onClick={() => (session?.user?.email ? checkout(tier.priceId) : signIn())}
83 className="mt-6 block rounded-md bg-indigo-600 px-4 py-2.5 text-center text-xl font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
84 >
85 {session?.user?.email ? tier.buyButton : t("payment.sign-in-to-buy")}
86 </button>
87 </div>
88 ))}
89 </div>

Callers

nothing calls this directly

Calls 1

checkoutFunction · 0.85

Tested by

no test coverage detected