fix: better subscription state text
This commit is contained in:
@@ -15,22 +15,53 @@ const StatusText = observer(({ subscriptionState }: Props) => {
|
|||||||
const { userSubscription, userSubscriptionName } = subscriptionState;
|
const { userSubscription, userSubscriptionName } = subscriptionState;
|
||||||
const expirationDate = new Date(
|
const expirationDate = new Date(
|
||||||
convertTimestampToMilliseconds(userSubscription!.endsAt)
|
convertTimestampToMilliseconds(userSubscription!.endsAt)
|
||||||
).toLocaleString();
|
);
|
||||||
|
const expirationDateString = expirationDate.toLocaleString();
|
||||||
|
const expired = expirationDate.getTime() < new Date().getTime();
|
||||||
|
const canceled = userSubscription!.cancelled;
|
||||||
|
|
||||||
return userSubscription!.cancelled ? (
|
if (canceled) {
|
||||||
<Text className="mt-1">
|
return (
|
||||||
Your{' '}
|
<Text className="mt-1">
|
||||||
<span className="font-bold">
|
Your{' '}
|
||||||
Standard Notes{userSubscriptionName ? ' ' : ''}
|
<span className="font-bold">
|
||||||
{userSubscriptionName}
|
Standard Notes{userSubscriptionName ? ' ' : ''}
|
||||||
</span>{' '}
|
{userSubscriptionName}
|
||||||
subscription has been{' '}
|
</span>{' '}
|
||||||
<span className="font-bold">
|
subscription has been canceled
|
||||||
canceled but will remain valid until {expirationDate}
|
{' '}
|
||||||
</span>
|
{expired ? (
|
||||||
. You may resubscribe below if you wish.
|
<span className="font-bold">
|
||||||
</Text>
|
and expired on {expirationDateString}
|
||||||
) : (
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="font-bold">
|
||||||
|
but will remain valid until {expirationDateString}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
. You may resubscribe below if you wish.
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expired) {
|
||||||
|
return (
|
||||||
|
<Text className="mt-1">
|
||||||
|
Your{' '}
|
||||||
|
<span className="font-bold">
|
||||||
|
Standard Notes{userSubscriptionName ? ' ' : ''}
|
||||||
|
{userSubscriptionName}
|
||||||
|
</span>{' '}
|
||||||
|
subscription {' '}
|
||||||
|
<span className="font-bold">
|
||||||
|
expired on {expirationDateString}
|
||||||
|
</span>
|
||||||
|
. You may resubscribe below if you wish.
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<Text className="mt-1">
|
<Text className="mt-1">
|
||||||
Your{' '}
|
Your{' '}
|
||||||
<span className="font-bold">
|
<span className="font-bold">
|
||||||
@@ -38,7 +69,7 @@ const StatusText = observer(({ subscriptionState }: Props) => {
|
|||||||
{userSubscriptionName}
|
{userSubscriptionName}
|
||||||
</span>{' '}
|
</span>{' '}
|
||||||
subscription will be{' '}
|
subscription will be{' '}
|
||||||
<span className="font-bold">renewed on {expirationDate}</span>.
|
<span className="font-bold">renewed on {expirationDateString}</span>.
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user