toggle Field on label between singular and plural based on relation type (#8817)
#7683   Hello, I’ve implemented the logic for dynamically toggling the Field on label between singular and plural based on the relation type selected by the user. Here's an overview of the changes: Added a variable selectedRelationType to store the user’s selected relation type. Based on this variable, I determine whether to use labelPlural or labelSingular from the selectedObjectMetadataItem. Please review my changes and let me know if there's anything that needs improvement . --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -110,7 +110,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {
|
||||
label: 'Full Name',
|
||||
Icon: IllustrationIconUser,
|
||||
exampleValue: { firstName: 'John', lastName: 'Doe' },
|
||||
category: 'Advanced',
|
||||
category: 'Basic',
|
||||
subFields: ['firstName', 'lastName'],
|
||||
filterableSubFields: ['firstName', 'lastName'],
|
||||
labelBySubField: {
|
||||
|
||||
@ -2,6 +2,6 @@ import { SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS } from '@/settings/data-model/con
|
||||
import { SETTINGS_NON_COMPOSITE_FIELD_TYPE_CONFIGS } from '@/settings/data-model/constants/SettingsNonCompositeFieldTypeConfigs';
|
||||
|
||||
export const SETTINGS_FIELD_TYPE_CONFIGS = {
|
||||
...SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS,
|
||||
...SETTINGS_NON_COMPOSITE_FIELD_TYPE_CONFIGS,
|
||||
...SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS,
|
||||
};
|
||||
|
||||
@ -120,7 +120,7 @@ export const SETTINGS_NON_COMPOSITE_FIELD_TYPE_CONFIGS: SettingsNonCompositeFiel
|
||||
label: 'JSON',
|
||||
Icon: IllustrationIconJson,
|
||||
exampleValue: { key: 'value' },
|
||||
category: 'Basic',
|
||||
category: 'Advanced',
|
||||
} as const satisfies SettingsFieldTypeConfig<FieldJsonValue>,
|
||||
[FieldMetadataType.RichText]: {
|
||||
label: 'Rich Text',
|
||||
@ -131,7 +131,7 @@ export const SETTINGS_NON_COMPOSITE_FIELD_TYPE_CONFIGS: SettingsNonCompositeFiel
|
||||
[FieldMetadataType.Array]: {
|
||||
label: 'Array',
|
||||
Icon: IllustrationIconArray,
|
||||
category: 'Basic',
|
||||
category: 'Advanced',
|
||||
exampleValue: ['value1', 'value2'],
|
||||
} as const satisfies SettingsFieldTypeConfig<FieldArrayValue>,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user