🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update UsageBanners and SubscriptionPage components
Bill Yang2e5fef20d029
diff --git a/client/src/app/[site]/Header/UsageBanners.tsx b/client/src/app/[site]/Header/UsageBanners.tsxindex 9253f4bbb..c95832f93 100644--- a/client/src/app/[site]/Header/UsageBanners.tsx+++ b/client/src/app/[site]/Header/UsageBanners.tsx@@ -29,8 +29,11 @@ export function UsageBanners({ site }: UsageBannersProps) {const usagePercentage = getUsagePercentage();const isNearLimit = usagePercentage >= 90 && !site.overMonthlyLimit;- // If over limit, show the red banner- if (site.overMonthlyLimit) {+ if (+ site.monthlyEventCount &&+ site.eventLimit &&+ site.monthlyEventCount > site.eventLimit+ ) {return (<Alert variant="destructive" className="mb-3 p-4"><div className="flex items-start space-x-3">diff --git a/client/src/app/settings/subscription/page.tsx b/client/src/app/settings/subscription/page.tsxindex eb288add3..3bd1b1a78 100644--- a/client/src/app/settings/subscription/page.tsx+++ b/client/src/app/settings/subscription/page.tsx@@ -24,6 +24,7 @@ import { HelpSection } from "./components/HelpSection";import { PlanFeaturesCard } from "./components/PlanFeaturesCard";import { DEFAULT_EVENT_LIMIT } from "./utils/constants";import { getPlanDetails } from "./utils/planUtils";+import { Progress } from "@/components/ui/progress";export default function SubscriptionPage() {const router = useRouter();@@ -222,22 +223,61 @@ export default function SubscriptionPage() {<AlertTitle>Error</AlertTitle><AlertDescription>{errorMessage}</AlertDescription></Alert>- ) : !activeSubscription ? (+ ) : !activeSubscription?.plan ? (<div className="space-y-6"><Card><CardHeader>- <CardTitle>No Active Subscription</CardTitle>+ <CardTitle>Free Plan</CardTitle><CardDescription>- You don't have an active subscription. Choose a plan to get- started.+ You are currently on the Free Plan. Upgrade to unlock premium+ features.</CardDescription></CardHeader>+ <CardContent>+ <div className="space-y-6">+ <div className="grid gap-4 md:grid-cols-2">+ <div>+ <h3 className="font-medium">Plan</h3>+ <p className="text-lg font-bold">Free</p>+ <p className="text-sm text-gray-500 dark:text-gray-400">+ $0/month+ </p>+ </div>+ <div>+ <h3 className="font-medium">Renewal Date</h3>+ <p className="text-lg font-bold">Never expires</p>+ </div>+ </div>++ <div className="space-y-2">+ <h3 className="font-medium mb-2">Usage</h3>+ <div className="space-y-4">+ <div>+ <div className="flex justify-between mb-1">+ <span className="text-sm">Events</span>+ <span className="text-sm">+ {currentUsage.toLocaleString()} /{" "}+ {DEFAULT_EVENT_LIMIT.toLocaleString()}+ </span>+ </div>+ <Progress+ value={(currentUsage / DEFAULT_EVENT_LIMIT) * 100}+ />+ </div>+ </div>+ </div>+ </div>+ </CardContent><CardFooter><Button onClick={() => router.push("/subscribe")}>- View Plans <ArrowRight className="ml-2 h-4 w-4" />+ Upgrade Plan <ArrowRight className="ml-2 h-4 w-4" /></Button></CardFooter></Card>++ <PlanFeaturesCard currentPlan={getPlanDetails("free")} />++ <HelpSection router={router} /></div>) : (<div className="space-y-6">