compile-timeout-changing-soon.tsx 3.5 KB

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