Files
websitedev/proto/src/components/views/HostingPlansView.tsx
T
Do SikiandClaude Opus 5.5 c225967892
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
fix(ui): Tailwind dark variant follows the site theme; dark hosting plans page
The dark: variant now matches data-theme="dark" (toggle) or the system
preference when no theme is stored, like the design tokens. Other subpage
views (Services, About, Contact, Legal) still need dark: classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 19:42:25 +02:00

129 lines
6.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { localePath, type Locale } from '@/lib/i18n'
import type { getHostingPlansContent } from '@/lib/payload-content'
import { formatHuf, grossAmount, DEFAULT_VAT_RATE_PERCENT, type BillingPeriod, type HostingPlanView } from '@/lib/products'
type Content = Awaited<ReturnType<typeof getHostingPlansContent>>
type Labels = Content['labels']
type HostingPlansViewProps = {
content: Content
plans: HostingPlanView[]
locale: Locale
}
const PERIOD_LABEL: Record<BillingPeriod, keyof Labels> = {
yearly: 'perYear',
monthly: 'perMonth',
'one-time': 'oneTime',
}
const gb = (value?: number) => (value === undefined ? '–' : `${value} GB`)
const num = (value?: number) => (value === undefined ? '–' : String(value))
function comparisonRows(plan: HostingPlanView, labels: Labels): [string, string][] {
const s = plan.service
const included = (on: boolean) => (on ? `✓ ${labels.included}` : '–')
return [
[labels.storage, gb(s.storageGb)],
[labels.mailStorage, gb(s.mailStorageGb)],
[labels.domains, num(s.domains)],
[labels.domainAliases, num(s.domainAliases)],
[labels.databases, num(s.databases)],
[labels.mailboxes, num(s.mailboxes)],
[labels.backup, s.backup ?? '–'],
[labels.ssl, included(s.ssl)],
[labels.spamFilter, included(s.spamFilter)],
]
}
/** MITHOME-130: comparable hosting plan cards with net + VAT and gross price. */
export default function HostingPlansView({ content, plans, locale }: HostingPlansViewProps) {
const { labels } = content
const contactHref = localePath(locale, 'contact')
const vatRate = content.vatRatePercent ?? DEFAULT_VAT_RATE_PERCENT
return (
<div className="space-y-16 py-8">
<section className="bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-slate-800 dark:to-slate-900 py-16">
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h1 className="text-4xl md:text-5xl font-bold text-gray-900 dark:text-slate-50 mb-6">{content.hero.title}</h1>
<p className="text-xl text-gray-600 dark:text-slate-300 leading-relaxed">{content.hero.subtitle}</p>
</div>
</section>
<section className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
<ul className="grid grid-cols-1 md:grid-cols-2 gap-8">
{plans.map((plan) => {
const period = labels[PERIOD_LABEL[plan.billingPeriod]]
return (
<li
key={plan.id}
data-testid={`plan-${plan.slug}`}
className={`relative flex flex-col bg-white dark:bg-slate-800 rounded-xl p-8 shadow-sm border ${plan.highlighted ? 'border-blue-600 ring-2 ring-blue-600 dark:border-blue-400 dark:ring-blue-400' : 'border-gray-200 dark:border-slate-700'}`}
>
{plan.highlighted && (
<span className="absolute -top-3 left-8 rounded-full bg-blue-600 px-3 py-1 text-xs font-semibold text-white">
{labels.recommended}
</span>
)}
<h2 className="text-2xl font-bold text-gray-900 dark:text-slate-50">{plan.name}</h2>
<p className="mt-1 text-sm font-medium text-blue-700 dark:text-blue-300">{plan.audience}</p>
<p className="mt-4 text-gray-600 dark:text-slate-300">{plan.shortDescription}</p>
<p className="mt-6">
<span className="text-3xl font-bold text-gray-900 dark:text-slate-50">{formatHuf(plan.netAmount, locale)}</span>{' '}
<span className="text-gray-700 dark:text-slate-300">{labels.plusVat} {period}</span>
</p>
<p className="text-sm text-gray-500 dark:text-slate-400">
{labels.grossPrice} {formatHuf(grossAmount(plan.netAmount, vatRate), locale)} {period}
</p>
<dl className="mt-6 divide-y divide-gray-100 border-y border-gray-100 dark:divide-slate-700 dark:border-slate-700">
{comparisonRows(plan, labels).map(([term, value]) => (
<div key={term} className="flex justify-between gap-4 py-2 text-sm">
<dt className="text-gray-600 dark:text-slate-300">{term}</dt>
<dd className="font-medium text-gray-900 dark:text-slate-50 text-right">{value}</dd>
</div>
))}
</dl>
{plan.features.length > 0 && (
<ul className="mt-6 space-y-2">
{plan.features.map((feature) => (
<li key={feature} className="flex items-start text-gray-700 dark:text-slate-200">
<span className="text-blue-500 mr-3" aria-hidden="true">✓</span>
{feature}
</li>
))}
</ul>
)}
<a
href={contactHref}
className={`mt-8 inline-flex justify-center rounded-lg px-6 py-3 font-semibold transition-colors ${plan.highlighted ? 'bg-blue-600 text-white hover:bg-blue-700' : 'border border-blue-600 text-blue-700 hover:bg-blue-50 dark:border-blue-400 dark:text-blue-300 dark:hover:bg-slate-700'}`}
>
{plan.ctaText}
</a>
</li>
)
})}
</ul>
<p className="mt-6 text-center text-sm text-gray-500 dark:text-slate-400">{labels.priceNote}</p>
</section>
<section className="bg-gray-50 dark:bg-slate-800 py-16">
<div className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h2 className="text-3xl font-bold text-gray-900 dark:text-slate-50 mb-4">{content.largerNeeds.title}</h2>
<p className="text-lg text-gray-600 dark:text-slate-300 mb-8">{content.largerNeeds.text}</p>
<a
href={contactHref}
className="inline-flex rounded-lg bg-blue-600 px-8 py-3 font-semibold text-white hover:bg-blue-700 transition-colors"
>
{content.largerNeeds.button}
</a>
</div>
</section>
</div>
)
}