feat: add sub fields for address (#13566)

https://github.com/user-attachments/assets/8fe9079d-9b66-4b42-8b11-ad713e9de666

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Naifer
2025-08-02 22:43:39 +01:00
committed by GitHub
parent 4624739879
commit 2bda929984
20 changed files with 1138 additions and 112 deletions
@@ -0,0 +1,20 @@
import { FieldAddressValue } from '@/object-record/record-field/types/FieldMetadata';
import {
ALLOWED_ADDRESS_SUBFIELDS,
AllowedAddressSubField,
} from 'twenty-shared/src/types/AddressFieldsType';
import { isDefined } from 'twenty-shared/utils';
import { joinAddressFieldValues } from '~/utils/joinAddressFieldValues';
export const formatAddressDisplay = (
fieldValue: FieldAddressValue | undefined,
subFields: AllowedAddressSubField[] | null | undefined,
) => {
if (!isDefined(fieldValue)) return '';
const fieldsToUse =
subFields && subFields.length > 0
? subFields
: [...ALLOWED_ADDRESS_SUBFIELDS];
return joinAddressFieldValues(fieldValue, fieldsToUse);
};