import { Header3 } from "~/components/primitives/Headers"; import { InfoIconTooltip, SimpleTooltip } from "~/components/primitives/Tooltip"; import { useOrganization } from "~/hooks/useOrganizations"; import { v3SchedulesAddOnPath } from "~/utils/pathBuilder"; import { ScheduleLimitActions } from "./ScheduleLimitActions"; import { type SchedulePricing } from "./PurchaseSchedulesModal"; type Props = { limits: { used: number; limit: number }; /** True when the user has used all available schedules and cannot exceed the plan limit. */ requiresUpgrade: boolean; /** True when the plan would let them upgrade (vs being already on the highest plan). */ canUpgrade: boolean; canPurchaseSchedules: boolean; extraSchedules: number; maxScheduleQuota: number; planScheduleLimit: number; schedulePricing: SchedulePricing | null; }; export function SchedulesUsageBar({ limits, requiresUpgrade, canUpgrade, canPurchaseSchedules, extraSchedules, maxScheduleQuota, planScheduleLimit, schedulePricing, }: Props) { const organization = useOrganization(); const actionPath = v3SchedulesAddOnPath(organization); const ratio = limits.limit > 0 ? Math.min(limits.used / limits.limit, 1) : 0; return (
} content={`${Math.round(ratio * 100)}%`} />
{requiresUpgrade ? ( You've used all {limits.limit} of your available schedules. Upgrade your plan to enable more. ) : (
You've used {limits.used}/{limits.limit} of your schedules
)}
); }