Move premium features link outside the subscription block

GitOrigin-RevId: b88d765d859f1bdf1eb1d469131c8f239f327562
This commit is contained in:
Thomas Mees 2023-07-21 17:35:52 +02:00 committed by Copybot
parent 64159d7e5c
commit 1cde138160
10 changed files with 31 additions and 34 deletions

View file

@ -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>
{' '}

View file

@ -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}
/>
)

View file

@ -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>
)
}

View file

@ -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

View file

@ -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}

View file

@ -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>

View file

@ -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,
})
})
})

View file

@ -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' })
})

View file

@ -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.'
)

View file

@ -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 />)