add-collaborators-upgrade.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { useState } from 'react'
  2. import { Trans, useTranslation } from 'react-i18next'
  3. import { Button } from 'react-bootstrap'
  4. import PropTypes from 'prop-types'
  5. import { useUserContext } from '../../../shared/context/user-context'
  6. import Icon from '../../../shared/components/icon'
  7. import { upgradePlan } from '../../../main/account-upgrade'
  8. import StartFreeTrialButton from '../../../shared/components/start-free-trial-button'
  9. export default function AddCollaboratorsUpgrade() {
  10. const { t } = useTranslation()
  11. const user = useUserContext({
  12. allowedFreeTrial: PropTypes.bool,
  13. })
  14. const [startedFreeTrial, setStartedFreeTrial] = useState(false)
  15. return (
  16. <div className="add-collaborators-upgrade">
  17. <p className="text-center">
  18. <Trans i18nKey="need_to_upgrade_for_more_collabs" />. {t('also')}:
  19. </p>
  20. <ul className="list-unstyled">
  21. <li>
  22. <Icon type="check" />
  23. &nbsp;
  24. <Trans i18nKey="unlimited_projects" />
  25. </li>
  26. <li>
  27. <Icon type="check" />
  28. &nbsp;
  29. <Trans
  30. i18nKey="collabs_per_proj"
  31. values={{ collabcount: 'Multiple' }}
  32. />
  33. </li>
  34. <li>
  35. <Icon type="check" />
  36. &nbsp;
  37. <Trans i18nKey="full_doc_history" />
  38. </li>
  39. <li>
  40. <Icon type="check" />
  41. &nbsp;
  42. <Trans i18nKey="sync_to_dropbox" />
  43. </li>
  44. <li>
  45. <Icon type="check" />
  46. &nbsp;
  47. <Trans i18nKey="sync_to_github" />
  48. </li>
  49. <li>
  50. <Icon type="check" />
  51. &nbsp;
  52. <Trans i18nKey="compile_larger_projects" />
  53. </li>
  54. </ul>
  55. <p className="text-center row-spaced-thin">
  56. {user.allowedFreeTrial ? (
  57. <StartFreeTrialButton
  58. buttonStyle="success"
  59. setStartedFreeTrial={setStartedFreeTrial}
  60. source="project-sharing"
  61. />
  62. ) : (
  63. <Button
  64. bsStyle="success"
  65. onClick={() => {
  66. upgradePlan('project-sharing')
  67. setStartedFreeTrial(true)
  68. }}
  69. >
  70. <Trans i18nKey="upgrade" />
  71. </Button>
  72. )}
  73. </p>
  74. {startedFreeTrial && (
  75. <p className="small">
  76. <Trans i18nKey="refresh_page_after_starting_free_trial" />
  77. </p>
  78. )}
  79. </div>
  80. )
  81. }