🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor pricing and subscription components for improved readability and feature updates
Bill Yang5d2b32b59311
diff --git a/client/src/app/subscribe/components/utils.ts b/client/src/app/subscribe/components/utils.tsindex a84970767..1b84d2ddd 100644--- a/client/src/app/subscribe/components/utils.ts+++ b/client/src/app/subscribe/components/utils.ts@@ -10,24 +10,15 @@ export interface StripePrice {};}-export const EVENT_TIERS = [- 100_000,- 250_000,- 500_000,- 1_000_000,- 2_000_000,- 5_000_000,- 10_000_000,- "Custom",-];+export const EVENT_TIERS = [100_000, 250_000, 500_000, 1_000_000, 2_000_000, 5_000_000, 10_000_000, "Custom"];export const PRO_FEATURES = ["Unlimited websites","Unlimited team members",+ "Session replays","Real-time analytics","Web vitals","Custom events",- "Sessions","Funnels","Goals","Journeys",@@ -58,14 +49,11 @@ export function findPriceForTier((plan) =>(isAnnual? plan.name.startsWith("pro") && plan.name.includes("-annual")- : plan.name.startsWith("pro") && !plan.name.includes("-annual")) &&- plan.interval === interval+ : plan.name.startsWith("pro") && !plan.name.includes("-annual")) && plan.interval === interval);// Find a plan that matches or exceeds the event limit- const matchingPlan = plans.find(- (plan) => plan.limits.events >= eventLimitValue- );+ const matchingPlan = plans.find((plan) => plan.limits.events >= eventLimitValue);const selectedPlan = matchingPlan || plans[plans.length - 1] || null;// Return the matching plan or the highest tier availablediff --git a/docs/src/app/pricing/components/ComparisonSection.jsx b/docs/src/app/pricing/components/ComparisonSection.jsxindex 5daf931db..f1a9c316b 100644--- a/docs/src/app/pricing/components/ComparisonSection.jsx+++ b/docs/src/app/pricing/components/ComparisonSection.jsx@@ -52,6 +52,11 @@ const COMPARISON_FEATURES = [free: false,pro: true,},+ {+ name: "Session replays",+ free: false,+ pro: true,+ },{name: "Web vitals",free: false,@@ -165,9 +170,7 @@ function FeatureCell({ value, isPro = false }) {);}- return (- <span className={cn("text-sm text-center block text-white")}>{value}</span>- );+ return <span className={cn("text-sm text-center block text-white")}>{value}</span>;}export function ComparisonSection() {@@ -192,10 +195,7 @@ export function ComparisonSection() {</div><div className="flex flex-col items-center justify-center px-6 border-r border-neutral-700/50"><div className="font-semibold text-lg text-center mb-3">- Free{" "}- <span className="text-sm text-neutral-400 font-normal">- $0/month- </span>+ Free <span className="text-sm text-neutral-400 font-normal">$0/month</span></div><ahref="https://app.rybbit.io/signup"@@ -206,10 +206,7 @@ export function ComparisonSection() {</div><div className="flex flex-col items-center justify-center px-6"><div className="font-semibold text-lg text-emerald-400 text-center mb-3">- Pro{" "}- <span className="text-sm text-neutral-400 font-normal">- Starting at $19/month- </span>+ Pro <span className="text-sm text-neutral-400 font-normal">Starting at $19/month</span></div><ahref="https://app.rybbit.io/signup"@@ -227,9 +224,7 @@ export function ComparisonSection() {{category.category !== "Usage" && (<div className="grid grid-cols-3 gap-0 py-3 border-b border-neutral-700 bg-neutral-800/10"><div className="flex items-center px-6 border-r border-neutral-700/50">- <h3 className="font-semibold text-neutral-100 text-base">- {category.category}- </h3>+ <h3 className="font-semibold text-neutral-100 text-base">{category.category}</h3></div><div className="border-r border-neutral-700/50"></div><div></div>@@ -243,9 +238,7 @@ export function ComparisonSection() {className="grid grid-cols-3 gap-0 py-3 hover:bg-neutral-800/20 transition-colors border-b border-neutral-800/30 last:border-b-0"><div className="flex items-center px-6 border-r border-neutral-700/50">- <span className="text-sm text-neutral-300">- {feature.name}- </span>+ <span className="text-sm text-neutral-300">{feature.name}</span></div><div className="flex items-center justify-center px-6 border-r border-neutral-700/50"><FeatureCell value={feature.free} />diff --git a/docs/src/app/pricing/components/PricingSection.jsx b/docs/src/app/pricing/components/PricingSection.jsxindex 6a75de981..9d6cf3388 100644--- a/docs/src/app/pricing/components/PricingSection.jsx+++ b/docs/src/app/pricing/components/PricingSection.jsx@@ -7,25 +7,16 @@ import { useState } from "react";import { cn } from "../../../lib/utils";// Available event tiers for the slider-const EVENT_TIERS = [- 100_000,- 250_000,- 500_000,- 1_000_000,- 2_000_000,- 5_000_000,- 10_000_000,- "Custom",-];+const EVENT_TIERS = [100_000, 250_000, 500_000, 1_000_000, 2_000_000, 5_000_000, 10_000_000, "Custom"];// Define plan featuresconst PRO_FEATURES = ["Unlimited websites","Unlimited team members","Real-time analytics",+ "Session replays","Web vitals","Custom events",- "Sessions","Funnels","Goals","Journeys",@@ -88,9 +79,7 @@ export function PricingSection() {<div className="inline-block bg-emerald-900/30 text-emerald-400 px-3 py-1 rounded-full text-sm font-medium mb-4">Simple Pricing</div>- <h2 className="text-3xl md:text-4xl font-bold">- Transparent Pricing- </h2>+ <h2 className="text-3xl md:text-4xl font-bold">Transparent Pricing</h2><p className="mt-4 text-neutral-300 max-w-2xl mx-auto">Privacy-friendly analytics with all the features you need to grow</p>@@ -106,9 +95,7 @@ export function PricingSection() {<div className="flex justify-between mb-3 items-center"><div><h3 className="font-semibold mb-2">Free</h3>- <div className="text-3xl font-semibold text-neutral-200">- 3,000- </div>+ <div className="text-3xl font-semibold text-neutral-200">3,000</div><p className="text-neutral-400 text-sm">events/month</p></div>{/* <div className="flex flex-col items-end">@@ -120,10 +107,7 @@ export function PricingSection() {</div></div>- <Link- href="https://app.rybbit.io/signup"- className="w-full block"- >+ <Link href="https://app.rybbit.io/signup" className="w-full block"><buttondata-rybbit-event="signup"data-rybbit-prop-location="free"@@ -140,13 +124,7 @@ export function PricingSection() {) : (<X className="h-4 w-4 text-neutral-500 mr-3 shrink-0" />)}- <span- className={cn(- item.included ? "text-white" : "text-neutral-500"- )}- >- {item.feature}- </span>+ <span className={cn(item.included ? "text-white" : "text-neutral-500")}>{item.feature}</span></div>))}</div>@@ -209,9 +187,7 @@ export function PricingSection() {)}>Annual- <span className="ml-1 text-xs text-emerald-500">- -17%- </span>+ <span className="ml-1 text-xs text-emerald-500">-17%</span></button></div><div className="text-right h-10">@@ -220,14 +196,9 @@ export function PricingSection() {) : (<><span className="text-3xl font-bold">- $- {isAnnual- ? Math.round(prices.annual / 12)- : prices.monthly}- </span>- <span className="ml-1 text-neutral-400">- /month+ ${isAnnual ? Math.round(prices.annual / 12) : prices.monthly}</span>+ <span className="ml-1 text-neutral-400">/month</span></>)}</div>@@ -245,13 +216,7 @@ export function PricingSection() {<div className="flex justify-between text-xs text-neutral-400">{EVENT_TIERS.map((tier, index) => (- <span- key={index}- className={cn(- eventLimitIndex === index &&- "font-bold text-emerald-400"- )}- >+ <span key={index} className={cn(eventLimitIndex === index && "font-bold text-emerald-400")}>{index === EVENT_TIERS.length - 1? "10M+": tier >= 1_000_000@@ -263,19 +228,13 @@ export function PricingSection() {</div>{prices.custom ? (- <Link- href="https://www.rybbit.io/contact"- className="w-full block"- >+ <Link href="https://www.rybbit.io/contact" className="w-full block"><button className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-5 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50 cursor-pointer">Contact us</button></Link>) : (- <Link- href="https://app.rybbit.io/signup"- className="w-full block"- >+ <Link href="https://app.rybbit.io/signup" className="w-full block"><buttondata-rybbit-event="signup"data-rybbit-prop-location="pro"