diff --git a/components/billing/topup-panel.tsx b/components/billing/topup-panel.tsx index 217f07c..254fe97 100644 --- a/components/billing/topup-panel.tsx +++ b/components/billing/topup-panel.tsx @@ -1,22 +1,13 @@ "use client"; -import { useState } from "react"; import { useTranslations } from "next-intl"; -import { CreditCard, Zap } from "lucide-react"; -import { Button } from "@/components/ui/button"; -import { Slider } from "@/components/ui/slider"; import { authClient } from "@/lib/auth-client"; import { TOPUP_PRODUCTS } from "@/lib/polar-products"; -import { calculateCustomTopup } from "@/lib/topup-calculator"; import { toast } from "@/lib/toast"; -const CUSTOM_TOPUP_PRODUCT_ID = "POLAR_PRODUCT_ID_TOPUP_CUSTOM"; - export function TopupPanel() { const t = useTranslations('toasts'); - const [customAmount, setCustomAmount] = useState(20); - const { credits, bonusRate } = calculateCustomTopup(customAmount); async function handleTopup(polarProductId: string) { toast.info( @@ -47,48 +38,9 @@ export function TopupPanel() { -
- {credits.toLocaleString("de-DE")} Cr -
- {bonusRate > 0 && ( -
-
- Larger amounts include a bonus. Top-ups are always available, even on free plan. -
-+ Angezeigt werden nur kaufbare Top-up Pakete aus der serverseitigen Polar-Produktkonfiguration. +
); } diff --git a/components/dashboard/credit-overview.tsx b/components/dashboard/credit-overview.tsx index b877372..c7c31cd 100644 --- a/components/dashboard/credit-overview.tsx +++ b/components/dashboard/credit-overview.tsx @@ -11,27 +11,15 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Progress } from "@/components/ui/progress"; import { api } from "@/convex/_generated/api"; +import { normalizeTier, TIER_MONTHLY_CREDITS } from "@/lib/polar-products"; import { cn } from "@/lib/utils"; import { toast } from "@/lib/toast"; -// --------------------------------------------------------------------------- -// Tier-Config — monatliches Credit-Kontingent pro Tier (in Cent) -// --------------------------------------------------------------------------- - -const TIER_MONTHLY_CREDITS: Record