compile-time-changing-soon.tsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import Notification from '@/shared/components/notification'
  2. import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
  3. import { Trans, useTranslation } from 'react-i18next'
  4. import * as eventTracking from '@/infrastructure/event-tracking'
  5. import { FC } from 'react'
  6. export const CompileTimeoutChangingSoon: FC<{
  7. isProjectOwner?: boolean
  8. handleDismissChangingSoon: () => void
  9. segmentation?: eventTracking.Segmentation
  10. }> = ({ isProjectOwner = false, handleDismissChangingSoon, segmentation }) => {
  11. const { t } = useTranslation()
  12. const sendInfoClickEvent = () => {
  13. eventTracking.sendMB('paywall-info-click', {
  14. 'paywall-type': 'compile-time-warning',
  15. ...segmentation,
  16. content: 'blog',
  17. })
  18. }
  19. const compileTimeoutChangesBlogLink = (
  20. /* eslint-disable-next-line jsx-a11y/anchor-has-content */
  21. <a
  22. aria-label={t('read_more_about_compile_timeout_changes')}
  23. href="/blog/changes-to-free-compile-timeout"
  24. key="compileTimeoutBlogLink1"
  25. rel="noopener noreferrer"
  26. target="_blank"
  27. onClick={sendInfoClickEvent}
  28. />
  29. )
  30. const fixingCompileTimeoutsLearnLink = (
  31. /* eslint-disable-next-line jsx-a11y/anchor-has-content */
  32. <a
  33. aria-label={t('read_more_about_fix_prevent_timeout')}
  34. href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
  35. key="compileTimeoutBlogLink2"
  36. target="_blank"
  37. rel="noopener noreferrer"
  38. />
  39. )
  40. if (isProjectOwner) {
  41. return (
  42. <Notification
  43. action={
  44. <StartFreeTrialButton
  45. segmentation={segmentation}
  46. source="compile-time-warning"
  47. buttonProps={{
  48. variant: 'secondary',
  49. size: 'sm',
  50. }}
  51. >
  52. {t('start_free_trial_without_exclamation')}
  53. </StartFreeTrialButton>
  54. }
  55. ariaLive="polite"
  56. content={
  57. <div>
  58. <p>
  59. <Trans
  60. i18nKey="introducing_shorter_compile_timeout"
  61. components={[compileTimeoutChangesBlogLink]}
  62. />
  63. </p>
  64. <p className="row-spaced">
  65. <Trans
  66. i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
  67. components={[fixingCompileTimeoutsLearnLink]}
  68. />{' '}
  69. <Trans
  70. i18nKey="and_upgrade_for_compile_time"
  71. components={{ strong: <strong /> }}
  72. />
  73. </p>
  74. </div>
  75. }
  76. title={t('your_project_compiled_but_soon_might_not')}
  77. type="warning"
  78. isActionBelowContent
  79. isDismissible
  80. onDismiss={handleDismissChangingSoon}
  81. />
  82. )
  83. }
  84. return (
  85. <Notification
  86. ariaLive="polite"
  87. content={
  88. <div>
  89. <p>
  90. <Trans
  91. i18nKey="introducing_shorter_compile_timeout"
  92. components={[compileTimeoutChangesBlogLink]}
  93. />{' '}
  94. <Trans
  95. i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
  96. components={[fixingCompileTimeoutsLearnLink]}
  97. />
  98. </p>
  99. <p className="row-spaced">
  100. <Trans
  101. i18nKey="tell_the_project_owner_and_ask_them_to_upgrade"
  102. components={[
  103. // eslint-disable-next-line react/jsx-key
  104. <strong />,
  105. ]}
  106. />
  107. </p>
  108. </div>
  109. }
  110. title={t('this_project_compiled_but_soon_might_not')}
  111. type="warning"
  112. isDismissible
  113. onDismiss={handleDismissChangingSoon}
  114. />
  115. )
  116. }