'use client';
import { useState, useEffect } from 'react';
import { useTDK } from '../../../lib/useTDK';
import { useRouter, usePathname } from 'next/navigation';
import Navigation from '../../../components/Navigation';
import Footer from '../../../components/Footer';
import BackgroundElements from '../../../components/BackgroundElements';
interface PageProps {
params: { locale: string };
}
export default function PricingPage({ params }: PageProps) {
const [currentLang, setCurrentLang] = useState(params.locale);
const [isLoaded, setIsLoaded] = useState(false);
const [billingCycle, setBillingCycle] = useState<'monthly' | 'yearly'>('monthly');
const router = useRouter();
const pathname = usePathname();
// Update TDK when language changes
useTDK(currentLang, 'pricing');
const translations = {
'zh-CN': {
nav: {
home: '首页',
products: '产品',
pricing: '价格',
support: '支持',
contact: '联系我们',
},
pricing: {
title: '选择适合您的方案',
subtitle: '灵活的价格方案',
description: '无论您是个人开发者还是大型企业,我们都有适合您的方案',
monthly: '按月付费',
yearly: '按年付费',
yearlyDiscount: '节省20%',
mostPopular: '最受欢迎',
getStarted: '开始使用',
features: '功能特性',
allFeatures: '查看所有功能',
},
footer: {
copyright: `© ${new Date().getFullYear()} CloudProxy. 版权所有.`,
},
},
'zh-TW': {
nav: {
home: '首頁',
products: '產品',
pricing: '價格',
support: '支援',
contact: '聯絡我們',
},
pricing: {
title: '選擇適合您的方案',
subtitle: '靈活的價格方案',
description: '無論您是個人開發者還是大型企業,我們都有適合您的方案',
monthly: '按月付費',
yearly: '按年付費',
yearlyDiscount: '節省20%',
mostPopular: '最受歡迎',
getStarted: '開始使用',
features: '功能特性',
allFeatures: '查看所有功能',
},
footer: {
copyright: `© ${new Date().getFullYear()} CloudProxy. 版權所有.`,
},
},
en: {
nav: {
home: 'Home',
products: 'Products',
pricing: 'Pricing',
support: 'Support',
contact: 'Contact',
},
pricing: {
title: 'Choose Your Perfect Plan',
subtitle: 'Flexible Pricing Plans',
description:
"Whether you're an individual developer or a large enterprise, we have the right plan for you",
monthly: 'Monthly',
yearly: 'Yearly',
yearlyDiscount: 'Save 20%',
mostPopular: 'Most Popular',
getStarted: 'Get Started',
features: 'Features',
allFeatures: 'View All Features',
},
footer: {
copyright: `© ${new Date().getFullYear()} CloudProxy. All rights reserved.`,
},
},
ko: {
nav: {
home: '홈',
products: '제품',
pricing: '가격',
support: '지원',
contact: '연락처',
},
pricing: {
title: '완벽한 플랜을 선택하세요',
subtitle: '유연한 가격 플랜',
description: '개인 개발자든 대기업이든, 귀하에게 적합한 플랜이 있습니다',
monthly: '월간',
yearly: '연간',
yearlyDiscount: '20% 절약',
mostPopular: '가장 인기',
getStarted: '시작하기',
features: '기능',
allFeatures: '모든 기능 보기',
},
footer: {
copyright: `© ${new Date().getFullYear()} CloudProxy. 모든 권리 보유.`,
},
},
ja: {
nav: {
home: 'ホーム',
products: '製品',
pricing: '価格',
support: 'サポート',
contact: 'お問い合わせ',
},
pricing: {
title: '最適なプランを選択',
subtitle: '柔軟な価格プラン',
description: '個人開発者でも大企業でも、あなたに最適なプランをご用意しています',
monthly: '月額',
yearly: '年額',
yearlyDiscount: '20%節約',
mostPopular: '最も人気',
getStarted: '始める',
features: '機能',
allFeatures: 'すべての機能を見る',
},
footer: {
copyright: `© ${new Date().getFullYear()} CloudProxy. 全著作権所有.`,
},
},
};
const t = translations[currentLang as keyof typeof translations] || translations['zh-CN'];
useEffect(() => {
setIsLoaded(true);
setCurrentLang(params.locale);
}, [params.locale]);
const handleLanguageChange = (newLang: string) => {
const currentPath = pathname.replace(`/${currentLang}`, '');
router.push(`/${newLang}${currentPath}`);
};
const plans = [
{
name: 'Starter',
monthlyPrice: currentLang.startsWith('zh')
? '¥99'
: currentLang === 'ko'
? '₩18,000'
: currentLang === 'ja'
? '¥2,000'
: '$15',
yearlyPrice: currentLang.startsWith('zh')
? '¥79'
: currentLang === 'ko'
? '₩14,400'
: currentLang === 'ja'
? '¥1,600'
: '$12',
features: ['2 CPU Cores', '4GB RAM', '50GB SSD', '1TB Bandwidth'],
popular: false,
},
{
name: 'Professional',
monthlyPrice: currentLang.startsWith('zh')
? '¥299'
: currentLang === 'ko'
? '₩54,000'
: currentLang === 'ja'
? '¥6,000'
: '$45',
yearlyPrice: currentLang.startsWith('zh')
? '¥239'
: currentLang === 'ko'
? '₩43,200'
: currentLang === 'ja'
? '¥4,800'
: '$36',
features: ['4 CPU Cores', '8GB RAM', '100GB SSD', '3TB Bandwidth', 'SSL Certificate'],
popular: true,
},
{
name: 'Enterprise',
monthlyPrice: currentLang.startsWith('zh')
? '¥999'
: currentLang === 'ko'
? '₩179,000'
: currentLang === 'ja'
? '¥20,000'
: '$149',
yearlyPrice: currentLang.startsWith('zh')
? '¥799'
: currentLang === 'ko'
? '₩143,200'
: currentLang === 'ja'
? '¥16,000'
: '$119',
features: [
'8 CPU Cores',
'16GB RAM',
'500GB SSD',
'Unlimited Bandwidth',
'24/7 Support',
],
popular: false,
},
];
return (
{/* Header */}
{t.pricing.title}
{t.pricing.subtitle}
{t.pricing.description}
{/* Billing Toggle */}
{/* Pricing Cards */}
{plans.map((plan, index) => (
{plan.popular && (
{t.pricing.mostPopular}
)}
{plan.name}
{billingCycle === 'monthly'
? plan.monthlyPrice
: plan.yearlyPrice}
{billingCycle === 'monthly'
? t.pricing.monthly
: t.pricing.yearly}
{plan.features.map((feature, featureIndex) => (
-
{feature}
))}
{/* Hover effect */}
))}
);
}