Fix Views on People page (#2265)
* fetching viewId for url * fixed option menu name input * fix table import * fix unnecessary rerenders * people working --------- Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
@ -0,0 +1,157 @@
|
||||
import { ColumnDefinition } from '@/ui/data/data-table/types/ColumnDefinition';
|
||||
import {
|
||||
FieldDateMetadata,
|
||||
FieldDoubleTextChipMetadata,
|
||||
FieldEmailMetadata,
|
||||
FieldMetadata,
|
||||
FieldPhoneMetadata,
|
||||
FieldRelationMetadata,
|
||||
FieldTextMetadata,
|
||||
FieldURLMetadata,
|
||||
} from '@/ui/data/field/types/FieldMetadata';
|
||||
import {
|
||||
IconBrandLinkedin,
|
||||
IconBrandX,
|
||||
IconBriefcase,
|
||||
IconBuildingSkyscraper,
|
||||
IconCalendarEvent,
|
||||
IconMail,
|
||||
IconMap,
|
||||
IconPhone,
|
||||
IconUser,
|
||||
} from '@/ui/display/icon/index';
|
||||
import { Entity } from '@/ui/input/relation-picker/types/EntityTypeForSelect';
|
||||
import { Company } from '~/generated/graphql';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
|
||||
export const peopleAvailableFieldDefinitions: ColumnDefinition<FieldMetadata>[] =
|
||||
[
|
||||
{
|
||||
key: 'displayName',
|
||||
name: 'People',
|
||||
Icon: IconUser,
|
||||
size: 210,
|
||||
index: 0,
|
||||
type: 'double-text-chip',
|
||||
metadata: {
|
||||
firstValueFieldName: 'firstName',
|
||||
secondValueFieldName: 'lastName',
|
||||
firstValuePlaceholder: 'First name', // Hack: Fake character to prevent password-manager from filling the field
|
||||
secondValuePlaceholder: 'Last name', // Hack: Fake character to prevent password-manager from filling the field
|
||||
avatarUrlFieldName: 'avatarUrl',
|
||||
entityType: Entity.Person,
|
||||
},
|
||||
infoTooltipContent: 'Contact’s first and last name.',
|
||||
basePathToShowPage: '/person/',
|
||||
} satisfies ColumnDefinition<FieldDoubleTextChipMetadata>,
|
||||
{
|
||||
key: 'email',
|
||||
name: 'Email',
|
||||
Icon: IconMail,
|
||||
size: 150,
|
||||
type: 'email',
|
||||
index: 1,
|
||||
metadata: {
|
||||
fieldName: 'email',
|
||||
placeHolder: 'Email', // Hack: Fake character to prevent password-manager from filling the field
|
||||
},
|
||||
infoTooltipContent: 'Contact’s Email.',
|
||||
} satisfies ColumnDefinition<FieldEmailMetadata>,
|
||||
{
|
||||
key: 'company',
|
||||
name: 'Company',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
size: 150,
|
||||
index: 2,
|
||||
type: 'relation',
|
||||
metadata: {
|
||||
fieldName: 'company',
|
||||
relationType: Entity.Company,
|
||||
},
|
||||
infoTooltipContent: 'Contact’s company.',
|
||||
entityChipDisplayMapper: (dataObject: Company) => {
|
||||
return {
|
||||
name: dataObject?.name,
|
||||
pictureUrl: getLogoUrlFromDomainName(dataObject?.domainName),
|
||||
avatarType: 'squared',
|
||||
};
|
||||
},
|
||||
} satisfies ColumnDefinition<FieldRelationMetadata>,
|
||||
{
|
||||
key: 'phone',
|
||||
name: 'Phone',
|
||||
Icon: IconPhone,
|
||||
size: 150,
|
||||
index: 3,
|
||||
type: 'phone',
|
||||
metadata: {
|
||||
fieldName: 'phone',
|
||||
placeHolder: 'Phone', // Hack: Fake character to prevent password-manager from filling the field
|
||||
},
|
||||
infoTooltipContent: 'Contact’s phone number.',
|
||||
} satisfies ColumnDefinition<FieldPhoneMetadata>,
|
||||
{
|
||||
key: 'createdAt',
|
||||
name: 'Creation',
|
||||
Icon: IconCalendarEvent,
|
||||
size: 150,
|
||||
index: 4,
|
||||
type: 'date',
|
||||
metadata: {
|
||||
fieldName: 'createdAt',
|
||||
},
|
||||
infoTooltipContent: 'Date when the contact was added.',
|
||||
} satisfies ColumnDefinition<FieldDateMetadata>,
|
||||
{
|
||||
key: 'city',
|
||||
name: 'City',
|
||||
Icon: IconMap,
|
||||
size: 150,
|
||||
index: 5,
|
||||
type: 'text',
|
||||
metadata: {
|
||||
fieldName: 'city',
|
||||
placeHolder: 'City', // Hack: Fake character to prevent password-manager from filling the field
|
||||
},
|
||||
infoTooltipContent: 'Contact’s city.',
|
||||
} satisfies ColumnDefinition<FieldTextMetadata>,
|
||||
{
|
||||
key: 'jobTitle',
|
||||
name: 'Job title',
|
||||
Icon: IconBriefcase,
|
||||
size: 150,
|
||||
index: 6,
|
||||
type: 'text',
|
||||
metadata: {
|
||||
fieldName: 'jobTitle',
|
||||
placeHolder: 'Job title',
|
||||
},
|
||||
infoTooltipContent: 'Contact’s job title.',
|
||||
} satisfies ColumnDefinition<FieldTextMetadata>,
|
||||
{
|
||||
key: 'linkedin',
|
||||
name: 'LinkedIn',
|
||||
Icon: IconBrandLinkedin,
|
||||
size: 150,
|
||||
index: 7,
|
||||
type: 'url',
|
||||
metadata: {
|
||||
fieldName: 'linkedinUrl',
|
||||
placeHolder: 'LinkedIn',
|
||||
},
|
||||
infoTooltipContent: 'Contact’s Linkedin account.',
|
||||
} satisfies ColumnDefinition<FieldURLMetadata>,
|
||||
{
|
||||
key: 'x',
|
||||
name: 'Twitter',
|
||||
Icon: IconBrandX,
|
||||
size: 150,
|
||||
index: 8,
|
||||
type: 'url',
|
||||
metadata: {
|
||||
fieldName: 'xUrl',
|
||||
placeHolder: 'X',
|
||||
},
|
||||
infoTooltipContent: 'Contact’s Twitter account.',
|
||||
} satisfies ColumnDefinition<FieldURLMetadata>,
|
||||
];
|
||||
Reference in New Issue
Block a user