Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Improve information in upgrade modal #3655

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
>
<div class="text-body-xs text-foreground">
<p>You are about to upgrade your workspace to the following plan:</p>
<CommonCard class="font-medium bg-foundation !p-3 my-2">
Workspace {{ startCase(plan) }} plan,
{{ billingInterval === BillingInterval.Yearly ? 'annual' : 'monthly' }}
<CommonCard class="bg-foundation !p-3 my-2">
<p class="font-medium">Workspace {{ startCase(plan) }} plan</p>
<p>
£{{ seatPrice }}/seat/month, billed
{{ billingInterval === BillingInterval.Yearly ? 'annually' : 'monthly' }}
</p>
</CommonCard>
<p>Do you want to proceed?</p>
</div>
Expand All @@ -19,12 +22,15 @@
<script setup lang="ts">
import type { LayoutDialogButton } from '@speckle/ui-components'
import {
type PaidWorkspacePlans,
type WorkspacePlans,
BillingInterval
BillingInterval,
type PaidWorkspacePlans
} from '~/lib/common/generated/gql/graphql'
import { useBillingActions } from '~/lib/billing/composables/actions'
import { startCase } from 'lodash'
import { pricingPlansConfig } from '~/lib/billing/helpers/constants'
import { Roles } from '@speckle/shared'
import { isPaidPlan } from '~/lib/billing/helpers/types'

const props = defineProps<{
plan: WorkspacePlans
Expand All @@ -35,6 +41,15 @@ const isOpen = defineModel<boolean>('open', { required: true })

const { upgradePlan } = useBillingActions()

const seatPrice = computed(() => {
if (isPaidPlan(props.plan)) {
const planConfig =
pricingPlansConfig.plans[props.plan as unknown as PaidWorkspacePlans]
return planConfig.cost[props.billingInterval][Roles.Workspace.Member]
}

return 0
})
const dialogButtons = computed((): LayoutDialogButton[] => [
{
text: 'Cancel',
Expand Down