restriction.constants.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import dayjs from 'dayjs'
  2. import { type ReactNode } from 'react'
  3. import { TimestampInfo } from 'ui-patterns'
  4. import { InlineLink } from '@/components/ui/InlineLink'
  5. export const RESTRICTION_MESSAGES = {
  6. GRACE_PERIOD: {
  7. title: 'Organization exceeded its quota in the previous billing cycle',
  8. description: (date: string, slug: string): ReactNode => {
  9. const label = dayjs(date).format('DD MMM, YYYY')
  10. return (
  11. <>
  12. You have a grace period until{' '}
  13. <TimestampInfo className="text-sm" utcTimestamp={date} label={label} /> to bring usage
  14. back under quota. <InlineLink href={`/org/${slug}/usage`}>Review usage</InlineLink>
  15. </>
  16. )
  17. },
  18. },
  19. GRACE_PERIOD_OVER: {
  20. title: 'Grace period is over',
  21. description: (slug: string): ReactNode => (
  22. <>
  23. Your projects will not be able to serve requests when you use up your quota.{' '}
  24. <InlineLink href={`/org/${slug}/billing`}>Review billing</InlineLink>
  25. </>
  26. ),
  27. },
  28. RESTRICTED: {
  29. title: 'Services restricted',
  30. description: (slug: string): ReactNode => (
  31. <>
  32. Your projects are unable to serve requests as your organization has used up its quota.{' '}
  33. <InlineLink href={`/org/${slug}/billing`}>Resolve billing issues</InlineLink>
  34. </>
  35. ),
  36. },
  37. OVERDUE_INVOICES: {
  38. title: 'Outstanding invoices',
  39. description: (slug: string): ReactNode => (
  40. <>
  41. Please <InlineLink href={`/org/${slug}/billing#invoices`}>pay your invoices</InlineLink> to
  42. avoid service disruption
  43. </>
  44. ),
  45. },
  46. OVERDUE_INVOICES_FROM_OTHER_ORGS: {
  47. title: 'Outstanding invoices in other organization',
  48. description: (slug: string): ReactNode => (
  49. <>
  50. Please <InlineLink href={`/org/${slug}/billing#invoices`}>pay invoices</InlineLink> for
  51. other organizations to avoid service disruption
  52. </>
  53. ),
  54. },
  55. }