Lint, make save button not clickable when quarterly is selected

This commit is contained in:
Prospector 2025-06-03 10:37:29 -07:00
parent 4441be5380
commit a4ba41bf15
6 changed files with 26 additions and 20 deletions

View File

@ -520,19 +520,15 @@
</OptionGroup>
<template v-if="billingPeriods.includes('quarterly')">
<button
v-if="billingPeriod !== 'quarterly'"
class="bg-transparent p-0 text-sm font-medium text-brand hover:underline active:scale-95"
@click="billingPeriod = 'quarterly'"
>
Save 16% with quarterly billing!
</button>
</template>
<template v-else-if="billingPeriods.includes('yearly')">
<button
class="bg-transparent p-0 text-sm font-medium text-brand hover:underline active:scale-95"
@click="billingPeriod = 'yearly'"
>
Save 16% with yearly billing!
</button>
<span v-else class="bg-transparent p-0 text-sm font-medium text-brand">
Save 16% with quarterly billing!
</span>
</template>
<span v-else></span>
</div>

View File

@ -309,7 +309,15 @@ defineExpose({
</button>
</ButtonStyled>
<ButtonStyled color="brand">
<button v-tooltip="currentStep === 'review' && !acceptedEula ? 'You must accept the Minecraft EULA to proceed.' : undefined" :disabled="!canProceed" @click="setStep(nextStep)">
<button
v-tooltip="
currentStep === 'review' && !acceptedEula
? 'You must accept the Minecraft EULA to proceed.'
: undefined
"
:disabled="!canProceed"
@click="setStep(nextStep)"
>
<template v-if="currentStep === 'review'">
<SpinnerIcon v-if="completingPurchase" class="animate-spin" />
<CheckCircleIcon v-else />

View File

@ -217,7 +217,14 @@
v-if="interval === 'yearly' || interval === 'quarterly'"
class="rounded-full bg-brand px-2 py-1 font-bold text-brand-inverted"
>
SAVE {{ calculateSavings(price.prices.intervals.monthly, rawPrice, interval === 'quarterly' ? 3 : 12) }}%
SAVE
{{
calculateSavings(
price.prices.intervals.monthly,
rawPrice,
interval === 'quarterly' ? 3 : 12,
)
}}%
</span>
<span class="ml-auto text-lg" :class="{ 'text-secondary': selectedPlan !== interval }">
{{ formatPrice(locale, rawPrice, price.currency_code) }}

View File

@ -1,6 +1,5 @@
<script setup lang="ts">
import type Stripe from 'stripe'
import ModalLoadingIndicator from '../modal/ModalLoadingIndicator.vue'
import { useVIntl, defineMessages } from '@vintl/vintl'
import PaymentMethodOption from './PaymentMethodOption.vue'

View File

@ -177,13 +177,13 @@ function setInterval(newInterval: ServerBillingInterval) {
<RadioButtonIcon v-else class="size-6 text-secondary" />
<div class="flex flex-col items-start gap-1 font-medium text-primary">
<span class="flex items-center gap-1" :class="{ 'text-contrast': interval === 'quarterly' }"
>Pay quarterly
>Pay quarterly
<span class="text-xs font-bold text-brand px-1.5 py-0.5 rounded-full bg-brand-highlight"
>{{ interval === 'quarterly' ? 'Saving' : 'Save' }} 16%</span
>{{ interval === 'quarterly' ? 'Saving' : 'Save' }} 16%</span
></span
>
<span class="text-sm text-secondary flex items-center gap-1"
>{{
>{{
formatPrice(
locale,
prices?.prices?.intervals?.['quarterly'] ?? 0 / monthsInInterval['quarterly'],

View File

@ -1,9 +1,5 @@
import type Stripe from 'stripe'
import {
type Stripe as StripeJs,
loadStripe,
type StripeElements,
} from '@stripe/stripe-js'
import { type Stripe as StripeJs, loadStripe, type StripeElements } from '@stripe/stripe-js'
import { computed, ref, type Ref } from 'vue'
import type { ContactOption } from '@stripe/stripe-js/dist/stripe-js/elements/address'
import type {
@ -391,6 +387,6 @@ export const useStripe = (
tax,
total,
submitPayment,
completingPurchase
completingPurchase,
}
}