premium-features-link.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Trans } from 'react-i18next'
  2. import { Subscription } from '../../../../../../types/subscription/dashboard/subscription'
  3. import { AI_ADD_ON_CODE, isStandaloneAiPlanCode } from '../../data/add-on-codes'
  4. function PremiumFeaturesLink({
  5. subscription,
  6. }: {
  7. subscription?: Subscription
  8. }) {
  9. const hasAiAddon = subscription?.addOns?.some(
  10. addOn => addOn.addOnCode === AI_ADD_ON_CODE
  11. )
  12. const onAiStandalonePlan = isStandaloneAiPlanCode(subscription?.planCode)
  13. if (onAiStandalonePlan) {
  14. return (
  15. <p>
  16. <Trans
  17. i18nKey="get_most_subscription_by_checking_ai_writefull"
  18. components={[
  19. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  20. <a href="/learn/latex/Error_Assist" />,
  21. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  22. <a
  23. href="https://help.writefull.com/writefull-for-overleaf--user-guide"
  24. target="_blank"
  25. rel="noopener"
  26. />,
  27. ]}
  28. />
  29. </p>
  30. )
  31. }
  32. if (hasAiAddon) {
  33. return (
  34. <p>
  35. <Trans
  36. i18nKey="get_most_subscription_by_checking_overleaf_ai_writefull"
  37. components={[
  38. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  39. <a href="/learn/how-to/Overleaf_premium_features" />,
  40. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  41. <a href="/learn/latex/Error_Assist" />,
  42. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  43. <a
  44. href="https://help.writefull.com/writefull-for-overleaf--user-guide"
  45. target="_blank"
  46. rel="noopener"
  47. />,
  48. ]}
  49. />
  50. </p>
  51. )
  52. }
  53. return (
  54. <p>
  55. <Trans
  56. i18nKey="get_most_subscription_by_checking_overleaf"
  57. components={[
  58. // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
  59. <a href="/learn/how-to/Overleaf_premium_features" />,
  60. ]}
  61. />
  62. </p>
  63. )
  64. }
  65. export default PremiumFeaturesLink