footer.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import styled from '@emotion/styled';
  2. import {Button} from 'sentry/components/button';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import type {Organization} from 'sentry/types/organization';
  6. import UpgradeOrTrialButton from 'getsentry/components/upgradeOrTrialButton';
  7. import type {Subscription} from 'getsentry/types';
  8. import {getFriendlyPlanName} from 'getsentry/utils/billing';
  9. import trackGetsentryAnalytics from 'getsentry/utils/trackGetsentryAnalytics';
  10. interface UpsellFooterProps {
  11. onCloseModal: () => void;
  12. organization: Organization;
  13. subscription: Subscription;
  14. showTrialResetContent?: boolean;
  15. source?: string;
  16. }
  17. function Footer({
  18. subscription,
  19. organization,
  20. source,
  21. onCloseModal,
  22. showTrialResetContent,
  23. }: UpsellFooterProps) {
  24. const buttonProps = {
  25. subscription,
  26. organization,
  27. source: 'business-landing.' + (source || 'unknown'),
  28. onSuccess: onCloseModal,
  29. };
  30. const canTrial = subscription.canTrial && !subscription.isTrial;
  31. return (
  32. <FooterWrapper>
  33. <UpgradeOrTrialButton data-test-id="upgrade-or-trial" {...buttonProps} />
  34. {/* if the trial was reset, just show them a maybe later button */}
  35. {canTrial && !showTrialResetContent ? (
  36. <UpgradeOrTrialButton
  37. data-test-id="upgrade-plan"
  38. priority="default"
  39. action="upgrade"
  40. {...buttonProps}
  41. />
  42. ) : (
  43. <Button data-test-id="maybe-later" priority="default" onClick={onCloseModal}>
  44. {t('Maybe Later')}
  45. </Button>
  46. )}
  47. <SidebarFooter>
  48. <h1>{t('Current Plan')}</h1>
  49. <h2>{getFriendlyPlanName(subscription)}</h2>
  50. <a
  51. href="https://sentry.io/pricing"
  52. target="_blank"
  53. rel="noopener noreferrer"
  54. onClick={() => {
  55. trackGetsentryAnalytics('business_landing.clicked_compare', {
  56. subscription,
  57. organization,
  58. source,
  59. });
  60. }}
  61. >
  62. {t('Learn more and compare plans')}
  63. </a>
  64. </SidebarFooter>
  65. </FooterWrapper>
  66. );
  67. }
  68. const FooterWrapper = styled('div')`
  69. display: flex;
  70. gap: ${space(1)};
  71. align-items: flex-end;
  72. `;
  73. export const SidebarFooter = styled('div')`
  74. margin-left: auto;
  75. font-size: ${p => p.theme.fontSizeMedium};
  76. white-space: nowrap;
  77. color: ${p => p.theme.subText};
  78. h1 {
  79. text-transform: uppercase;
  80. font-weight: bold;
  81. font-size: ${p => p.theme.fontSizeSmall};
  82. margin-bottom: 0.5rem;
  83. }
  84. h2 {
  85. font-size: ${p => p.theme.fontSizeLarge};
  86. font-weight: normal;
  87. margin-bottom: 0.5rem;
  88. }
  89. `;
  90. export default Footer;