EnterpriseCard.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // @ts-nocheck
  2. import { Check } from 'lucide-react'
  3. import { PricingInformation } from 'shared-data'
  4. import { Button, cn } from 'ui'
  5. import { useSendEventMutation } from '@/data/telemetry/send-event-mutation'
  6. import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
  7. export interface EnterpriseCardProps {
  8. plan: PricingInformation
  9. isCurrentPlan: boolean
  10. }
  11. export const EnterpriseCard = ({ plan, isCurrentPlan }: EnterpriseCardProps) => {
  12. const { data: selectedOrganization } = useSelectedOrganizationQuery()
  13. const orgSlug = selectedOrganization?.slug
  14. const features = plan.features
  15. const currentPlan = selectedOrganization?.plan.name
  16. const { mutate: sendEvent } = useSendEventMutation()
  17. return (
  18. <div
  19. key={plan.id}
  20. className={cn(
  21. 'grid grid-cols-1 md:grid-cols-3 border rounded-md bg-studio',
  22. 'py-4 col-span-12 justify-between gap-x-8'
  23. )}
  24. >
  25. <div className="flex flex-col justify-center px-4">
  26. <div className="flex items-center space-x-2">
  27. <p className={cn('text-brand text-sm uppercase')}>{plan.name}</p>
  28. {isCurrentPlan ? (
  29. <div className="text-xs bg-surface-300 text-foreground-light rounded-sm px-2 py-0.5">
  30. Current plan
  31. </div>
  32. ) : plan.nameBadge ? (
  33. <div className="text-xs bg-surface-200 text-brand rounded-sm px-2 py-0.5">
  34. {plan.nameBadge}
  35. </div>
  36. ) : null}
  37. </div>
  38. <p className="text-sm mt-2 mb-4">{plan.description}</p>
  39. <Button
  40. block
  41. asChild
  42. type="default"
  43. size="tiny"
  44. onClick={() =>
  45. sendEvent({
  46. action: 'studio_pricing_plan_cta_clicked',
  47. properties: { selectedPlan: 'Enterprise', currentPlan },
  48. groups: { organization: orgSlug ?? 'Unknown' },
  49. })
  50. }
  51. >
  52. <a href={plan.href} className="hidden md:block" target="_blank">
  53. {plan.cta}
  54. </a>
  55. </Button>
  56. </div>
  57. <div className="flex flex-col justify-center col-span-2 px-4 md:px-0">
  58. <ul
  59. role="list"
  60. className="text-xs text-foreground-light md:grid md:grid-cols-2 md:gap-x-10"
  61. >
  62. {features.map((feature) => (
  63. <li
  64. key={typeof feature === 'string' ? feature : feature[0]}
  65. className="flex items-center py-2 first:mt-0"
  66. >
  67. <Check className="text-brand h-4 w-4" aria-hidden="true" strokeWidth={3} />
  68. <span className="text-foreground mb-0 ml-3 ">
  69. {typeof feature === 'string' ? feature : feature[0]}
  70. </span>
  71. </li>
  72. ))}
  73. </ul>
  74. <Button
  75. block
  76. asChild
  77. type="default"
  78. size="tiny"
  79. onClick={() =>
  80. sendEvent({
  81. action: 'studio_pricing_plan_cta_clicked',
  82. properties: { selectedPlan: 'Enterprise', currentPlan },
  83. groups: { organization: orgSlug ?? 'Unknown' },
  84. })
  85. }
  86. >
  87. <a href={plan.href} className="visible md:hidden mt-8" target="_blank">
  88. {plan.cta}
  89. </a>
  90. </Button>
  91. </div>
  92. </div>
  93. )
  94. }