fix(fe): Update UpgradeLimitAlert to use real counts

fix(fe): Update UpgradeLimitAlert to use real counts
This commit is contained in:
andrewwallacespeckle
2025-04-17 23:40:46 +01:00
committed by GitHub
5 changed files with 21 additions and 17 deletions
@@ -46,7 +46,7 @@
>
<ViewerResourcesUpgradeLimitAlert
class="!bg-foundation !text-foreground-2"
:text="`Upgrade to view versions older than ${versionLimitFormatted} days.`"
limit-type="version"
/>
</div>
<div
@@ -114,7 +114,6 @@ import { graphql } from '~~/lib/common/generated/gql'
import { SpeckleViewer, SourceApps } from '@speckle/shared'
import type { VersionActionTypes } from '~~/lib/projects/helpers/components'
import { isPendingVersionFragment } from '~~/lib/projects/helpers/models'
import { useWorkspaceLimits } from '~/lib/workspaces/composables/limits'
graphql(`
fragment ProjectModelPageVersionsCardVersion on Version {
@@ -161,7 +160,6 @@ const props = defineProps<{
}>()
const isAutomateModuleEnabled = useIsAutomateModuleEnabled()
const { versionLimitFormatted } = useWorkspaceLimits(props.workspaceSlug ?? '')
const showActionsMenu = ref(false)
@@ -19,10 +19,7 @@
v-else
class="w-full h-48 flex items-center justify-center diagonal-stripes px-3 pb-8"
>
<ViewerResourcesUpgradeLimitAlert
class="!bg-foundation"
text="Upgrade to see comments older than (count) days."
/>
<ViewerResourcesUpgradeLimitAlert limit-type="comment" />
</div>
<div class="flex items-center w-full px-3 h-8 -mt-10">
<UserAvatarGroup
@@ -22,9 +22,7 @@
:class="isEmbedEnabled ? 'mt-2' : 'mt-3'"
>
<template v-if="isLimited">
<ViewerResourcesUpgradeLimitAlert
text="Upgrade to view comments older than (count) days."
/>
<ViewerResourcesUpgradeLimitAlert limit-type="comment" />
</template>
<template v-else>
<CommonTiptapTextEditor
@@ -25,10 +25,7 @@
>
{{ thread.rawText }}
</div>
<ViewerResourcesUpgradeLimitAlert
v-else
text="Upgrade to see comments older than (count) days."
/>
<ViewerResourcesUpgradeLimitAlert v-else limit-type="comment" />
<div class="text-body-3xs flex items-center space-x-3 text-foreground-3 mb-1">
<div
v-if="itemStatus.isDifferentVersion || itemStatus.isFederatedModel"
@@ -1,19 +1,33 @@
<template>
<CommonAlert class="select-none" size="2xs" color="info" hide-icon :actions="actions">
<template #description>{{ text }}</template>
<template #description>
{{ text }}
</template>
</CommonAlert>
</template>
<script setup lang="ts">
import type { AlertAction } from '@speckle/ui-components'
import { useNavigation } from '~/lib/navigation/composables/navigation'
import { useWorkspaceLimits } from '~/lib/workspaces/composables/limits'
import { settingsWorkspaceRoutes } from '~~/lib/common/helpers/route'
defineProps<{
text: string
const props = defineProps<{
limitType: 'comment' | 'version'
}>()
const { activeWorkspaceSlug } = useNavigation()
const { commentLimitFormatted, versionLimitFormatted } = useWorkspaceLimits(
activeWorkspaceSlug.value || ''
)
const text = computed(() => {
if (props.limitType === 'comment') {
return `Upgrade to view comments older than ${commentLimitFormatted.value}.`
}
return `Upgrade to view versions older than ${versionLimitFormatted.value}.`
})
const actions = computed((): AlertAction[] => [
{
title: 'Upgrade',