fix(core): payment UI fix (#4839)

This commit is contained in:
Cats Juice
2023-11-06 10:40:52 +08:00
committed by GitHub
parent 7e381e830a
commit 3c4dbed16b
4 changed files with 42 additions and 3 deletions

View File

@@ -163,6 +163,7 @@ const Settings = () => {
onNotify={({ detail, recurring }) => {
pushNotification({
type: 'success',
theme: 'default',
title: t['com.affine.payment.updated-notify-title'](),
message:
detail.plan === SubscriptionPlan.Free

View File

@@ -6,6 +6,7 @@ import {
checkoutMutation,
SubscriptionPlan,
SubscriptionRecurring,
SubscriptionStatus,
updateSubscriptionMutation,
} from '@affine/graphql';
import { Trans } from '@affine/i18n';
@@ -243,7 +244,10 @@ const ActionButton = ({
const isFree = detail.plan === SubscriptionPlan.Free;
const isCurrent =
detail.plan === currentPlan &&
(isFree ? true : currentRecurring === recurring);
(isFree
? true
: currentRecurring === recurring &&
subscription?.status === SubscriptionStatus.Active);
// is current
if (isCurrent) {
@@ -455,7 +459,11 @@ const ChangeRecurring = ({
You are changing your <span className={styles.textEmphasis}>{from}</span>{' '}
subscription to <span className={styles.textEmphasis}>{to}</span>{' '}
subscription. This change will take effect in the next billing cycle, with
an effective date of <span className={styles.textEmphasis}>{due}</span>.
an effective date of{' '}
<span className={styles.textEmphasis}>
{new Date(due).toLocaleDateString()}
</span>
.
</Trans>
);