feat: support showing limits for price plans

This commit is contained in:
javayhu 2025-04-12 00:16:51 +08:00
parent c04499a353
commit ad0eae7d62
8 changed files with 114 additions and 79 deletions

View File

@ -2,5 +2,4 @@
slug: company
name: 公司
description: 公司新闻和更新
locale: zh
---

View File

@ -2,5 +2,4 @@
slug: news
name: 新闻
description: 最新新闻和更新
locale: zh
---

View File

@ -2,5 +2,4 @@
slug: product
name: 产品
description: 产品和服务
locale: zh
---

View File

@ -65,6 +65,51 @@
"checkoutFailed": "Failed to open checkout page"
}
},
"PricePlans": {
"free": {
"name": "Free",
"description": "Basic features for personal use",
"features": {
"projects": "Up to 3 projects",
"storage": "1 GB storage",
"analytics": "Basic analytics",
"support": "Community support"
},
"limits": {
"domains": "Custom domains",
"brands": "Custom brands",
"updates": "Lifetime updates"
}
},
"pro": {
"name": "Pro",
"description": "Advanced features for professionals",
"features": {
"projects": "Unlimited projects",
"storage": "10 GB storage",
"analytics": "Advanced analytics",
"support": "Priority support",
"domains": "Custom domains"
},
"limits": {
"brands": "Custom brands",
"updates": "Lifetime updates"
}
},
"lifetime": {
"name": "Lifetime",
"description": "Premium features with one-time payment",
"features": {
"proFeatures": "All Pro features",
"storage": "100 GB storage",
"support": "Dedicated support",
"security": "Enterprise-grade security",
"integrations": "Advanced integrations",
"branding": "Custom branding",
"updates": "Lifetime updates"
}
}
},
"NotFoundPage": {
"title": "404",
"message": "Sorry, the page you are looking for does not exist.",
@ -512,43 +557,6 @@
"button": "Upgrade"
}
},
"PricePlans": {
"free": {
"name": "Free",
"description": "Basic features for personal use",
"features": {
"projects": "Up to 3 projects",
"storage": "1 GB storage",
"analytics": "Basic analytics",
"support": "Community support"
}
},
"pro": {
"name": "Pro",
"description": "Advanced features for professionals",
"features": {
"projects": "Unlimited projects",
"storage": "10 GB storage",
"analytics": "Advanced analytics",
"support": "Priority support",
"domains": "Custom domains",
"collaboration": "Team collaboration"
}
},
"lifetime": {
"name": "Lifetime",
"description": "Premium features with one-time payment",
"features": {
"proFeatures": "All Pro features",
"storage": "100 GB storage",
"support": "Dedicated support",
"security": "Enterprise-grade security",
"integrations": "Advanced integrations",
"branding": "Custom branding",
"updates": "Lifetime updates"
}
}
},
"Mail": {
"common": {
"team": "{name} Team",

View File

@ -65,6 +65,52 @@
"checkoutFailed": "打开结账页面失败"
}
},
"PricePlans": {
"free": {
"name": "免费版",
"description": "适用于个人使用的基本功能",
"features": {
"projects": "最多3个项目",
"storage": "1GB存储空间",
"analytics": "基础分析功能",
"support": "社区支持"
},
"limits": {
"domains": "不支持自定义域名",
"brands": "不支持自定义品牌",
"updates": "不支持终身更新"
}
},
"pro": {
"name": "专业版",
"description": "专业人士的高级功能",
"features": {
"projects": "无限项目",
"storage": "10GB存储空间",
"analytics": "高级分析功能",
"support": "优先支持",
"domains": "自定义域名"
},
"limits": {
"brands": "不支持自定义品牌",
"updates": "不支持终身更新"
}
},
"lifetime": {
"name": "终身版",
"description": "一次性付款获得所有高级功能",
"features": {
"proFeatures": "所有专业版功能",
"storage": "100GB存储空间",
"support": "专属支持",
"security": "企业级安全",
"integrations": "高级集成",
"domains": "自定义域名",
"branding": "自定义品牌",
"updates": "终身更新"
}
}
},
"NotFoundPage": {
"title": "404",
"message": "抱歉,您正在寻找的页面不存在",
@ -511,43 +557,6 @@
"button": "升级"
}
},
"PricePlans": {
"free": {
"name": "免费版",
"description": "适用于个人使用的基本功能",
"features": {
"projects": "最多3个项目",
"storage": "1GB存储空间",
"analytics": "基础分析功能",
"support": "社区支持"
}
},
"pro": {
"name": "专业版",
"description": "专业人士的高级功能",
"features": {
"projects": "无限项目",
"storage": "10GB存储空间",
"analytics": "高级分析功能",
"support": "优先支持",
"domains": "自定义域名",
"collaboration": "团队协作"
}
},
"lifetime": {
"name": "终身版",
"description": "一次性付款获得所有高级功能",
"features": {
"proFeatures": "所有专业版功能",
"storage": "100GB存储空间",
"support": "专属支持",
"security": "企业级安全",
"integrations": "高级集成",
"branding": "自定义品牌",
"updates": "终身更新"
}
}
},
"Mail": {
"common": {
"team": "{name} 团队",

View File

@ -6,7 +6,7 @@ import { useCurrentUser } from '@/hooks/use-current-user';
import { formatPrice } from '@/lib/formatter';
import { cn } from '@/lib/utils';
import { PaymentType, PaymentTypes, PlanInterval, PlanIntervals, Price, PricePlan } from '@/payment/types';
import { Check, CheckCircleIcon } from 'lucide-react';
import { Check, CheckCircleIcon, XCircleIcon } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { useLocalePathname } from '@/i18n/navigation';
import { LoginWrapper } from '../auth/login-wrapper';
@ -189,6 +189,16 @@ export function PricingCard({
</li>
))}
</ul>
{/* show limits of this plan */}
<ul className="list-outside space-y-4 text-sm">
{plan.limits?.map((limit, i) => (
<li key={i} className="flex items-center gap-2">
<XCircleIcon className="size-4 text-gray-500 dark:text-gray-400" />
<span>{limit}</span>
</li>
))}
</ul>
</CardContent>
</Card>
);

View File

@ -27,6 +27,11 @@ export function getPricePlans(): PaymentConfig {
t('free.features.support'),
t('free.features.storage')
];
paymentConfig.plans.free.limits = [
t('free.limits.domains'),
t('free.limits.brands'),
t('free.limits.updates')
];
}
if (paymentConfig.plans.pro) {
@ -38,7 +43,10 @@ export function getPricePlans(): PaymentConfig {
t('pro.features.support'),
t('pro.features.storage'),
t('pro.features.domains'),
t('pro.features.collaboration')
];
paymentConfig.plans.pro.limits = [
t('pro.limits.brands'),
t('pro.limits.updates')
];
}
@ -54,6 +62,8 @@ export function getPricePlans(): PaymentConfig {
t('lifetime.features.branding'),
t('lifetime.features.updates')
];
paymentConfig.plans.lifetime.limits = [
];
}
return paymentConfig;

View File

@ -65,6 +65,7 @@ export interface PricePlan {
name?: string; // Display name of the plan
description?: string; // Description of the plan features
features?: string[]; // List of features included in this plan
limits?: string[]; // List of limits for this plan
prices: Price[]; // Available prices for this plan
isFree: boolean; // Whether this is a free plan
isLifetime: boolean; // Whether this is a lifetime plan