enforce membership feature access in api and surface plans in admin
This commit is contained in:
1 parent
1f4800c055
commit
ebfd633a11
14 files changed
+573
-5
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useUser } from "@clerk/nextjs";
|
||||
import log from "@/lib/logger";
|
||||
import { MEMBERSHIP_FEATURES } from "@/lib/membership/features";
|
||||
|
||||
interface Backup {
|
||||
name: string;
|
||||
@@ -558,6 +559,109 @@ export default function SettingsPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Membership Feature Access */}
|
||||
<div className="mt-6">
|
||||
<h5 className="text-sm font-medium text-slate-700 mb-2">
|
||||
Membership Feature Access
|
||||
</h5>
|
||||
<div className="overflow-x-auto border rounded-lg">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="bg-slate-50 border-b">
|
||||
<tr>
|
||||
<th className="px-4 py-3 font-semibold text-slate-900">
|
||||
Feature
|
||||
</th>
|
||||
<th className="px-4 py-3 font-semibold text-slate-900">
|
||||
Basic
|
||||
</th>
|
||||
<th className="px-4 py-3 font-semibold text-slate-900">
|
||||
Premium
|
||||
</th>
|
||||
<th className="px-4 py-3 font-semibold text-slate-900">
|
||||
VIP
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
<tr>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Recommendations per month
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.basic.recommendationsPerMonth}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Unlimited
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Unlimited
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Nutrition tracking
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.basic.nutritionTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.premium.nutritionTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.vip.nutritionTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Hydration tracking
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.basic.hydrationTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.premium.hydrationTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.vip.hydrationTracking
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
Advanced statistics
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.basic.advancedStatistics
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.premium.advancedStatistics
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-slate-700">
|
||||
{MEMBERSHIP_FEATURES.vip.advancedStatistics
|
||||
? "Yes"
|
||||
: "No"}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-center h-64 bg-slate-50 rounded-lg">
|
||||
|
||||
Reference in new issue
Block a user