Skip to content

Commit

Permalink
fix: hide cancel button for inplayer configs
Browse files Browse the repository at this point in the history
  • Loading branch information
naumovski-filip committed Jul 6, 2023
1 parent c52b13e commit 8f71448
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/components/Payment/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const Payment = ({
{activeSubscription.status === 'active' && !isGrantedSubscription && !pendingDowngradeOfferId
? t('user:payment.next_billing_date_on', { date: formatLocalizedDate(new Date(activeSubscription.expiresAt * 1000), i18n.language) })
: t('user:payment.subscription_expires_on', { date: formatLocalizedDate(new Date(activeSubscription.expiresAt * 1000), i18n.language) })}
{(pendingOffer || pendingDowngradeOfferId) && (
{(pendingOffer || pendingDowngradeOfferId) && activeSubscription.status !== 'cancelled' && (
<span className={styles.pendingSwitch}>
{t('user:payment.pending_offer_switch', {
title: getTitle(pendingOffer?.period || offers.find((offer) => offer.offerId === pendingDowngradeOfferId)?.period || 'month'),
Expand All @@ -218,7 +218,7 @@ const Payment = ({
className={styles.upgradeSubscription}
label={t('user:payment.change_subscription')}
onClick={() => {
if (offers.length > 1) {
if (offers.length > 1 && !canRenewSubscription) {
setIsChangingOffer(true);
} else {
onUpgradeSubscriptionClick?.();
Expand All @@ -229,7 +229,10 @@ const Payment = ({
data-testid="change-subscription-button"
/>
)}
{activeSubscription.status === 'active' && !isGrantedSubscription && !isChangingOffer ? (
{(activeSubscription.status === 'active' || activeSubscription.status === 'active_trial') &&
!isGrantedSubscription &&
!isChangingOffer &&
canRenewSubscription ? (
<Button label={t('user:payment.cancel_subscription')} onClick={onCancelSubscriptionClick} fullWidth={isMobile} />
) : canRenewSubscription ? (
<Button label={t('user:payment.renew_subscription')} onClick={onRenewSubscriptionClick} />
Expand Down
7 changes: 0 additions & 7 deletions src/pages/User/__snapshots__/User.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,6 @@ exports[`User Component tests > Payments Page 1`] = `
</small>
</p>
</div>
<button
class="_button_f8f296 _default_f8f296 _outlined_f8f296"
>
<span>
user:payment.cancel_subscription
</span>
</button>
</div>
<div
class="_panel_e9c5ca"
Expand Down

0 comments on commit 8f71448

Please sign in to comment.