import { Show, createMemo } from "solid-js"; import { SparklesIcon, XIcon } from "../../components/dashboard/icons"; import { DashboardLayout, useDashboardData } from "./layout"; function BillingPage() { const data = useDashboardData(); const current = data.resolvedBilling(); const entitlements = current?.entitlements; const isTrialing = current?.subscriptionStatus === "trialing"; const isActive = current?.subscriptionStatus === "active"; const planCode = current?.planCode ?? "starter"; const planName = current?.planName ?? "Starter"; const trialDays = current?.trialDaysRemaining ?? 0; const planFeatures = createMemo(() => { const cs = data.i18n.locale() === "cs"; const base = [ { label: data.i18n.t("dashboard.billing.locations"), value: entitlements?.maxLocations ?? 1, limit: entitlements?.maxLocations ?? 1 }, { label: data.i18n.t("dashboard.billing.bookings"), value: entitlements?.maxBookings === -1 ? "\u221e" : (entitlements?.maxBookings ?? 50), limit: entitlements?.maxBookings ?? 50 }, { label: data.i18n.t("dashboard.billing.staff"), value: entitlements?.maxStaff ?? 1, limit: entitlements?.maxStaff ?? 1 }, ]; if (planCode === "pro" || planCode === "business") { base.push({ label: cs ? "Emailove pripominky" : "Email reminders", value: "\u2713", limit: "\u2713" }); base.push({ label: cs ? "Analytika" : "Analytics", value: "\u2713", limit: "\u2713" }); } if (planCode === "business") { base.push({ label: cs ? "API pristup" : "API access", value: "\u2713", limit: "\u2713" }); } return base; }); return (
{data.i18n.t("dashboard.billing.currentPlan")}: {planName}
{data.billingNotice()}
{data.billingError()}
{data.i18n.t("dashboard.billing.period")}: {data.billingInterval() === "monthly" ? (data.i18n.locale() === "cs" ? "Mesicne" : "Monthly") : (data.i18n.locale() === "cs" ? "Rocne" : "Yearly")}
{feature.label}
{typeof feature.value === "number" ? `${feature.value} / ${feature.limit}` : feature.value}