diff --git a/apps/remix/app/components/general/organisations/organisation-quota-banner.tsx b/apps/remix/app/components/general/organisations/organisation-quota-banner.tsx index c25f23bb3..b2a5e1a93 100644 --- a/apps/remix/app/components/general/organisations/organisation-quota-banner.tsx +++ b/apps/remix/app/components/general/organisations/organisation-quota-banner.tsx @@ -3,6 +3,7 @@ import { SUPPORT_EMAIL } from '@documenso/lib/constants/app'; import { DO_NOT_INVALIDATE_QUERY_ON_MUTATION, SKIP_QUERY_BATCH_META } from '@documenso/lib/constants/trpc'; import { INTERNAL_CLAIM_ID } from '@documenso/lib/types/subscription'; import { trpc } from '@documenso/trpc/react'; +import { cn } from '@documenso/ui/lib/utils'; import { Alert, AlertDescription } from '@documenso/ui/primitives/alert'; import { Button } from '@documenso/ui/primitives/button'; import { @@ -38,12 +39,18 @@ export const OrganisationQuotaBanner = () => { quotaFlags?.isDocumentQuotaExceeded || quotaFlags?.isEmailQuotaExceeded || quotaFlags?.isApiQuotaExceeded, ); - // Every member of the organisation sees the banner when a quota is exhausted. + const isAnyQuotaNearing = Boolean( + quotaFlags?.isDocumentQuotaNearing || quotaFlags?.isEmailQuotaNearing || quotaFlags?.isApiQuotaNearing, + ); + + // Every member of the organisation sees the banner when a quota is exhausted or + // nearing its limit. When both states apply, "exceeded" wins for the banner copy + // and the dialog lists both exceeded and nearing items. // Note: Skipping free plan banner for now because their quota can incorrectly show as exceeded. if ( !organisation || !quotaFlags || - !isAnyQuotaExceeded || + (!isAnyQuotaExceeded && !isAnyQuotaNearing) || organisation.organisationClaim.originalSubscriptionClaimId === INTERNAL_CLAIM_ID.FREE ) { return null; @@ -51,17 +58,29 @@ export const OrganisationQuotaBanner = () => { return ( <> -
+
- Your organisation has exceeded a fair use limit + {isAnyQuotaExceeded ? ( + Your organisation has exceeded a fair use limit + ) : ( + Your organisation is approaching a fair use limit + )}