Feat: Fix unused seat count (#4375)

This commit is contained in:
Mike
2025-04-11 13:27:00 +02:00
committed by GitHub
parent acaafb1525
commit 37cdd4ba21
2 changed files with 19 additions and 17 deletions
@@ -39,20 +39,19 @@
:has-available-seat="hasAvailableEditorSeats"
:seat-price="editorSeatPriceFormatted"
/>
<p
v-if="needsEditorUpgrade && !hasAvailableEditorSeats"
class="text-foreground-2 text-body-xs mt-4"
>
You have an unused Editor seat that is already paid for, so the change will
not incur any charges.
</p>
<p
v-if="needsEditorUpgrade && !hasAvailableEditorSeats && !isUnlimitedPlan"
class="text-foreground-2 text-body-xs mt-4"
>
Note that the Editor seat is a paid seat type and this change will incur
additional charges to your subscription.
</p>
<template v-if="needsEditorUpgrade && !isFreePlan && !isUnlimitedPlan">
<p
v-if="hasAvailableEditorSeats"
class="text-foreground-2 text-body-xs mt-4"
>
You have an unused Editor seat that is already paid for, so the change
will not incur any charges.
</p>
<p v-else class="text-foreground-2 text-body-xs mt-4">
Note that the Editor seat is a paid seat type and this change will incur
additional charges to your subscription.
</p>
</template>
</CommonCard>
</template>
@@ -93,9 +93,12 @@ export const useWorkspacePlan = (slug: string) => {
// Seat information
const seats = computed(() => subscription.value?.seats)
const hasAvailableEditorSeats = computed(() =>
seats.value?.editors.available && seats.value?.editors.available > 0 ? true : false
)
const hasAvailableEditorSeats = computed(() => {
if (seats.value?.editors.available && seats.value?.editors.assigned) {
return seats.value?.editors.available - seats.value?.editors.assigned > 0
}
return false
})
const editorSeatPriceFormatted = computed(() => {
if (
plan.value?.name === WorkspacePlans.Team ||