overleaf/services/web/frontend/js/features/pdf-preview/components/compile-time-warning-upgrade-prompt-inner.tsx
Antoine Clausse 6a6f155029 [web] Use React hooks to get split-test variants instead of getSplitTestVariant (getMeta) (#18133)
* Fix split-tests loading in React component: use `useSplitTestContext` instead of `getSplitTestVariant`

* Replace use of `isSplitTestEnabled` by `useSplitTestContext`

* Add SplitTestProvider to roots, and fix tests

* Create `useFeatureFlag` hook

* Use `useFeatureFlag` where applicable

GitOrigin-RevId: 9ff7bb3975d50bc4d07d74d93c482d56dc96f615
2024-05-01 08:04:55 +00:00

46 lines
1.3 KiB
TypeScript

import Notification from '@/shared/components/notification'
import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
import { useTranslation } from 'react-i18next'
import { FC } from 'react'
import { useFeatureFlag } from '@/shared/context/split-test-context'
export const CompileTimeWarningUpgradePromptInner: FC<{
handleDismissWarning: () => void
}> = ({ handleDismissWarning }) => {
const { t } = useTranslation()
const hasNewPaywallCta = useFeatureFlag('paywall-cta')
return (
<Notification
action={
<StartFreeTrialButton
variant="new-10s"
source="compile-time-warning"
buttonProps={{
className: 'btn-secondary-compile-timeout-override',
}}
>
{hasNewPaywallCta
? t('get_more_compile_time')
: t('start_free_trial_without_exclamation')}
</StartFreeTrialButton>
}
ariaLive="polite"
content={
<div>
<div>
<span>{t('your_project_near_compile_timeout_limit')}</span>
</div>
<strong>{t('upgrade_for_12x_more_compile_time')}</strong>
{'. '}
</div>
}
type="warning"
title={t('took_a_while')}
isActionBelowContent
isDismissible
onDismiss={handleDismissWarning}
/>
)
}