Просмотр исходного кода

Move premium features link outside the subscription block

GitOrigin-RevId: b88d765d859f1bdf1eb1d469131c8f239f327562
Thomas Mees 3 лет назад
Родитель
Сommit
1cde138160

+ 0 - 4
services/web/frontend/js/features/subscription/components/dashboard/group-subscription-membership.tsx

@@ -3,17 +3,14 @@ import { Trans, useTranslation } from 'react-i18next'
 import { MemberGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
 import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
 import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal'
-import PremiumFeaturesLink from './premium-features-link'
 import getMeta from '../../../../utils/meta.js'
 
 type GroupSubscriptionMembershipProps = {
   subscription: MemberGroupSubscription
-  isLast: boolean
 }
 
 export default function GroupSubscriptionMembership({
   subscription,
-  isLast,
 }: GroupSubscriptionMembershipProps) {
   const { t } = useTranslation()
   const { handleOpenModal, setLeavingGroupId } =
@@ -48,7 +45,6 @@ export default function GroupSubscriptionMembership({
           <em>{subscription.teamNotice}</em>
         </p>
       )}
-      {isLast && <PremiumFeaturesLink />}
       {hideLeaveButton ? (
         <span>
           {' '}

+ 1 - 2
services/web/frontend/js/features/subscription/components/dashboard/group-subscription-memberships.tsx

@@ -17,10 +17,9 @@ export default function GroupSubscriptionMemberships() {
   return (
     <>
       {memberOnlyGroupSubscriptions.map(
-        (subscription: MemberGroupSubscription, index: number) => (
+        (subscription: MemberGroupSubscription) => (
           <GroupSubscriptionMembership
             subscription={subscription}
-            isLast={index === memberOnlyGroupSubscriptions.length - 1}
             key={subscription._id}
           />
         )

+ 0 - 2
services/web/frontend/js/features/subscription/components/dashboard/institution-memberships.tsx

@@ -1,7 +1,6 @@
 import { Trans } from 'react-i18next'
 import { Institution } from '../../../../../../types/institution'
 import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
-import PremiumFeaturesLink from './premium-features-link'
 
 function InstitutionMemberships() {
   const { institutionMemberships } = useSubscriptionDashboardContext()
@@ -44,7 +43,6 @@ function InstitutionMemberships() {
           <hr />
         </div>
       ))}
-      <PremiumFeaturesLink />
     </div>
   )
 }

+ 0 - 2
services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx

@@ -1,5 +1,4 @@
 import { useTranslation, Trans } from 'react-i18next'
-import PremiumFeaturesLink from '../../premium-features-link'
 import { PriceExceptions } from '../../../shared/price-exceptions'
 import { useSubscriptionDashboardContext } from '../../../../context/subscription-dashboard-context'
 import { RecurlySubscription } from '../../../../../../../../types/subscription/dashboard/subscription'
@@ -98,7 +97,6 @@ export function ActiveSubscription({
           ]}
         />
       </p>
-      <PremiumFeaturesLink />
       <PriceExceptions subscription={subscription} />
       <p>
         <a

+ 0 - 2
services/web/frontend/js/features/subscription/components/dashboard/states/canceled.tsx

@@ -1,6 +1,5 @@
 import { useTranslation, Trans } from 'react-i18next'
 import { RecurlySubscription } from '../../../../../../../types/subscription/dashboard/subscription'
-import PremiumFeaturesLink from '../premium-features-link'
 import ReactivateSubscription from '../reactivate-subscription'
 
 export function CanceledSubscription({
@@ -36,7 +35,6 @@ export function CanceledSubscription({
           ]}
         />
       </p>
-      <PremiumFeaturesLink />
       <p>
         <a
           href={subscription.recurly.accountManagementLink}

+ 2 - 0
services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx

@@ -9,6 +9,7 @@ import ManagedGroupSubscriptions from './managed-group-subscriptions'
 import ManagedInstitutions from './managed-institutions'
 import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
 import getMeta from '../../../../utils/meta'
+import PremiumFeaturesLink from './premium-features-link'
 
 function SubscriptionDashboard() {
   const { t } = useTranslation()
@@ -37,6 +38,7 @@ function SubscriptionDashboard() {
             <ManagedPublishers />
             <GroupSubscriptionMemberships />
             <InstitutionMemberships />
+            {hasDisplayedSubscription && <PremiumFeaturesLink />}
             {!hasDisplayedSubscription &&
               (hasSubscription ? <ContactSupport /> : <FreePlan />)}
           </div>

+ 0 - 11
services/web/test/frontend/features/subscription/components/dashboard/institution-memberships.test.tsx

@@ -59,15 +59,4 @@ describe('<InstitutionMemberships />', function () {
       'Sorry, something went wrong. Subscription information related to institutional affiliations may not be displayed. Please try again later.'
     )
   })
-
-  it('renders the "Get the most out of your" subscription text when a user has a subscription', function () {
-    renderWithSubscriptionDashContext(<InstitutionMemberships />, {
-      metaTags: [
-        { name: 'ol-currentInstitutionsWithLicence', value: memberships },
-      ],
-    })
-    screen.getByText('Get the most out of your', {
-      exact: false,
-    })
-  })
 })

+ 0 - 5
services/web/test/frontend/features/subscription/components/dashboard/personal-subscription.test.tsx

@@ -86,11 +86,6 @@ describe('<PersonalSubscription />', function () {
 
       screen.getByText('No further payments will be taken.', { exact: false })
 
-      screen.getByText(
-        'Get the most out of your Overleaf subscription by checking out the list of',
-        { exact: false }
-      )
-
       screen.getByRole('link', { name: 'View Your Invoices' })
       screen.getByRole('button', { name: 'Reactivate your subscription' })
     })

+ 0 - 6
services/web/test/frontend/features/subscription/components/dashboard/states/active/active.test.tsx

@@ -53,12 +53,6 @@ describe('<ActiveSubscription />', function () {
     })
     expect(dates.length).to.equal(2)
 
-    // sentence broken up by link
-    screen.getByText(
-      'Get the most out of your Overleaf subscription by checking out the list of',
-      { exact: false }
-    )
-
     screen.getByText(
       '* Prices may be subject to additional VAT, depending on your country.'
     )

+ 28 - 0
services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx

@@ -5,12 +5,40 @@ import {
   cleanUpContext,
   renderWithSubscriptionDashContext,
 } from '../../helpers/render-with-subscription-dash-context'
+import { groupPlans, plans } from '../../fixtures/plans'
+import { annualActiveSubscription } from '../../fixtures/subscriptions'
 
 describe('<SubscriptionDashboard />', function () {
   afterEach(function () {
     cleanUpContext()
   })
 
+  describe('With an active subscription', function () {
+    beforeEach(function () {
+      renderWithSubscriptionDashContext(<SubscriptionDashboard />, {
+        metaTags: [
+          { name: 'ol-plans', value: plans },
+          {
+            name: 'ol-groupPlans',
+            value: groupPlans,
+          },
+          { name: 'ol-subscription', value: annualActiveSubscription },
+          {
+            name: 'ol-recommendedCurrency',
+            value: 'USD',
+          },
+        ],
+      })
+    })
+
+    it('renders the "Get the most out of your" subscription text', function () {
+      screen.getByText(
+        'Get the most out of your Overleaf subscription by checking out the list of',
+        { exact: false }
+      )
+    })
+  })
+
   describe('Free Plan', function () {
     beforeEach(function () {
       renderWithSubscriptionDashContext(<SubscriptionDashboard />)