diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..d544ecdbd Binary files /dev/null and b/.DS_Store differ diff --git a/Pictures/.DS_Store b/Pictures/.DS_Store new file mode 100644 index 000000000..75e22d917 Binary files /dev/null and b/Pictures/.DS_Store differ diff --git a/Pictures/PseudoShop/.DS_Store b/Pictures/PseudoShop/.DS_Store new file mode 100644 index 000000000..ed05d502e Binary files /dev/null and b/Pictures/PseudoShop/.DS_Store differ diff --git a/Pictures/PseudoShop/ascended-monthly-sub.png b/Pictures/PseudoShop/ascended-monthly-sub.png new file mode 100644 index 000000000..622eb5356 Binary files /dev/null and b/Pictures/PseudoShop/ascended-monthly-sub.png differ diff --git a/Pictures/PseudoShop/omega-monthly-sub.png b/Pictures/PseudoShop/omega-monthly-sub.png new file mode 100644 index 000000000..0183e0944 Binary files /dev/null and b/Pictures/PseudoShop/omega-monthly-sub.png differ diff --git a/Pictures/PseudoShop/reincarnated-monthly-sub.png b/Pictures/PseudoShop/reincarnated-monthly-sub.png new file mode 100644 index 000000000..3beceeaef Binary files /dev/null and b/Pictures/PseudoShop/reincarnated-monthly-sub.png differ diff --git a/Pictures/PseudoShop/transcended-monthly-sub.png b/Pictures/PseudoShop/transcended-monthly-sub.png new file mode 100644 index 000000000..cfb08e817 Binary files /dev/null and b/Pictures/PseudoShop/transcended-monthly-sub.png differ diff --git a/Pictures/ascended-monthly-sub.png b/Pictures/ascended-monthly-sub.png new file mode 100644 index 000000000..622eb5356 Binary files /dev/null and b/Pictures/ascended-monthly-sub.png differ diff --git a/Pictures/omega-monthly-sub.png b/Pictures/omega-monthly-sub.png new file mode 100644 index 000000000..0183e0944 Binary files /dev/null and b/Pictures/omega-monthly-sub.png differ diff --git a/Pictures/reincarnated-monthly-sub.png b/Pictures/reincarnated-monthly-sub.png new file mode 100644 index 000000000..3beceeaef Binary files /dev/null and b/Pictures/reincarnated-monthly-sub.png differ diff --git a/Pictures/transcended-monthly-sub.png b/Pictures/transcended-monthly-sub.png new file mode 100644 index 000000000..cfb08e817 Binary files /dev/null and b/Pictures/transcended-monthly-sub.png differ diff --git a/Synergism.css b/Synergism.css index afd39c05d..e018a391a 100644 --- a/Synergism.css +++ b/Synergism.css @@ -4037,6 +4037,11 @@ form input:hover { margin-top: 8px; } +.pseudoCoinSubImage { + height: 48px; + width: 48px; +} + .pseudoCoinText { width: 90%; height: 80px; diff --git a/src/purchases/SubscriptionsSubtab.ts b/src/purchases/SubscriptionsSubtab.ts index ba9ad7062..74ab50c8f 100644 --- a/src/purchases/SubscriptionsSubtab.ts +++ b/src/purchases/SubscriptionsSubtab.ts @@ -13,9 +13,17 @@ const formatter = Intl.NumberFormat('en-US', { }) const tierCosts = [0, 300, 600, 1000, 2000] - + async function changeSubscription (productId: string, type: 'upgrade' | 'downgrade') { - const confirm = await Confirm('confirm message here') + + 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`) if (!confirm) { return @@ -30,9 +38,8 @@ async function changeSubscription (productId: string, type: 'upgrade' | 'downgra const response = await fetch(url, { method: 'POST' }) - - // TODO: something - console.log(response, await response.text()) + console.log(response, response.text()) + return Alert(`You are now subscribed to ${newSubName}!`) } function clickHandler (this: HTMLButtonElement, e: HTMLElementEventMap['click']) { @@ -76,7 +83,7 @@ export const createIndividualSubscriptionHTML = (product: Product, existingCosts return `
- ${product.name} + ${product.name}

${product.name.split(' - ').join('
')}

@@ -93,7 +100,7 @@ export const createIndividualSubscriptionHTML = (product: Product, existingCosts return `
- ${product.name} + ${product.name}

${product.name.split(' - ').join('
')}

@@ -110,7 +117,7 @@ export const createIndividualSubscriptionHTML = (product: Product, existingCosts return `
- ${product.name} + ${product.name}

${product.name.split(' - ').join('
')}