fix cancelled subscription state for plan selector

This commit is contained in:
Abhinav 2022-08-23 19:55:51 +05:30
parent f66fa83376
commit d58ff9cf78
2 changed files with 12 additions and 5 deletions

View file

@ -4,7 +4,7 @@ import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { SpaceBetweenFlex } from 'components/Container'; import { SpaceBetweenFlex } from 'components/Container';
import React from 'react'; import React from 'react';
import { convertBytesToGBs } from 'utils/billing'; import { convertBytesToGBs, isSubscriptionCancelled } from 'utils/billing';
import constants from 'utils/strings/constants'; import constants from 'utils/strings/constants';
import { ManageSubscription } from '../manageSubscription'; import { ManageSubscription } from '../manageSubscription';
import { PeriodToggler } from '../periodToggler'; import { PeriodToggler } from '../periodToggler';
@ -76,7 +76,11 @@ export default function PaidSubscriptionPlanSelectorCard({
<Box py={1} px={1.5}> <Box py={1} px={1.5}>
<Typography color={'text.secondary'}> <Typography color={'text.secondary'}>
{constants.RENEWAL_ACTIVE_SUBSCRIPTION_INFO( {!isSubscriptionCancelled(subscription)
? constants.RENEWAL_ACTIVE_SUBSCRIPTION_STATUS(
subscription.expiryTime
)
: constants.RENEWAL_CANCELLED_SUBSCRIPTION_STATUS(
subscription.expiryTime subscription.expiryTime
)} )}
</Typography> </Typography>

View file

@ -270,9 +270,12 @@ const englishConstants = {
FAMILY_SUBSCRIPTION_INFO: 'You are on a family plan managed by', FAMILY_SUBSCRIPTION_INFO: 'You are on a family plan managed by',
RENEWAL_ACTIVE_SUBSCRIPTION_INFO: (expiryTime) => ( RENEWAL_ACTIVE_SUBSCRIPTION_STATUS: (expiryTime) => (
<>Renews on {dateString(expiryTime)}</> <>Renews on {dateString(expiryTime)}</>
), ),
RENEWAL_CANCELLED_SUBSCRIPTION_STATUS: (expiryTime) => (
<>Ends on {dateString(expiryTime)}</>
),
RENEWAL_CANCELLED_SUBSCRIPTION_INFO: (expiryTime) => ( RENEWAL_CANCELLED_SUBSCRIPTION_INFO: (expiryTime) => (
<>Your subscription will be cancelled on {dateString(expiryTime)}</> <>Your subscription will be cancelled on {dateString(expiryTime)}</>