Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Jan 19, 2025
1 parent 30de530 commit e1c29a5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ package-lock.json
Pictures/Thumbs.db
Pictures/Splash/Thumbs.db
Pictures/TransparentPics/Thumbs.db

**/.DS_Store
Binary file removed Pictures/.DS_Store
Binary file not shown.
Binary file removed Pictures/PseudoShop/.DS_Store
Binary file not shown.
19 changes: 14 additions & 5 deletions src/purchases/SubscriptionsSubtab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,26 @@ const formatter = Intl.NumberFormat('en-US', {
})

const tierCosts = [0, 300, 600, 1000, 2000]

async function changeSubscription (productId: string, type: 'upgrade' | 'downgrade') {

const tier = upgradeResponse.tier
const existingCosts = tierCosts[tier] ?? 0
const newSub = subscriptionProducts.find((v) => v.id === productId)
const newSubPrice = newSub!.price
const newSubName = newSub!.name
const confirm = (type === 'downgrade') ?
await Confirm(`You are downgrading to ${newSubName}, which costs ${formatter.format((existingCosts - newSubPrice)/100)} less per month. New cost: ${formatter.format(newSubPrice / 100)} per month. Downgrading takes effect immediately!`) :
await Confirm(`You are upgrading to ${newSubName}, which costs ${formatter.format((newSubPrice - existingCosts)/100)} more per month. New cost: ${formatter.format(newSubPrice / 100)} per month`)
const confirm = (type === 'downgrade')
? await Confirm(
`You are downgrading to ${newSubName}, which costs ${
formatter.format((existingCosts - newSubPrice) / 100)
} less per month. New cost: ${
formatter.format(newSubPrice / 100)
} per month. Downgrading takes effect immediately!`
)
: await Confirm(
`You are upgrading to ${newSubName}, which costs ${
formatter.format((newSubPrice - existingCosts) / 100)
} more per month. New cost: ${formatter.format(newSubPrice / 100)} per month`
)

if (!confirm) {
return
Expand Down

0 comments on commit e1c29a5

Please sign in to comment.