Skip to content

Commit

Permalink
squash: Subscription Cancellation, Upgrade & Downgrade rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
birkjernstrom committed Jan 2, 2025
1 parent 3763693 commit cf7f726
Show file tree
Hide file tree
Showing 37 changed files with 3,994 additions and 1,944 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ const SubscriptionItem = ({
return null
}

let nextEventTitle = null
let nextEventDate = null
if (!subscription.ended_at) {
if (subscription.ends_at) {
nextEventTitle = 'Expiry Date'
nextEventDate = new Date(subscription.ends_at)
} else if (subscription.current_period_end) {
nextEventTitle = 'Renewal Date'
nextEventDate = new Date(subscription.current_period_end)
}
}

return (
<ShadowBox className="flex w-full flex-col gap-y-6">
<div className="flex flex-row items-start justify-between">
Expand Down Expand Up @@ -183,15 +195,13 @@ const SubscriptionItem = ({
</span>
</div>
)}
{!subscription.ended_at && subscription.current_period_end && (
{nextEventTitle && nextEventDate && (
<div className="flex flex-row items-center justify-between">
<span className="dark:text-polar-500 text-gray-500">
{subscription.cancel_at_period_end
? 'Expiry Date'
: 'Renewal Date'}
{nextEventTitle}
</span>
<span>
{new Date(subscription.current_period_end).toLocaleDateString(
{nextEventDate.toLocaleDateString(
'en-US',
{
year: 'numeric',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ const ClientPage = ({
)
}


export default ClientPage
Loading

0 comments on commit cf7f726

Please sign in to comment.