"use client"; import { useMemo, useState } from "react"; import Link from "next/link"; // ---------- Types ---------- export type CarePlan = { id: string; name: string; bestFor: string; monthlyPrice: number; yearlyDiscount: number; // 0.1 = 10% outcomes: readonly string[]; inclusions: readonly string[]; sla: string; cta: { label: string; href: string }; popular?: boolean; contactOnly?: boolean; }; export type VPSPlan = { id: "solo" | "team" | "dedicated"; name: string; price: number | null; // null = custom specs: string; bestFor: string; }; export type MCPlan = { id: "starter" | "pro" | "network"; name: string; price: number | null; specs: string; typical: string; features: readonly string[]; }; // ---------- Main Component ---------- export default function PricingConfigurator({ carePlans, vpsPlans, minecraftPlans, }: { carePlans: readonly CarePlan[]; vpsPlans: readonly VPSPlan[]; minecraftPlans: readonly MCPlan[]; }) { const [tab, setTab] = useState<"care" | "vps" | "mc">("care"); const [billing, setBilling] = useState<"monthly" | "yearly">("monthly"); const [vpsOwnership, setVpsOwnership] = useState<"managed" | "owned">("managed"); return (
{/* Tabs */}
{[ { id: "care", label: "Managed Hosting & Care" }, { id: "vps", label: "VPS (Managed or Owned)" }, { id: "mc", label: "Minecraft Hosting" }, ].map((t) => ( ))}
{/* Billing toggle */} {tab === "care" && (
Billing:
{(["monthly", "yearly"] as const).map((b) => ( ))}
)}
{/* Panels */}
{tab === "care" && } {tab === "vps" && ( )} {tab === "mc" && }
); } // ---------- CARE ---------- function CareGrid({ plans, billing, }: { plans: readonly CarePlan[]; billing: "monthly" | "yearly"; }) { return (
{plans.map((p) => { const price = billing === "yearly" ? Math.round(p.monthlyPrice * (1 - p.yearlyDiscount)) : p.monthlyPrice; return (
{p.popular && (
Most Popular
)}

{p.name}

€{price} /mo
{billing === "yearly" && (
billed annually (-10%)
)}
{p.bestFor}
{p.cta.label}
); })}
); } // ---------- VPS ---------- function VPSGrid({ plans, ownership, onOwnershipChange, }: { plans: readonly VPSPlan[]; ownership: "managed" | "owned"; onOwnershipChange: (m: "managed" | "owned") => void; }) { return (
Choose how you want to run your VPS.
{(["managed", "owned"] as const).map((m) => ( ))}
{plans.map((p) => (

{p.name}

{p.price ? ( <> €{p.price} /mo ) : ( "Custom" )}
{p.specs}
{p.bestFor}
  • 🛡️ CIS-style hardening, updates & monitoring
  • 💾 Backups with scheduled restore tests
  • 📈 Incident notes & SLA-backed response
{p.id === "dedicated" ? ( Request Custom Plan ) : ( {ownership === "managed" ? "Provision (Managed)" : "Provision (Owned)"} )}

{ownership === "managed" ? "We host & bill the VPS on our platform. Management included." : "Provisioned into your cloud account via secure connect. You retain ownership."}

))}
); } // ---------- MINECRAFT ---------- function MinecraftGrid({ plans }: { plans: readonly MCPlan[] }) { return (
{plans.map((p) => (

{p.name}

{p.price ? ( <> €{p.price} /mo ) : ( "Custom" )}
{p.specs}
{p.typical}
{p.id === "network" ? ( Request Custom Plan ) : ( Deploy Server )}

Backups with restore tests, tuning & monitoring included. Networks & modpacks may require custom sizing.

))}
); }