From e191c90385803118fa77a9e63cef7760b8f0ee1f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 10 Oct 2024 16:14:36 +0200 Subject: [PATCH 1/5] Simplify enriched column --- packages/server/src/sdk/app/views/index.ts | 15 +++++++++++---- packages/types/src/sdk/view.ts | 13 +++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index 35f2a84b07..246922678d 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -1,4 +1,5 @@ import { + BBReferenceFieldSubType, CalculationType, canGroupBy, FeatureFlag, @@ -7,6 +8,7 @@ import { PermissionLevel, RelationSchemaField, RenameColumn, + RequiredKeys, Table, TableSchema, View, @@ -325,13 +327,18 @@ export async function enrichSchema( const viewFieldSchema = viewFields[relTableFieldName] const isVisible = !!viewFieldSchema?.visible const isReadonly = !!viewFieldSchema?.readonly - result[relTableFieldName] = { - ...relTableField, - ...viewFieldSchema, - name: relTableField.name, + const enrichedFieldSchema: RequiredKeys = { visible: isVisible, readonly: isReadonly, + order: viewFieldSchema?.order, + width: viewFieldSchema?.width, + + icon: relTableField.icon, + type: relTableField.type, + subtype: relTableField.subtype, } + } + result[relTableFieldName] = enrichedFieldSchema } return result } diff --git a/packages/types/src/sdk/view.ts b/packages/types/src/sdk/view.ts index 422207197d..4c555fbaa7 100644 --- a/packages/types/src/sdk/view.ts +++ b/packages/types/src/sdk/view.ts @@ -1,4 +1,10 @@ -import { FieldSchema, RelationSchemaField, ViewV2 } from "../documents" +import { + FieldSchema, + FieldSubType, + FieldType, + RelationSchemaField, + ViewV2, +} from "../documents" export interface ViewV2Enriched extends ViewV2 { schema?: { @@ -8,4 +14,7 @@ export interface ViewV2Enriched extends ViewV2 { } } -export type ViewV2ColumnEnriched = RelationSchemaField & FieldSchema +export interface ViewV2ColumnEnriched extends RelationSchemaField { + type: FieldType + subtype?: FieldSubType +} From 41cd0d96d625cc125480cf66b61fccf96edcd147 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 10 Oct 2024 16:14:53 +0200 Subject: [PATCH 2/5] Fix multiple user column icon --- packages/frontend-core/src/components/grid/lib/utils.js | 4 ++++ packages/server/src/sdk/app/views/index.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/frontend-core/src/components/grid/lib/utils.js b/packages/frontend-core/src/components/grid/lib/utils.js index 1988b66cc2..fb062cb1fa 100644 --- a/packages/frontend-core/src/components/grid/lib/utils.js +++ b/packages/frontend-core/src/components/grid/lib/utils.js @@ -19,6 +19,10 @@ export const getCellID = (rowId, fieldName) => { } export const getColumnIcon = column => { + if (column.schema.icon) { + return column.schema.icon + } + if (column.schema.autocolumn) { return "MagicWand" } diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index 246922678d..45004a861d 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -337,6 +337,14 @@ export async function enrichSchema( type: relTableField.type, subtype: relTableField.subtype, } + if ( + !enrichedFieldSchema.icon && + relTableField.type === FieldType.BB_REFERENCE && + relTableField.subtype === BBReferenceFieldSubType.USER && + !helpers.schema.isDeprecatedSingleUserColumn(relTableField) + ) { + // Forcing the icon, otherwise we would need to pass the constraints to show the proper icon + enrichedFieldSchema.icon = "UserGroup" } result[relTableFieldName] = enrichedFieldSchema } From ca7f3369af2839432da7610cfd1af113d4f70945 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 10 Oct 2024 16:51:08 +0200 Subject: [PATCH 3/5] Fix user icons on picker --- .../src/components/grid/controls/ColumnsSettingContent.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte b/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte index bbc3d55f04..dd12af3ff4 100644 --- a/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte +++ b/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte @@ -125,7 +125,7 @@ subtype: column.subtype, visible: column.visible, readonly: column.readonly, - constraints: column.constraints, // This is needed to properly display "users" column + icon: column.icon, }, } }) From 18e1bd0b4c58c8f2541767ca932edf195ed8632c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 10 Oct 2024 17:03:46 +0200 Subject: [PATCH 4/5] Fix test --- packages/server/src/sdk/app/views/tests/views.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/server/src/sdk/app/views/tests/views.spec.ts b/packages/server/src/sdk/app/views/tests/views.spec.ts index 1d7360c5eb..948ffbf096 100644 --- a/packages/server/src/sdk/app/views/tests/views.spec.ts +++ b/packages/server/src/sdk/app/views/tests/views.spec.ts @@ -355,13 +355,11 @@ describe("table sdk", () => { visible: true, columns: { title: { - name: "title", type: "string", visible: true, readonly: true, }, age: { - name: "age", type: "number", visible: false, readonly: false, From 402013bef3c46900a35eff24d8034e1a330dcb2b Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:39:03 +0100 Subject: [PATCH 5/5] UI tweak for days remaining banner of free trial (#14764) --- .../portal/licensing/EnterpriseBasicTrialBanner.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/portal/licensing/EnterpriseBasicTrialBanner.svelte b/packages/builder/src/components/portal/licensing/EnterpriseBasicTrialBanner.svelte index 111f0481b9..350ebb0f11 100644 --- a/packages/builder/src/components/portal/licensing/EnterpriseBasicTrialBanner.svelte +++ b/packages/builder/src/components/portal/licensing/EnterpriseBasicTrialBanner.svelte @@ -14,7 +14,13 @@ function daysUntilCancel() { const cancelAt = license?.billing?.subscription?.cancelAt const diffTime = Math.abs(cancelAt - new Date().getTime()) / 1000 - return Math.floor(diffTime / oneDayInSeconds) + const days = Math.floor(diffTime / oneDayInSeconds) + if (days === 1) { + return "tomorrow." + } else if (days === 0) { + return "today." + } + return `in ${days} days.` } @@ -28,7 +34,7 @@ extraLinkAction={$licensing.goToUpgradePage} showCloseButton={false} > - Your free trial will end in {daysUntilCancel()} days. + Your free trial will end {daysUntilCancel()} {/if}