Fix: Hide add-ons if not self serve plan (#4706)

This commit is contained in:
Mike
2025-05-12 14:46:10 +02:00
committed by GitHub
parent b406d0e32d
commit 2700fbb894
2 changed files with 33 additions and 20 deletions
@@ -26,25 +26,30 @@
<SettingsWorkspacesBillingUsage :slug="slug" />
</section>
<ClientOnly>
<section class="flex flex-col gap-y-4 md:gap-y-6">
<SettingsSectionHeader title="Upgrade your plan" subheading />
<PricingTable
:slug="slug"
:workspace-id="workspace?.id"
:role="workspace?.role as WorkspaceRoles"
:currency="workspace?.subscription?.currency"
:is-yearly-interval-selected="
workspace?.subscription?.billingInterval === BillingInterval.Yearly
"
/>
</section>
<template v-if="showPricingInfo">
<ClientOnly>
<section class="flex flex-col gap-y-4 md:gap-y-6">
<SettingsSectionHeader title="Upgrade your plan" subheading />
<PricingTable
:slug="slug"
:workspace-id="workspace?.id"
:role="workspace?.role as WorkspaceRoles"
:currency="workspace?.subscription?.currency"
:is-yearly-interval-selected="
workspace?.subscription?.billingInterval === BillingInterval.Yearly
"
/>
</section>
<section class="flex flex-col gap-y-4 md:gap-y-6">
<SettingsSectionHeader title="Add-ons" subheading />
<SettingsWorkspacesBillingAddOns :slug="slug" :workspace-id="workspace?.id" />
</section>
</ClientOnly>
<section class="flex flex-col gap-y-4 md:gap-y-6">
<SettingsSectionHeader title="Add-ons" subheading />
<SettingsWorkspacesBillingAddOns
:slug="slug"
:workspace-id="workspace?.id"
/>
</section>
</ClientOnly>
</template>
</div>
</div>
</template>
@@ -52,7 +57,11 @@
<script lang="ts" setup>
import { useQuery } from '@vue/apollo-composable'
import { settingsWorkspaceBillingQuery } from '~/lib/settings/graphql/queries'
import { type WorkspaceRoles, workspaceReachedPlanLimit } from '@speckle/shared'
import {
type WorkspaceRoles,
workspaceReachedPlanLimit,
isSelfServeAvailablePlan
} from '@speckle/shared'
import { useWorkspacePlan } from '~~/lib/workspaces/composables/plan'
import { graphql } from '~/lib/common/generated/gql'
import {
@@ -107,4 +116,8 @@ const reachedPlanLimit = computed(() =>
workspace.value?.plan?.usage?.modelCount
)
)
const showPricingInfo = computed(() => {
if (!workspace.value?.plan?.name) return false
return isSelfServeAvailablePlan(workspace.value.plan.name)
})
</script>
@@ -18,7 +18,7 @@
location="workspace_switcher"
/>
<FormButton
v-if="!showAllWorkspaces"
v-if="!showAllWorkspaces && discoverableWorkspacesAndJoinRequestsCount > 3"
color="subtle"
size="lg"
full-width