Skip to content

Commit

Permalink
squash: Subscription Cancellation rebase with Customer model
Browse files Browse the repository at this point in the history
  • Loading branch information
birkjernstrom committed Dec 17, 2024
1 parent 64ef814 commit 715a2f7
Show file tree
Hide file tree
Showing 27 changed files with 1,782 additions and 257 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 715a2f7

Please sign in to comment.