compile-timeout-changing-soon.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 compileTimeoutBlogLinks = [
  18. /* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
  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. /* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
  28. <a
  29. aria-label={t('read_more_about_fix_prevent_timeout')}
  30. href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
  31. key="compileTimeoutBlogLink2"
  32. target="_blank"
  33. rel="noopener noreferrer"
  34. />,
  35. ]
  36. if (isProjectOwner) {
  37. return (
  38. <Notification
  39. action={
  40. <StartFreeTrialButton
  41. variant="new-changing"
  42. source="compile-time-warning"
  43. buttonProps={{
  44. className: 'btn-secondary-compile-timeout-override',
  45. }}
  46. >
  47. {t('start_free_trial_without_exclamation')}
  48. </StartFreeTrialButton>
  49. }
  50. ariaLive="polite"
  51. content={
  52. <div>
  53. <p>
  54. <Trans
  55. i18nKey="compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile"
  56. components={compileTimeoutBlogLinks}
  57. values={{ date: 'October 27 2023' }}
  58. shouldUnescape
  59. tOptions={{ interpolation: { escapeValue: true } }}
  60. />{' '}
  61. <Trans
  62. i18nKey="and_you_can_upgrade_for_plenty_more_compile_time"
  63. components={{ strong: <strong /> }}
  64. />
  65. </p>
  66. </div>
  67. }
  68. title={t('your_project_compiled_but_soon_might_not')}
  69. type="warning"
  70. isActionBelowContent
  71. isDismissible
  72. onDismiss={handleDismissChangingSoon}
  73. />
  74. )
  75. }
  76. return (
  77. <Notification
  78. ariaLive="polite"
  79. content={
  80. <div>
  81. <p>
  82. <Trans
  83. i18nKey="compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile"
  84. components={compileTimeoutBlogLinks}
  85. values={{ date: 'October 27 2023' }}
  86. shouldUnescape
  87. tOptions={{ interpolation: { escapeValue: true } }}
  88. />
  89. </p>
  90. <p className="row-spaced">
  91. <Trans
  92. i18nKey="tell_the_project_owner_to_upgrade_plan_for_more_compile_time"
  93. components={{ strong: <strong /> }}
  94. />
  95. </p>
  96. </div>
  97. }
  98. title={t('this_project_compiled_but_soon_might_not')}
  99. type="warning"
  100. isDismissible
  101. onDismiss={handleDismissChangingSoon}
  102. />
  103. )
  104. }