'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useAuth } from '@/lib/hooks/useAuth'; import { authApi } from '@/lib/api/auth'; import type { SubscriptionAlertData } from '@/types'; export default function SubscriptionsSettingsPage() { const { currentOrganization } = useAuth(); const router = useRouter(); const [alert, setAlert] = useState(null); useEffect(() => { if (currentOrganization && !currentOrganization.isOwner) { router.replace('/today'); } }, [currentOrganization, router]); useEffect(() => { if (!currentOrganization?.isOwner) return; void authApi.getSubscriptionAlert().then((r) => { if (r.success) setAlert(r.data); }); }, [currentOrganization?.id, currentOrganization?.isOwner]); if (!currentOrganization) { return (

Loading...

); } if (!currentOrganization.isOwner) { return (

Redirecting...

); } const plan = currentOrganization.plan; const maxUsers = plan?.maxUsers; return (
← Back to app

Subscriptions

Your DyoLink workspace plan and seats for{' '} {currentOrganization.name}. Clinic and lab income tracking stays under the sidebar{' '} Billing tab.

Current plan

{plan?.name ?? '—'}

{typeof maxUsers === 'number' && maxUsers < 999999 && (

Seats (this org)

{alert?.seatsUsed ?? '—'} / {maxUsers}

)}
{alert?.showWarning && (
{alert.trialExpired && (

Trial period has ended. Choose a plan when checkout is available.

)} {!alert.trialExpired && alert.trialEndingSoon && (

Trial ends in {alert.daysUntilTrialEnd ?? '—'} day(s).

)} {!alert.trialExpired && !alert.trialEndingSoon && alert.seatsLow && (

Seat usage is high for this organization.

)}
)}

Payment and plan upgrades will connect here. The warning on the settings icon is only shown to workspace owners when seats are low or the trial window is ending.

); }