+
+
+
+ Back
+
+
+
Billing
+
+
+ Subscription Details
+
+
+ {subscriptionPlan.name}
+
+
+ {!subscriptionPlan.isSubscribed
+ ? "You are not subscribed to any plan."
+ : subscriptionPlan.isCanceled
+ ? "Your plan will be canceled on "
+ : "Your plan renews on "}
+ {subscriptionPlan?.stripeCurrentPeriodEnd
+ ? subscriptionPlan.stripeCurrentPeriodEnd.toLocaleDateString()
+ : null}
+
+
+
+ {storeSubscriptionPlans.map((plan) => (
+
+ {plan.name === subscriptionPlan.name ? (
+
+ ) : null}
+
+ {plan.name}
+ {plan.description}
+
+
+
+
+ ${plan.price / 100} / month
+
+
+
+ {plan.features.map((feature, i) => (
+
+
+ {feature}
+
+ ))}
+
+
+
+ {session?.user.email ? (
+
+ ) : (
+
+
+
+ Add Email to Subscribe
+
+
+
+ )}
+
+
+ ))}
+
+
+ );
+}
diff --git a/src/app/(app)/account/page.tsx b/src/app/(app)/account/page.tsx
index 0588287..9a0292c 100644
--- a/src/app/(app)/account/page.tsx
+++ b/src/app/(app)/account/page.tsx
@@ -1,14 +1,18 @@
import UserSettings from "./UserSettings";
+import PlanSettings from "./PlanSettings";
import { checkAuth, getUserAuth } from "@/lib/auth/utils";
+import { getUserSubscriptionPlan } from "@/lib/stripe/subscription";
export default async function Account() {
await checkAuth();
const { session } = await getUserAuth();
+ const subscriptionPlan = await getUserSubscriptionPlan();
return (