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