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

View File

@@ -309,7 +309,15 @@ defineExpose({
</button> </button>
</ButtonStyled> </ButtonStyled>
<ButtonStyled color="brand"> <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'"> <template v-if="currentStep === 'review'">
<SpinnerIcon v-if="completingPurchase" class="animate-spin" /> <SpinnerIcon v-if="completingPurchase" class="animate-spin" />
<CheckCircleIcon v-else /> <CheckCircleIcon v-else />

View File

@@ -217,7 +217,14 @@
v-if="interval === 'yearly' || interval === 'quarterly'" v-if="interval === 'yearly' || interval === 'quarterly'"
class="rounded-full bg-brand px-2 py-1 font-bold text-brand-inverted" 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>
<span class="ml-auto text-lg" :class="{ 'text-secondary': selectedPlan !== interval }"> <span class="ml-auto text-lg" :class="{ 'text-secondary': selectedPlan !== interval }">
{{ formatPrice(locale, rawPrice, price.currency_code) }} {{ formatPrice(locale, rawPrice, price.currency_code) }}

View File

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

View File

@@ -177,13 +177,13 @@ function setInterval(newInterval: ServerBillingInterval) {
<RadioButtonIcon v-else class="size-6 text-secondary" /> <RadioButtonIcon v-else class="size-6 text-secondary" />
<div class="flex flex-col items-start gap-1 font-medium text-primary"> <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' }" <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" <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
> >
<span class="text-sm text-secondary flex items-center gap-1" <span class="text-sm text-secondary flex items-center gap-1"
>{{ >{{
formatPrice( formatPrice(
locale, locale,
prices?.prices?.intervals?.['quarterly'] ?? 0 / monthsInInterval['quarterly'], prices?.prices?.intervals?.['quarterly'] ?? 0 / monthsInInterval['quarterly'],

View File

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