refactor: update PricingSection styles for improved layout and accessibility; enhance OrganizationSettings to handle plan changes and display past due notices
This commit is contained in:
@@ -219,10 +219,10 @@ export default function PricingSection() {
|
|||||||
transition={{ duration: 0.5 }}
|
transition={{ duration: 0.5 }}
|
||||||
className="text-center mb-12"
|
className="text-center mb-12"
|
||||||
>
|
>
|
||||||
<h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">
|
<h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4">
|
||||||
Transparent Pricing
|
Transparent Pricing
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-xl text-neutral-600 dark:text-neutral-400">
|
<p className="text-lg text-neutral-600 dark:text-neutral-400">
|
||||||
Scale with your traffic. No hidden fees.
|
Scale with your traffic. No hidden fees.
|
||||||
</p>
|
</p>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
@@ -232,11 +232,11 @@ export default function PricingSection() {
|
|||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, y: 20 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay: 0.1 }}
|
transition={{ duration: 0.5, delay: 0.1 }}
|
||||||
className="max-w-6xl mx-auto border border-neutral-200 dark:border-neutral-800 rounded-3xl bg-white/50 dark:bg-neutral-900/50 backdrop-blur-xl shadow-sm overflow-hidden mb-20"
|
className="max-w-6xl mx-auto border border-neutral-200 dark:border-neutral-800 rounded-2xl bg-white/50 dark:bg-neutral-900/50 backdrop-blur-xl shadow-sm overflow-hidden mb-20"
|
||||||
>
|
>
|
||||||
|
|
||||||
{/* Top Toolbar */}
|
{/* Top Toolbar */}
|
||||||
<div className="p-8 border-b border-neutral-200 dark:border-neutral-800 flex flex-col md:flex-row items-center justify-between gap-8 bg-neutral-50/50 dark:bg-neutral-900/50">
|
<div className="p-6 border-b border-neutral-200 dark:border-neutral-800 flex flex-col md:flex-row items-center justify-between gap-8 bg-neutral-50/50 dark:bg-neutral-900/50">
|
||||||
<div className="w-full md:w-2/3">
|
<div className="w-full md:w-2/3">
|
||||||
<div className="flex justify-between text-sm font-medium text-neutral-500 mb-4">
|
<div className="flex justify-between text-sm font-medium text-neutral-500 mb-4">
|
||||||
<span>10k</span>
|
<span>10k</span>
|
||||||
@@ -252,7 +252,9 @@ export default function PricingSection() {
|
|||||||
step="1"
|
step="1"
|
||||||
value={sliderIndex}
|
value={sliderIndex}
|
||||||
onChange={(e) => setSliderIndex(parseInt(e.target.value))}
|
onChange={(e) => setSliderIndex(parseInt(e.target.value))}
|
||||||
className="w-full h-2 bg-neutral-200 rounded-lg appearance-none cursor-pointer dark:bg-neutral-700 accent-brand-orange"
|
aria-label="Monthly pageview limit"
|
||||||
|
aria-valuetext={`${currentTraffic.label} pageviews per month`}
|
||||||
|
className="w-full h-2 bg-neutral-200 rounded-lg appearance-none cursor-pointer dark:bg-neutral-700 accent-brand-orange focus:outline-none focus:ring-2 focus:ring-brand-orange focus:ring-offset-2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -260,10 +262,12 @@ export default function PricingSection() {
|
|||||||
<span className="text-[10px] text-neutral-500 dark:text-neutral-400 font-medium uppercase tracking-wide">
|
<span className="text-[10px] text-neutral-500 dark:text-neutral-400 font-medium uppercase tracking-wide">
|
||||||
Get 1 month free with yearly
|
Get 1 month free with yearly
|
||||||
</span>
|
</span>
|
||||||
<div className="bg-neutral-200 dark:bg-neutral-800 p-1 rounded-lg flex">
|
<div className="bg-neutral-200 dark:bg-neutral-800 p-1 rounded-lg flex" role="radiogroup" aria-label="Billing interval">
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsYearly(false)}
|
onClick={() => setIsYearly(false)}
|
||||||
className={`min-w-[88px] px-4 py-2 rounded-lg text-sm font-medium transition-all ${
|
role="radio"
|
||||||
|
aria-checked={!isYearly}
|
||||||
|
className={`min-w-[88px] px-4 py-2 rounded-lg text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-brand-orange ${
|
||||||
!isYearly
|
!isYearly
|
||||||
? 'bg-white dark:bg-neutral-700 text-neutral-900 dark:text-white shadow-sm'
|
? 'bg-white dark:bg-neutral-700 text-neutral-900 dark:text-white shadow-sm'
|
||||||
: 'text-neutral-500 hover:text-neutral-900 dark:hover:text-white'
|
: 'text-neutral-500 hover:text-neutral-900 dark:hover:text-white'
|
||||||
@@ -273,7 +277,9 @@ export default function PricingSection() {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsYearly(true)}
|
onClick={() => setIsYearly(true)}
|
||||||
className={`min-w-[88px] px-4 py-2 rounded-lg text-sm font-medium transition-all ${
|
role="radio"
|
||||||
|
aria-checked={isYearly}
|
||||||
|
className={`min-w-[88px] px-4 py-2 rounded-lg text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-brand-orange ${
|
||||||
isYearly
|
isYearly
|
||||||
? 'bg-white dark:bg-neutral-700 text-neutral-900 dark:text-white shadow-sm'
|
? 'bg-white dark:bg-neutral-700 text-neutral-900 dark:text-white shadow-sm'
|
||||||
: 'text-neutral-500 hover:text-neutral-900 dark:hover:text-white'
|
: 'text-neutral-500 hover:text-neutral-900 dark:hover:text-white'
|
||||||
@@ -292,7 +298,7 @@ export default function PricingSection() {
|
|||||||
const isTeam = plan.id === 'team'
|
const isTeam = plan.id === 'team'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={plan.id} className={`p-8 flex flex-col relative transition-colors ${isTeam ? 'bg-brand-orange/[0.02]' : 'hover:bg-neutral-50/50 dark:hover:bg-neutral-800/50'}`}>
|
<div key={plan.id} className={`p-6 flex flex-col relative transition-colors ${isTeam ? 'bg-brand-orange/[0.02]' : 'hover:bg-neutral-50/50 dark:hover:bg-neutral-800/50'}`}>
|
||||||
{isTeam && (
|
{isTeam && (
|
||||||
<>
|
<>
|
||||||
<div className="absolute top-0 left-0 w-full h-1 bg-brand-orange" />
|
<div className="absolute top-0 left-0 w-full h-1 bg-brand-orange" />
|
||||||
@@ -361,7 +367,7 @@ export default function PricingSection() {
|
|||||||
})}
|
})}
|
||||||
|
|
||||||
{/* Enterprise Section */}
|
{/* Enterprise Section */}
|
||||||
<div className="p-8 bg-neutral-50/50 dark:bg-neutral-900/50 flex flex-col">
|
<div className="p-6 bg-neutral-50/50 dark:bg-neutral-900/50 flex flex-col">
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h3 className="text-lg font-bold text-neutral-900 dark:text-white mb-2">Enterprise</h3>
|
<h3 className="text-lg font-bold text-neutral-900 dark:text-white mb-2">Enterprise</h3>
|
||||||
<p className="text-sm text-neutral-500 min-h-[40px] mb-4">For high volume sites and custom needs</p>
|
<p className="text-sm text-neutral-500 min-h-[40px] mb-4">For high volume sites and custom needs</p>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
Organization
|
Organization
|
||||||
} from '@/lib/api/organization'
|
} from '@/lib/api/organization'
|
||||||
import { getSubscription, createPortalSession, getInvoices, cancelSubscription, resumeSubscription, changePlan, previewInvoice, createCheckoutSession, SubscriptionDetails, Invoice, PreviewInvoiceResult } from '@/lib/api/billing'
|
import { getSubscription, createPortalSession, getInvoices, cancelSubscription, resumeSubscription, changePlan, previewInvoice, createCheckoutSession, SubscriptionDetails, Invoice, PreviewInvoiceResult } from '@/lib/api/billing'
|
||||||
import { TRAFFIC_TIERS, PLAN_ID_SOLO, getTierIndexForLimit, getLimitForTierIndex, getSitesLimitForPlan } from '@/lib/plans'
|
import { TRAFFIC_TIERS, PLAN_ID_SOLO, PLAN_ID_TEAM, PLAN_ID_BUSINESS, getTierIndexForLimit, getLimitForTierIndex, getSitesLimitForPlan } from '@/lib/plans'
|
||||||
import { getAuditLog, AuditLogEntry, GetAuditLogParams } from '@/lib/api/audit'
|
import { getAuditLog, AuditLogEntry, GetAuditLogParams } from '@/lib/api/audit'
|
||||||
import { getNotificationSettings, updateNotificationSettings } from '@/lib/api/notification-settings'
|
import { getNotificationSettings, updateNotificationSettings } from '@/lib/api/notification-settings'
|
||||||
import { toast } from '@ciphera-net/ui'
|
import { toast } from '@ciphera-net/ui'
|
||||||
@@ -85,6 +85,7 @@ export default function OrganizationSettings() {
|
|||||||
const [showCancelPrompt, setShowCancelPrompt] = useState(false)
|
const [showCancelPrompt, setShowCancelPrompt] = useState(false)
|
||||||
const [isResuming, setIsResuming] = useState(false)
|
const [isResuming, setIsResuming] = useState(false)
|
||||||
const [showChangePlanModal, setShowChangePlanModal] = useState(false)
|
const [showChangePlanModal, setShowChangePlanModal] = useState(false)
|
||||||
|
const [changePlanId, setChangePlanId] = useState<string>(PLAN_ID_SOLO)
|
||||||
const [changePlanTierIndex, setChangePlanTierIndex] = useState(2)
|
const [changePlanTierIndex, setChangePlanTierIndex] = useState(2)
|
||||||
const [changePlanYearly, setChangePlanYearly] = useState(false)
|
const [changePlanYearly, setChangePlanYearly] = useState(false)
|
||||||
const [invoicePreview, setInvoicePreview] = useState<PreviewInvoiceResult | null>(null)
|
const [invoicePreview, setInvoicePreview] = useState<PreviewInvoiceResult | null>(null)
|
||||||
@@ -345,6 +346,12 @@ export default function OrganizationSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const openChangePlanModal = () => {
|
const openChangePlanModal = () => {
|
||||||
|
const currentPlan = subscription?.plan_id
|
||||||
|
if (currentPlan === PLAN_ID_TEAM || currentPlan === PLAN_ID_BUSINESS) {
|
||||||
|
setChangePlanId(currentPlan)
|
||||||
|
} else {
|
||||||
|
setChangePlanId(PLAN_ID_SOLO)
|
||||||
|
}
|
||||||
if (subscription?.pageview_limit != null && subscription.pageview_limit > 0) {
|
if (subscription?.pageview_limit != null && subscription.pageview_limit > 0) {
|
||||||
setChangePlanTierIndex(getTierIndexForLimit(subscription.pageview_limit))
|
setChangePlanTierIndex(getTierIndexForLimit(subscription.pageview_limit))
|
||||||
} else {
|
} else {
|
||||||
@@ -367,11 +374,11 @@ export default function OrganizationSettings() {
|
|||||||
setInvoicePreview(null)
|
setInvoicePreview(null)
|
||||||
const interval = changePlanYearly ? 'year' : 'month'
|
const interval = changePlanYearly ? 'year' : 'month'
|
||||||
const limit = getLimitForTierIndex(changePlanTierIndex)
|
const limit = getLimitForTierIndex(changePlanTierIndex)
|
||||||
previewInvoice({ plan_id: PLAN_ID_SOLO, interval, limit })
|
previewInvoice({ plan_id: changePlanId, interval, limit })
|
||||||
.then((res) => { if (!cancelled) setInvoicePreview(res ?? null) })
|
.then((res) => { if (!cancelled) setInvoicePreview(res ?? null) })
|
||||||
.finally(() => { if (!cancelled) setIsLoadingPreview(false) })
|
.finally(() => { if (!cancelled) setIsLoadingPreview(false) })
|
||||||
return () => { cancelled = true }
|
return () => { cancelled = true }
|
||||||
}, [showChangePlanModal, hasActiveSubscription, changePlanTierIndex, changePlanYearly])
|
}, [showChangePlanModal, hasActiveSubscription, changePlanId, changePlanTierIndex, changePlanYearly])
|
||||||
|
|
||||||
const handleChangePlanSubmit = async () => {
|
const handleChangePlanSubmit = async () => {
|
||||||
const interval = changePlanYearly ? 'year' : 'month'
|
const interval = changePlanYearly ? 'year' : 'month'
|
||||||
@@ -379,12 +386,12 @@ export default function OrganizationSettings() {
|
|||||||
setIsChangingPlan(true)
|
setIsChangingPlan(true)
|
||||||
try {
|
try {
|
||||||
if (hasActiveSubscription) {
|
if (hasActiveSubscription) {
|
||||||
await changePlan({ plan_id: PLAN_ID_SOLO, interval, limit })
|
await changePlan({ plan_id: changePlanId, interval, limit })
|
||||||
toast.success('Plan updated. Changes may take a moment to reflect.')
|
toast.success('Plan updated. Changes may take a moment to reflect.')
|
||||||
setShowChangePlanModal(false)
|
setShowChangePlanModal(false)
|
||||||
loadSubscription()
|
loadSubscription()
|
||||||
} else {
|
} else {
|
||||||
const { url } = await createCheckoutSession({ plan_id: PLAN_ID_SOLO, interval, limit })
|
const { url } = await createCheckoutSession({ plan_id: changePlanId, interval, limit })
|
||||||
if (url) window.location.href = url
|
if (url) window.location.href = url
|
||||||
else throw new Error('No checkout URL')
|
else throw new Error('No checkout URL')
|
||||||
}
|
}
|
||||||
@@ -844,6 +851,29 @@ export default function OrganizationSettings() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Past due notice */}
|
||||||
|
{subscription.subscription_status === 'past_due' && (
|
||||||
|
<div className="p-4 bg-red-50 dark:bg-red-900/10 border border-red-200 dark:border-red-800 rounded-2xl flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||||
|
<div className="flex-1">
|
||||||
|
<p className="text-sm font-medium text-red-800 dark:text-red-200">
|
||||||
|
Payment past due
|
||||||
|
</p>
|
||||||
|
<p className="text-xs text-red-700 dark:text-red-300 mt-0.5">
|
||||||
|
We couldn't charge your payment method. Please update your billing info to avoid service interruption.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
onClick={handleManageSubscription}
|
||||||
|
disabled={isRedirectingToPortal}
|
||||||
|
isLoading={isRedirectingToPortal}
|
||||||
|
className="shrink-0"
|
||||||
|
>
|
||||||
|
Update payment method
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Cancel-at-period-end notice */}
|
{/* Cancel-at-period-end notice */}
|
||||||
{subscription.cancel_at_period_end && (
|
{subscription.cancel_at_period_end && (
|
||||||
<div className="p-4 bg-amber-50 dark:bg-amber-900/10 border border-amber-200 dark:border-amber-800 rounded-2xl flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
<div className="p-4 bg-amber-50 dark:bg-amber-900/10 border border-amber-200 dark:border-amber-800 rounded-2xl flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||||
@@ -886,9 +916,11 @@ export default function OrganizationSettings() {
|
|||||||
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300'
|
? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300'
|
||||||
: subscription.subscription_status === 'trialing'
|
: subscription.subscription_status === 'trialing'
|
||||||
? 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300'
|
? 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300'
|
||||||
|
: subscription.subscription_status === 'past_due'
|
||||||
|
? 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300'
|
||||||
: 'bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300'
|
: 'bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300'
|
||||||
}`}>
|
}`}>
|
||||||
{subscription.subscription_status === 'trialing' ? 'Trial' : (subscription.subscription_status || 'Free')}
|
{subscription.subscription_status === 'trialing' ? 'Trial' : subscription.subscription_status === 'past_due' ? 'Past Due' : (subscription.subscription_status || 'Free')}
|
||||||
</span>
|
</span>
|
||||||
{subscription.billing_interval && (
|
{subscription.billing_interval && (
|
||||||
<span className="text-xs text-neutral-500 capitalize">
|
<span className="text-xs text-neutral-500 capitalize">
|
||||||
@@ -918,7 +950,7 @@ export default function OrganizationSettings() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Usage stats */}
|
{/* Usage stats */}
|
||||||
<div className="border-t border-neutral-200 dark:border-neutral-800 px-6 py-5 grid grid-cols-2 md:grid-cols-4 gap-y-4 gap-x-6">
|
<div className="border-t border-neutral-200 dark:border-neutral-800 p-6 grid grid-cols-2 md:grid-cols-4 gap-y-4 gap-x-6">
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-neutral-500 uppercase tracking-wider mb-1">Sites</div>
|
<div className="text-xs text-neutral-500 uppercase tracking-wider mb-1">Sites</div>
|
||||||
<div className="text-lg font-semibold text-neutral-900 dark:text-white">
|
<div className="text-lg font-semibold text-neutral-900 dark:text-white">
|
||||||
@@ -937,6 +969,22 @@ export default function OrganizationSettings() {
|
|||||||
? `${subscription.pageview_usage.toLocaleString()} / ${subscription.pageview_limit.toLocaleString()}`
|
? `${subscription.pageview_usage.toLocaleString()} / ${subscription.pageview_limit.toLocaleString()}`
|
||||||
: '—'}
|
: '—'}
|
||||||
</div>
|
</div>
|
||||||
|
{subscription.pageview_limit > 0 && typeof subscription.pageview_usage === 'number' && (
|
||||||
|
<div className="mt-2 h-1.5 w-full rounded-full bg-neutral-200 dark:bg-neutral-700 overflow-hidden">
|
||||||
|
<div
|
||||||
|
className={`h-full rounded-full transition-all ${
|
||||||
|
subscription.pageview_usage / subscription.pageview_limit >= 1
|
||||||
|
? 'bg-red-500'
|
||||||
|
: subscription.pageview_usage / subscription.pageview_limit >= 0.9
|
||||||
|
? 'bg-red-400'
|
||||||
|
: subscription.pageview_usage / subscription.pageview_limit >= 0.8
|
||||||
|
? 'bg-amber-400'
|
||||||
|
: 'bg-green-500'
|
||||||
|
}`}
|
||||||
|
style={{ width: `${Math.min(100, (subscription.pageview_usage / subscription.pageview_limit) * 100)}%` }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-neutral-500 uppercase tracking-wider mb-1">
|
<div className="text-xs text-neutral-500 uppercase tracking-wider mb-1">
|
||||||
@@ -975,7 +1023,7 @@ export default function OrganizationSettings() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={handleManageSubscription}
|
onClick={handleManageSubscription}
|
||||||
disabled={isRedirectingToPortal}
|
disabled={isRedirectingToPortal}
|
||||||
className="inline-flex items-center gap-1.5 text-sm text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white transition-colors disabled:opacity-50"
|
className="inline-flex items-center gap-1.5 text-sm text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white transition-colors disabled:opacity-50 focus:outline-none focus:ring-2 focus:ring-brand-orange focus:rounded"
|
||||||
>
|
>
|
||||||
<ExternalLinkIcon className="w-4 h-4" />
|
<ExternalLinkIcon className="w-4 h-4" />
|
||||||
Payment method & invoices
|
Payment method & invoices
|
||||||
@@ -985,7 +1033,7 @@ export default function OrganizationSettings() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowCancelPrompt(true)}
|
onClick={() => setShowCancelPrompt(true)}
|
||||||
className="inline-flex items-center gap-1.5 rounded-lg border border-neutral-200 dark:border-neutral-700 px-3.5 py-1.5 text-sm text-neutral-600 dark:text-neutral-400 hover:border-red-300 hover:text-red-600 dark:hover:border-red-800 dark:hover:text-red-400 transition-colors"
|
className="inline-flex items-center gap-1.5 rounded-xl border border-neutral-200 dark:border-neutral-700 px-3.5 py-1.5 text-sm text-neutral-600 dark:text-neutral-400 hover:border-red-300 hover:text-red-600 dark:hover:border-red-800 dark:hover:text-red-400 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2"
|
||||||
>
|
>
|
||||||
Cancel subscription
|
Cancel subscription
|
||||||
</button>
|
</button>
|
||||||
@@ -994,7 +1042,7 @@ export default function OrganizationSettings() {
|
|||||||
|
|
||||||
{/* Invoice History */}
|
{/* Invoice History */}
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-medium text-neutral-500 uppercase tracking-wider mb-3">Recent invoices</h3>
|
<h3 className="text-lg font-semibold text-neutral-900 dark:text-white mb-3">Recent invoices</h3>
|
||||||
<div className="bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-2xl overflow-hidden divide-y divide-neutral-200 dark:divide-neutral-800">
|
<div className="bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-2xl overflow-hidden divide-y divide-neutral-200 dark:divide-neutral-800">
|
||||||
{isLoadingInvoices ? (
|
{isLoadingInvoices ? (
|
||||||
<div className="flex items-center justify-center py-8">
|
<div className="flex items-center justify-center py-8">
|
||||||
@@ -1028,14 +1076,14 @@ export default function OrganizationSettings() {
|
|||||||
</span>
|
</span>
|
||||||
{invoice.invoice_pdf && (
|
{invoice.invoice_pdf && (
|
||||||
<a href={invoice.invoice_pdf} target="_blank" rel="noopener noreferrer"
|
<a href={invoice.invoice_pdf} target="_blank" rel="noopener noreferrer"
|
||||||
className="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors" title="Download PDF">
|
className="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-brand-orange" title="Download PDF">
|
||||||
<DownloadIcon className="w-3.5 h-3.5" />
|
<DownloadIcon className="w-3.5 h-3.5" />
|
||||||
Download PDF
|
Download PDF
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{invoice.hosted_invoice_url && (
|
{invoice.hosted_invoice_url && (
|
||||||
<a href={invoice.hosted_invoice_url} target="_blank" rel="noopener noreferrer"
|
<a href={invoice.hosted_invoice_url} target="_blank" rel="noopener noreferrer"
|
||||||
className="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors" title="View invoice">
|
className="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-brand-orange" title="View invoice">
|
||||||
<ExternalLinkIcon className="w-3.5 h-3.5" />
|
<ExternalLinkIcon className="w-3.5 h-3.5" />
|
||||||
View invoice
|
View invoice
|
||||||
</a>
|
</a>
|
||||||
@@ -1411,8 +1459,9 @@ export default function OrganizationSettings() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowChangePlanModal(false)}
|
onClick={() => setShowChangePlanModal(false)}
|
||||||
className="text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-400"
|
className="text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-brand-orange rounded-lg p-1"
|
||||||
disabled={isChangingPlan}
|
disabled={isChangingPlan}
|
||||||
|
aria-label="Close dialog"
|
||||||
>
|
>
|
||||||
<XIcon className="w-5 h-5" />
|
<XIcon className="w-5 h-5" />
|
||||||
</button>
|
</button>
|
||||||
@@ -1421,6 +1470,41 @@ export default function OrganizationSettings() {
|
|||||||
Choose your pageview limit and billing interval. {hasActiveSubscription ? 'Your next invoice will reflect prorations.' : 'You’ll start a new subscription.'}
|
Choose your pageview limit and billing interval. {hasActiveSubscription ? 'Your next invoice will reflect prorations.' : 'You’ll start a new subscription.'}
|
||||||
</p>
|
</p>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2">Plan</label>
|
||||||
|
<div className="grid grid-cols-3 gap-2">
|
||||||
|
{([
|
||||||
|
{ id: PLAN_ID_SOLO, name: 'Solo', sites: '1 site' },
|
||||||
|
{ id: PLAN_ID_TEAM, name: 'Team', sites: 'Up to 5 sites' },
|
||||||
|
{ id: PLAN_ID_BUSINESS, name: 'Business', sites: 'Up to 10 sites' },
|
||||||
|
] as const).map((plan) => {
|
||||||
|
const isCurrentPlan = subscription?.plan_id === plan.id
|
||||||
|
const isSelected = changePlanId === plan.id
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={plan.id}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setChangePlanId(plan.id)}
|
||||||
|
className={`relative p-3 rounded-xl border text-left transition-all focus:outline-none focus:ring-2 focus:ring-brand-orange ${
|
||||||
|
isSelected
|
||||||
|
? 'border-brand-orange bg-brand-orange/5 dark:bg-brand-orange/10'
|
||||||
|
: 'border-neutral-200 dark:border-neutral-700 hover:border-neutral-300 dark:hover:border-neutral-600'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span className={`block text-sm font-semibold ${isSelected ? 'text-brand-orange' : 'text-neutral-900 dark:text-white'}`}>
|
||||||
|
{plan.name}
|
||||||
|
</span>
|
||||||
|
<span className="block text-xs text-neutral-500 mt-0.5">{plan.sites}</span>
|
||||||
|
{isCurrentPlan && (
|
||||||
|
<span className="absolute -top-2 right-2 px-1.5 py-0.5 text-[10px] font-medium bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 rounded-full border border-neutral-200 dark:border-neutral-700">
|
||||||
|
Current
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2">Pageviews per month</label>
|
<label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2">Pageviews per month</label>
|
||||||
<select
|
<select
|
||||||
@@ -1441,14 +1525,14 @@ export default function OrganizationSettings() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setChangePlanYearly(false)}
|
onClick={() => setChangePlanYearly(false)}
|
||||||
className={`flex-1 py-2 text-sm font-medium rounded-md transition-colors ${!changePlanYearly ? 'bg-brand-orange text-white' : 'text-neutral-600 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800'}`}
|
className={`flex-1 py-2 text-sm font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-brand-orange ${!changePlanYearly ? 'bg-brand-orange text-white' : 'text-neutral-600 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800'}`}
|
||||||
>
|
>
|
||||||
Monthly
|
Monthly
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setChangePlanYearly(true)}
|
onClick={() => setChangePlanYearly(true)}
|
||||||
className={`flex-1 py-2 text-sm font-medium rounded-md transition-colors ${changePlanYearly ? 'bg-brand-orange text-white' : 'text-neutral-600 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800'}`}
|
className={`flex-1 py-2 text-sm font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-brand-orange ${changePlanYearly ? 'bg-brand-orange text-white' : 'text-neutral-600 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800'}`}
|
||||||
>
|
>
|
||||||
Yearly
|
Yearly
|
||||||
</button>
|
</button>
|
||||||
@@ -1456,7 +1540,7 @@ export default function OrganizationSettings() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{hasActiveSubscription && (
|
{hasActiveSubscription && (
|
||||||
<div className="mt-4 p-3 rounded-lg bg-neutral-100 dark:bg-neutral-800/50 border border-neutral-200 dark:border-neutral-700">
|
<div className="mt-4 p-4 rounded-lg bg-neutral-100 dark:bg-neutral-800/50 border border-neutral-200 dark:border-neutral-700">
|
||||||
{isLoadingPreview ? (
|
{isLoadingPreview ? (
|
||||||
<div className="flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-400">
|
<div className="flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-400">
|
||||||
<Spinner className="w-4 h-4" />
|
<Spinner className="w-4 h-4" />
|
||||||
|
|||||||
Reference in New Issue
Block a user