2023-10-24 08:16:53 -04:00
|
|
|
import Notification from '@/shared/components/notification'
|
|
|
|
import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { FC } from 'react'
|
2024-04-02 10:06:16 -04:00
|
|
|
import { useSplitTestContext } from '@/shared/context/split-test-context'
|
2023-10-24 08:16:53 -04:00
|
|
|
|
|
|
|
export const CompileTimeoutWarning: FC<{
|
|
|
|
handleDismissWarning: () => void
|
2024-01-26 04:23:48 -05:00
|
|
|
showNewCompileTimeoutUI?: string
|
2023-10-24 08:16:53 -04:00
|
|
|
}> = ({ handleDismissWarning, showNewCompileTimeoutUI }) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
2024-04-02 10:06:16 -04:00
|
|
|
const { splitTestVariants } = useSplitTestContext()
|
|
|
|
const hasNewPaywallCta = splitTestVariants['paywall-cta'] === 'enabled'
|
|
|
|
|
2023-10-24 08:16:53 -04:00
|
|
|
return (
|
|
|
|
<Notification
|
|
|
|
action={
|
|
|
|
<StartFreeTrialButton
|
|
|
|
variant="new-10s"
|
|
|
|
source="compile-time-warning"
|
|
|
|
buttonProps={{
|
|
|
|
className: 'btn-secondary-compile-timeout-override',
|
|
|
|
}}
|
|
|
|
>
|
2024-04-02 10:06:16 -04:00
|
|
|
{hasNewPaywallCta
|
|
|
|
? t('get_more_compile_time')
|
|
|
|
: t('start_free_trial_without_exclamation')}
|
2023-10-24 08:16:53 -04:00
|
|
|
</StartFreeTrialButton>
|
|
|
|
}
|
|
|
|
ariaLive="polite"
|
|
|
|
content={
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<span>{t('your_project_near_compile_timeout_limit')}</span>
|
|
|
|
</div>
|
|
|
|
{showNewCompileTimeoutUI === 'active' ? (
|
|
|
|
<>
|
|
|
|
<strong>{t('upgrade_for_12x_more_compile_time')}</strong>
|
|
|
|
{'. '}
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<strong>{t('upgrade_for_plenty_more_compile_time')}</strong>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
type="warning"
|
|
|
|
title={t('took_a_while')}
|
|
|
|
isActionBelowContent
|
|
|
|
isDismissible
|
|
|
|
onDismiss={handleDismissWarning}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|