access-levels-changed.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { useTranslation } from 'react-i18next'
  2. import Notification from '@/shared/components/notification'
  3. import { upgradePlan } from '@/main/account-upgrade'
  4. import { useProjectContext } from '@/shared/context/project-context'
  5. import { useUserContext } from '@/shared/context/user-context'
  6. import { sendMB } from '@/infrastructure/event-tracking'
  7. import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
  8. import OLButton from '@/shared/components/ol/ol-button'
  9. type AccessLevelsChangedProps = {
  10. somePendingEditorsResolved: boolean
  11. }
  12. export default function AccessLevelsChanged({
  13. somePendingEditorsResolved,
  14. }: AccessLevelsChangedProps) {
  15. const { t } = useTranslation()
  16. const { features } = useProjectContext()
  17. const user = useUserContext()
  18. return (
  19. <div className="add-collaborators-upgrade">
  20. <Notification
  21. isActionBelowContent
  22. type={somePendingEditorsResolved ? 'info' : 'warning'}
  23. title={
  24. somePendingEditorsResolved
  25. ? t('select_access_levels')
  26. : t('access_levels_changed')
  27. }
  28. content={
  29. somePendingEditorsResolved ? (
  30. <p>{t('your_project_exceeded_collaborator_limit')}</p>
  31. ) : (
  32. <p>
  33. {t('this_project_exceeded_collaborator_limit')}{' '}
  34. {t('you_can_select_or_invite_collaborator', {
  35. count: features.collaborators,
  36. })}
  37. </p>
  38. )
  39. }
  40. action={
  41. <div className="upgrade-actions">
  42. {user.allowedFreeTrial ? (
  43. <StartFreeTrialButton
  44. buttonProps={{ variant: 'secondary', size: 'sm' }}
  45. source="project-sharing"
  46. variant="exceeds"
  47. >
  48. {t('upgrade')}
  49. </StartFreeTrialButton>
  50. ) : (
  51. <OLButton
  52. variant="secondary"
  53. size="sm"
  54. onClick={() => {
  55. upgradePlan('project-sharing')
  56. }}
  57. >
  58. {t('upgrade')}
  59. </OLButton>
  60. )}
  61. <OLButton
  62. variant="link"
  63. size="sm"
  64. href="https://www.overleaf.com/blog/changes-to-project-sharing"
  65. target="_blank"
  66. rel="noreferrer"
  67. onClick={() => {
  68. sendMB('paywall-info-click', {
  69. 'paywall-type': 'project-sharing',
  70. content: 'blog',
  71. variant: 'exceeds',
  72. })
  73. }}
  74. >
  75. {t('read_more')}
  76. </OLButton>
  77. </div>
  78. }
  79. />
  80. </div>
  81. )
  82. }