Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: modal and badge

DarkPhoenix27046e64e2c13612
diff --git a/packages/nc-gui/components/dlg/View/Create.vue b/packages/nc-gui/components/dlg/View/Create.vue
index 58398b95bb..4875a7b620 100644
--- a/packages/nc-gui/components/dlg/View/Create.vue
+++ b/packages/nc-gui/components/dlg/View/Create.vue
@@ -17,7 +17,7 @@ import {
stringToViewTypeMap,
viewTypeToStringMap,
} from 'nocodb-sdk'
-import { UITypes, ViewTypes } from 'nocodb-sdk'
+import { PlanTitles, UITypes, ViewTypes } from 'nocodb-sdk'
import { AiWizardTabsType } from '#imports'
const props = withDefaults(defineProps<Props>(), {
@@ -87,7 +87,7 @@ const workspaceStore = useWorkspace()
const baseStore = useBase()
const { baseId: activeBaseId } = storeToRefs(baseStore)
-const { blockCalendarRange } = useEeConfig()
+const { blockCalendarRange, getPlanTitle } = useEeConfig()
const { viewsByTable } = storeToRefs(useViewsStore())
@@ -1064,98 +1064,120 @@ watch(activeBaseId, () => {
</a-select-option>
</a-select>
</div>
- <div v-if="isEeUI" class="w-full space-y-2">
- <NcButton
- v-if="range.fk_to_column_id === null"
- size="small"
- :disabled="blockCalendarRange"
- type="text"
- @click="range.fk_to_column_id = undefined"
- >
- <div class="flex items-center gap-1">
- <component :is="iconMap.plus" class="h-4 w-4" />
- {{ $t('activity.endDate') }}
- </div>
- <PaymentUpgradeBadge :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE" />
- </NcButton>
-
- <template v-else-if="isEeUI">
- <span class="text-nc-content-gray-subtle">
- {{ $t('activity.withEndDate') }}
- <PaymentUpgradeBadge :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE" />
- </span>
-
- <div class="flex">
- <a-select
- v-model:value="range.fk_to_column_id"
- class="nc-select-shadow w-full flex-1"
- allow-clear
- show-search
- :disabled="isMetaLoading || blockCalendarRange"
- :loading="isMetaLoading"
- :placeholder="$t('placeholder.notSelected')"
- data-testid="nc-calendar-range-to-field-select"
- dropdown-class-name="!rounded-lg"
- @click.stop
+ <PaymentUpgradeBadgeProvider :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE">
+ <template #default="{ click }">
+ <div v-if="isEeUI" class="w-full space-y-2">
+ <NcButton
+ v-if="range.fk_to_column_id === null"
+ size="small"
+ type="text"
+ @click="click(PlanFeatureTypes.FEATURE_CALENDAR_RANGE, () => (range.fk_to_column_id = undefined))"
>
- <template #suffixIcon><GeneralIcon icon="arrowDown" class="text-gray-700" /></template>
-
- <a-select-option
- v-for="(option, id) in [...viewSelectFieldOptions].filter((f) => {
- // If the fk_from_column_id of first range is Date, then all the other ranges should be Date
- // If the fk_from_column_id of first range is DateTime, then all the other ranges should be DateTime
- const firstRange = viewSelectFieldOptions.find(
- (f) => f.value === form.calendar_range[0].fk_from_column_id,
- )
- // First ensure the data type matches
- const dataTypeMatches = firstRange?.uidt === f.uidt && f.value !== range.fk_from_column_id
-
- // If no match in data type, return false
- if (!dataTypeMatches) return false
-
- // If first range has a timezone configured, ensure this option has the same timezone
- const firstRangeColumn = meta?.columns?.find((c) => c.id === form.calendar_range[0].fk_from_column_id)
- const optionColumn = meta?.columns?.find((c) => c.id === f.value)
- return optionColumn?.meta?.timezone === firstRangeColumn.meta.timezone
- })"
- :key="id"
- :value="option.value"
+ <div class="flex items-center gap-1">
+ <component :is="iconMap.plus" class="h-4 w-4" />
+ {{ $t('activity.endDate') }}
+ </div>
+ <PaymentUpgradeBadge
+ class="ml-2"
+ :limit-or-feature="$t('upgrade.upgradeToUseCalendarRangeSubtitle')"
+ :content="
+ $t('upgrade.upgradeToUseCalendarRangeSubtitle', {
+ plan: getPlanTitle(PlanTitles.PLUS),
+ })
+ "
+ :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE"
+ />
+ </NcButton>
+
+ <template v-else-if="isEeUI">
+ <div class="flex gap-2 items-center text-nc-content-gray-subtle">
+ {{ $t('activity.withEndDate') }}
+ <PaymentUpgradeBadge
+ :limit-or-feature="$t('upgrade.upgradeToUseCalendarRangeSubtitle')"
+ :content="
+ $t('upgrade.upgradeToUseCalendarRangeSubtitle', {
+ plan: getPlanTitle(PlanTitles.PLUS),
+ })
+ "
+ :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE"
+ />
+ </div>
+
+ <div class="flex">
+ <a-select
+ v-model:value="range.fk_to_column_id"
+ class="nc-select-shadow w-full flex-1"
+ allow-clear
+ show-search
+ :disabled="isMetaLoading || blockCalendarRange"
+ :loading="isMetaLoading"
+ :placeholder="$t('placeholder.notSelected')"
+ data-testid="nc-calendar-range-to-field-select"
+ dropdown-class-name="!rounded-lg"
+ @click.stop
+ >
+ <template #suffixIcon><GeneralIcon icon="arrowDown" class="text-gray-700" /></template>
+
+ <a-select-option
+ v-for="(option, id) in [...viewSelectFieldOptions].filter((f) => {
+ // If the fk_from_column_id of first range is Date, then all the other ranges should be Date
+ // If the fk_from_column_id of first range is DateTime, then all the other ranges should be DateTime
+ const firstRange = viewSelectFieldOptions.find(
+ (f) => f.value === form.calendar_range[0].fk_from_column_id,
+ )
+ // First ensure the data type matches
+ const dataTypeMatches = firstRange?.uidt === f.uidt && f.value !== range.fk_from_column_id
+
+ // If no match in data type, return false
+ if (!dataTypeMatches) return false
+
+ // If first range has a timezone configured, ensure this option has the same timezone
+ const firstRangeColumn = meta?.columns?.find(
+ (c) => c.id === form.calendar_range[0].fk_from_column_id,
+ )
+ const optionColumn = meta?.columns?.find((c) => c.id === f.value)
+ return optionColumn?.meta?.timezone === firstRangeColumn.meta.timezone
+ })"
+ :key="id"
+ :value="option.value"
+ >
+ <div class="w-full flex gap-2 items-center justify-between" :title="option.label">
+ <div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
+ <SmartsheetHeaderIcon :column="option" />
+
+ <NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
+ <template #title>
+ {{ option.label }}
+ </template>
+ <template #default>{{ option.label }}</template>
+ </NcTooltip>
+ </div>
+ <GeneralIcon
+ v-if="option.value === range.fk_from_column_id"
+ id="nc-selected-item-icon"
+ icon="check"
+ class="flex-none text-primary w-4 h-4"
+ />
+ </div>
+ </a-select-option>
+ </a-select>
+ </div>
+ <NcButton
+ v-if="index !== 0"
+ size="small"
+ type="secondary"
+ @click="
+ () => {
+ form.calendar_range = form.calendar_range.filter((_, i) => i !== index)
+ }
+ "
>
- <div class="w-full flex gap-2 items-center justify-between" :title="option.label">
- <div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <SmartsheetHeaderIcon :column="option" />
-
- <NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
- <template #title>
- {{ option.label }}
- </template>
- <template #default>{{ option.label }}</template>
- </NcTooltip>
- </div>
- <GeneralIcon
- v-if="option.value === range.fk_from_column_id"
- id="nc-selected-item-icon"
- icon="check"
- class="flex-none text-primary w-4 h-4"
- />
- </div>
- </a-select-option>
- </a-select>
+ <component :is="iconMap.close" />
+ </NcButton>
+ </template>
</div>
- <NcButton
- v-if="index !== 0"
- size="small"
- type="secondary"
- @click="
- () => {
- form.calendar_range = form.calendar_range.filter((_, i) => i !== index)
- }
- "
- >
- <component :is="iconMap.close" />
- </NcButton>
</template>
- </div>
+ </PaymentUpgradeBadgeProvider>
</div>
<!-- <NcButton class="mt-2" size="small" type="secondary" @click="addCalendarRange">
diff --git a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
index 43fca2efdd..e41cc09277 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
@@ -1,12 +1,12 @@
<script lang="ts" setup>
-import { type CalendarRangeType, FormulaDataTypes, PlanFeatureTypes, UITypes } from 'nocodb-sdk'
+import { type CalendarRangeType, FormulaDataTypes, PlanFeatureTypes, PlanTitles, UITypes } from 'nocodb-sdk'
import type { SelectProps } from 'ant-design-vue'
const meta = inject(MetaInj, ref())
const { $api } = useNuxtApp()
-const { blockCalendarRange } = useEeConfig()
+const { blockCalendarRange, getPlanTitle } = useEeConfig()
const activeView = inject(ActiveViewInj, ref())
@@ -266,27 +266,43 @@ const onValueChange = async () => {
v-if="range.fk_to_column_id === null"
size="small"
data-testid="nc-calendar-range-add-end-date"
- class="w-23"
type="text"
:shadow="false"
- :disabled="isLocked || blockCalendarRange"
+ :disabled="isLocked"
@click="
click(PlanFeatureTypes.FEATURE_CALENDAR_RANGE, () => {
range.fk_to_column_id = undefined
})
"
>
- <div class="flex gap-1 items-center">
+ <div class="flex gap-2 items-center">
<component :is="iconMap.plus" class="h-4 w-4" />
{{ $t('activity.endDate') }}
- <PaymentUpgradeBadge :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE" />
+ <PaymentUpgradeBadge
+ :limit-or-feature="$t('upgrade.upgradeToUseCalendarRangeSubtitle')"
+ :content="
+ $t('upgrade.upgradeToUseCalendarRangeSubtitle', {
+ plan: getPlanTitle(PlanTitles.PLUS),
+ })
+ "
+ :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE"
+ />
</div>
</NcButton>
<template v-else-if="isEeUI">
- <span>
- {{ $t('activity.withEndDate') }} <PaymentUpgradeBadge :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE" />
- </span>
+ <div class="flex gap-2 items-center">
+ {{ $t('activity.withEndDate') }}
+ <PaymentUpgradeBadge
+ :limit-or-feature="$t('upgrade.upgradeToUseCalendarRangeSubtitle')"
+ :content="
+ $t('upgrade.upgradeToUseCalendarRangeSubtitle', {
+ plan: getPlanTitle(PlanTitles.PLUS),
+ })
+ "
+ :feature="PlanFeatureTypes.FEATURE_CALENDAR_RANGE"
+ />
+ </div>
<div class="flex">
<a-select
v-model:value="range.fk_to_column_id"