Chore: New standard fields on Companies (#1276)
* New standard fields on Companies Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * New standard fields on Companies Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add requested changes Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Make some fields hidden by default Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add minor refactors Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> --------- Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
@ -620,15 +620,18 @@ export type Company = {
|
|||||||
accountOwnerId?: Maybe<Scalars['String']>;
|
accountOwnerId?: Maybe<Scalars['String']>;
|
||||||
activities: Array<Activity>;
|
activities: Array<Activity>;
|
||||||
address: Scalars['String'];
|
address: Scalars['String'];
|
||||||
|
annualRecurringRevenue?: Maybe<Scalars['Int']>;
|
||||||
comments: Array<Comment>;
|
comments: Array<Comment>;
|
||||||
createdAt: Scalars['DateTime'];
|
createdAt: Scalars['DateTime'];
|
||||||
domainName: Scalars['String'];
|
domainName: Scalars['String'];
|
||||||
employees?: Maybe<Scalars['Int']>;
|
employees?: Maybe<Scalars['Int']>;
|
||||||
id: Scalars['ID'];
|
id: Scalars['ID'];
|
||||||
|
idealCustomerProfile: Scalars['Boolean'];
|
||||||
linkedinUrl?: Maybe<Scalars['String']>;
|
linkedinUrl?: Maybe<Scalars['String']>;
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
people?: Maybe<Array<Person>>;
|
people?: Maybe<Array<Person>>;
|
||||||
updatedAt: Scalars['DateTime'];
|
updatedAt: Scalars['DateTime'];
|
||||||
|
xUrl?: Maybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateInput = {
|
export type CompanyCreateInput = {
|
||||||
@ -637,26 +640,32 @@ export type CompanyCreateInput = {
|
|||||||
PipelineProgress?: InputMaybe<PipelineProgressCreateNestedManyWithoutCompanyInput>;
|
PipelineProgress?: InputMaybe<PipelineProgressCreateNestedManyWithoutCompanyInput>;
|
||||||
accountOwner?: InputMaybe<UserCreateNestedOneWithoutCompaniesInput>;
|
accountOwner?: InputMaybe<UserCreateNestedOneWithoutCompaniesInput>;
|
||||||
address: Scalars['String'];
|
address: Scalars['String'];
|
||||||
|
annualRecurringRevenue?: InputMaybe<Scalars['Int']>;
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
createdAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
domainName: Scalars['String'];
|
domainName: Scalars['String'];
|
||||||
employees?: InputMaybe<Scalars['Int']>;
|
employees?: InputMaybe<Scalars['Int']>;
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
|
idealCustomerProfile?: InputMaybe<Scalars['Boolean']>;
|
||||||
linkedinUrl?: InputMaybe<Scalars['String']>;
|
linkedinUrl?: InputMaybe<Scalars['String']>;
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
people?: InputMaybe<PersonCreateNestedManyWithoutCompanyInput>;
|
people?: InputMaybe<PersonCreateNestedManyWithoutCompanyInput>;
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
|
xUrl?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateManyInput = {
|
export type CompanyCreateManyInput = {
|
||||||
accountOwnerId?: InputMaybe<Scalars['String']>;
|
accountOwnerId?: InputMaybe<Scalars['String']>;
|
||||||
address: Scalars['String'];
|
address: Scalars['String'];
|
||||||
|
annualRecurringRevenue?: InputMaybe<Scalars['Int']>;
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
createdAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
domainName: Scalars['String'];
|
domainName: Scalars['String'];
|
||||||
employees?: InputMaybe<Scalars['Int']>;
|
employees?: InputMaybe<Scalars['Int']>;
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
|
idealCustomerProfile?: InputMaybe<Scalars['Boolean']>;
|
||||||
linkedinUrl?: InputMaybe<Scalars['String']>;
|
linkedinUrl?: InputMaybe<Scalars['String']>;
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
|
xUrl?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateNestedOneWithoutActivityTargetInput = {
|
export type CompanyCreateNestedOneWithoutActivityTargetInput = {
|
||||||
@ -688,14 +697,17 @@ export type CompanyOrderByWithRelationInput = {
|
|||||||
accountOwner?: InputMaybe<UserOrderByWithRelationInput>;
|
accountOwner?: InputMaybe<UserOrderByWithRelationInput>;
|
||||||
accountOwnerId?: InputMaybe<SortOrder>;
|
accountOwnerId?: InputMaybe<SortOrder>;
|
||||||
address?: InputMaybe<SortOrder>;
|
address?: InputMaybe<SortOrder>;
|
||||||
|
annualRecurringRevenue?: InputMaybe<SortOrder>;
|
||||||
createdAt?: InputMaybe<SortOrder>;
|
createdAt?: InputMaybe<SortOrder>;
|
||||||
domainName?: InputMaybe<SortOrder>;
|
domainName?: InputMaybe<SortOrder>;
|
||||||
employees?: InputMaybe<SortOrder>;
|
employees?: InputMaybe<SortOrder>;
|
||||||
id?: InputMaybe<SortOrder>;
|
id?: InputMaybe<SortOrder>;
|
||||||
|
idealCustomerProfile?: InputMaybe<SortOrder>;
|
||||||
linkedinUrl?: InputMaybe<SortOrder>;
|
linkedinUrl?: InputMaybe<SortOrder>;
|
||||||
name?: InputMaybe<SortOrder>;
|
name?: InputMaybe<SortOrder>;
|
||||||
people?: InputMaybe<PersonOrderByRelationAggregateInput>;
|
people?: InputMaybe<PersonOrderByRelationAggregateInput>;
|
||||||
updatedAt?: InputMaybe<SortOrder>;
|
updatedAt?: InputMaybe<SortOrder>;
|
||||||
|
xUrl?: InputMaybe<SortOrder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyRelationFilter = {
|
export type CompanyRelationFilter = {
|
||||||
@ -706,15 +718,18 @@ export type CompanyRelationFilter = {
|
|||||||
export enum CompanyScalarFieldEnum {
|
export enum CompanyScalarFieldEnum {
|
||||||
AccountOwnerId = 'accountOwnerId',
|
AccountOwnerId = 'accountOwnerId',
|
||||||
Address = 'address',
|
Address = 'address',
|
||||||
|
AnnualRecurringRevenue = 'annualRecurringRevenue',
|
||||||
CreatedAt = 'createdAt',
|
CreatedAt = 'createdAt',
|
||||||
DeletedAt = 'deletedAt',
|
DeletedAt = 'deletedAt',
|
||||||
DomainName = 'domainName',
|
DomainName = 'domainName',
|
||||||
Employees = 'employees',
|
Employees = 'employees',
|
||||||
Id = 'id',
|
Id = 'id',
|
||||||
|
IdealCustomerProfile = 'idealCustomerProfile',
|
||||||
LinkedinUrl = 'linkedinUrl',
|
LinkedinUrl = 'linkedinUrl',
|
||||||
Name = 'name',
|
Name = 'name',
|
||||||
UpdatedAt = 'updatedAt',
|
UpdatedAt = 'updatedAt',
|
||||||
WorkspaceId = 'workspaceId'
|
WorkspaceId = 'workspaceId',
|
||||||
|
XUrl = 'xUrl'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CompanyUpdateInput = {
|
export type CompanyUpdateInput = {
|
||||||
@ -723,14 +738,17 @@ export type CompanyUpdateInput = {
|
|||||||
PipelineProgress?: InputMaybe<PipelineProgressUpdateManyWithoutCompanyNestedInput>;
|
PipelineProgress?: InputMaybe<PipelineProgressUpdateManyWithoutCompanyNestedInput>;
|
||||||
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
||||||
address?: InputMaybe<Scalars['String']>;
|
address?: InputMaybe<Scalars['String']>;
|
||||||
|
annualRecurringRevenue?: InputMaybe<Scalars['Int']>;
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
createdAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
domainName?: InputMaybe<Scalars['String']>;
|
domainName?: InputMaybe<Scalars['String']>;
|
||||||
employees?: InputMaybe<Scalars['Int']>;
|
employees?: InputMaybe<Scalars['Int']>;
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
|
idealCustomerProfile?: InputMaybe<Scalars['Boolean']>;
|
||||||
linkedinUrl?: InputMaybe<Scalars['String']>;
|
linkedinUrl?: InputMaybe<Scalars['String']>;
|
||||||
name?: InputMaybe<Scalars['String']>;
|
name?: InputMaybe<Scalars['String']>;
|
||||||
people?: InputMaybe<PersonUpdateManyWithoutCompanyNestedInput>;
|
people?: InputMaybe<PersonUpdateManyWithoutCompanyNestedInput>;
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
|
xUrl?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyUpdateManyWithoutAccountOwnerNestedInput = {
|
export type CompanyUpdateManyWithoutAccountOwnerNestedInput = {
|
||||||
@ -765,14 +783,17 @@ export type CompanyWhereInput = {
|
|||||||
accountOwner?: InputMaybe<UserRelationFilter>;
|
accountOwner?: InputMaybe<UserRelationFilter>;
|
||||||
accountOwnerId?: InputMaybe<StringNullableFilter>;
|
accountOwnerId?: InputMaybe<StringNullableFilter>;
|
||||||
address?: InputMaybe<StringFilter>;
|
address?: InputMaybe<StringFilter>;
|
||||||
|
annualRecurringRevenue?: InputMaybe<IntNullableFilter>;
|
||||||
createdAt?: InputMaybe<DateTimeFilter>;
|
createdAt?: InputMaybe<DateTimeFilter>;
|
||||||
domainName?: InputMaybe<StringFilter>;
|
domainName?: InputMaybe<StringFilter>;
|
||||||
employees?: InputMaybe<IntNullableFilter>;
|
employees?: InputMaybe<IntNullableFilter>;
|
||||||
id?: InputMaybe<StringFilter>;
|
id?: InputMaybe<StringFilter>;
|
||||||
|
idealCustomerProfile?: InputMaybe<BoolFilter>;
|
||||||
linkedinUrl?: InputMaybe<StringNullableFilter>;
|
linkedinUrl?: InputMaybe<StringNullableFilter>;
|
||||||
name?: InputMaybe<StringFilter>;
|
name?: InputMaybe<StringFilter>;
|
||||||
people?: InputMaybe<PersonListRelationFilter>;
|
people?: InputMaybe<PersonListRelationFilter>;
|
||||||
updatedAt?: InputMaybe<DateTimeFilter>;
|
updatedAt?: InputMaybe<DateTimeFilter>;
|
||||||
|
xUrl?: InputMaybe<StringNullableFilter>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyWhereUniqueInput = {
|
export type CompanyWhereUniqueInput = {
|
||||||
@ -3047,7 +3068,7 @@ export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
|||||||
|
|
||||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null } } };
|
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null } } };
|
||||||
|
|
||||||
export type CompanyFieldsFragmentFragment = { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null };
|
export type CompanyFieldsFragmentFragment = { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null };
|
||||||
|
|
||||||
export type DeleteManyCompaniesMutationVariables = Exact<{
|
export type DeleteManyCompaniesMutationVariables = Exact<{
|
||||||
ids?: InputMaybe<Array<Scalars['String']> | Scalars['String']>;
|
ids?: InputMaybe<Array<Scalars['String']> | Scalars['String']>;
|
||||||
@ -3068,7 +3089,7 @@ export type InsertOneCompanyMutationVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type InsertOneCompanyMutation = { __typename?: 'Mutation', createOneCompany: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null } };
|
export type InsertOneCompanyMutation = { __typename?: 'Mutation', createOneCompany: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null } };
|
||||||
|
|
||||||
export type UpdateOneCompanyMutationVariables = Exact<{
|
export type UpdateOneCompanyMutationVariables = Exact<{
|
||||||
where: CompanyWhereUniqueInput;
|
where: CompanyWhereUniqueInput;
|
||||||
@ -3076,7 +3097,7 @@ export type UpdateOneCompanyMutationVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type UpdateOneCompanyMutation = { __typename?: 'Mutation', updateOneCompany?: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null } | null };
|
export type UpdateOneCompanyMutation = { __typename?: 'Mutation', updateOneCompany?: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null } | null };
|
||||||
|
|
||||||
export type GetCompaniesQueryVariables = Exact<{
|
export type GetCompaniesQueryVariables = Exact<{
|
||||||
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput> | CompanyOrderByWithRelationInput>;
|
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput> | CompanyOrderByWithRelationInput>;
|
||||||
@ -3084,14 +3105,14 @@ export type GetCompaniesQueryVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetCompaniesQuery = { __typename?: 'Query', companies: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, linkedinUrl?: string | null, employees?: number | null, _activityCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } | null }> };
|
export type GetCompaniesQuery = { __typename?: 'Query', companies: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, employees?: number | null, _activityCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } | null }> };
|
||||||
|
|
||||||
export type GetCompanyQueryVariables = Exact<{
|
export type GetCompanyQueryVariables = Exact<{
|
||||||
where: CompanyWhereUniqueInput;
|
where: CompanyWhereUniqueInput;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetCompanyQuery = { __typename?: 'Query', findUniqueCompany: { __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, linkedinUrl?: string | null, employees?: number | null, _activityCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null, Favorite?: Array<{ __typename?: 'Favorite', id: string, person?: { __typename?: 'Person', id: string } | null, company?: { __typename?: 'Company', id: string } | null }> | null } };
|
export type GetCompanyQuery = { __typename?: 'Query', findUniqueCompany: { __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, employees?: number | null, _activityCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null, Favorite?: Array<{ __typename?: 'Favorite', id: string, person?: { __typename?: 'Person', id: string } | null, company?: { __typename?: 'Company', id: string } | null }> | null } };
|
||||||
|
|
||||||
export type DeleteFavoriteMutationVariables = Exact<{
|
export type DeleteFavoriteMutationVariables = Exact<{
|
||||||
where: FavoriteWhereInput;
|
where: FavoriteWhereInput;
|
||||||
@ -3302,7 +3323,7 @@ export type SearchCompanyQueryVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type SearchCompanyQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null }> };
|
export type SearchCompanyQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, linkedinUrl?: string | null, xUrl?: string | null, annualRecurringRevenue?: number | null, idealCustomerProfile: boolean, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null }> };
|
||||||
|
|
||||||
export type SearchPeopleQueryVariables = Exact<{
|
export type SearchPeopleQueryVariables = Exact<{
|
||||||
where?: InputMaybe<PersonWhereInput>;
|
where?: InputMaybe<PersonWhereInput>;
|
||||||
@ -3628,6 +3649,9 @@ export const CompanyFieldsFragmentFragmentDoc = gql`
|
|||||||
domainName
|
domainName
|
||||||
employees
|
employees
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
@ -4514,6 +4538,9 @@ export const GetCompaniesDocument = gql`
|
|||||||
createdAt
|
createdAt
|
||||||
address
|
address
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
employees
|
employees
|
||||||
_activityCount
|
_activityCount
|
||||||
accountOwner {
|
accountOwner {
|
||||||
@ -4565,6 +4592,9 @@ export const GetCompanyDocument = gql`
|
|||||||
createdAt
|
createdAt
|
||||||
address
|
address
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
employees
|
employees
|
||||||
_activityCount
|
_activityCount
|
||||||
accountOwner {
|
accountOwner {
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
|
ViewFieldBooleanMetadata,
|
||||||
ViewFieldChipMetadata,
|
ViewFieldChipMetadata,
|
||||||
ViewFieldDateMetadata,
|
ViewFieldDateMetadata,
|
||||||
ViewFieldDefinition,
|
ViewFieldDefinition,
|
||||||
ViewFieldMetadata,
|
ViewFieldMetadata,
|
||||||
|
ViewFieldMoneyMetadata,
|
||||||
ViewFieldNumberMetadata,
|
ViewFieldNumberMetadata,
|
||||||
ViewFieldRelationMetadata,
|
ViewFieldRelationMetadata,
|
||||||
ViewFieldTextMetadata,
|
ViewFieldTextMetadata,
|
||||||
@ -10,10 +12,13 @@ import {
|
|||||||
} from '@/ui/editable-field/types/ViewField';
|
} from '@/ui/editable-field/types/ViewField';
|
||||||
import {
|
import {
|
||||||
IconBrandLinkedin,
|
IconBrandLinkedin,
|
||||||
|
IconBrandX,
|
||||||
IconBuildingSkyscraper,
|
IconBuildingSkyscraper,
|
||||||
IconCalendarEvent,
|
IconCalendarEvent,
|
||||||
IconLink,
|
IconLink,
|
||||||
IconMap,
|
IconMap,
|
||||||
|
IconMoneybag,
|
||||||
|
IconTarget,
|
||||||
IconUserCircle,
|
IconUserCircle,
|
||||||
IconUsers,
|
IconUsers,
|
||||||
} from '@/ui/icon/index';
|
} from '@/ui/icon/index';
|
||||||
@ -111,4 +116,40 @@ export const companyViewFields: ViewFieldDefinition<ViewFieldMetadata>[] = [
|
|||||||
},
|
},
|
||||||
isVisible: true,
|
isVisible: true,
|
||||||
} satisfies ViewFieldDefinition<ViewFieldTextMetadata>,
|
} satisfies ViewFieldDefinition<ViewFieldTextMetadata>,
|
||||||
|
{
|
||||||
|
id: 'idealCustomerProfile',
|
||||||
|
columnLabel: 'ICP',
|
||||||
|
columnIcon: <IconTarget />,
|
||||||
|
columnSize: 150,
|
||||||
|
columnOrder: 8,
|
||||||
|
metadata: {
|
||||||
|
type: 'boolean',
|
||||||
|
fieldName: 'idealCustomerProfile',
|
||||||
|
},
|
||||||
|
isVisible: false,
|
||||||
|
} satisfies ViewFieldDefinition<ViewFieldBooleanMetadata>,
|
||||||
|
{
|
||||||
|
id: 'annualRecurringRevenue',
|
||||||
|
columnLabel: 'ARR',
|
||||||
|
columnIcon: <IconMoneybag />,
|
||||||
|
columnSize: 150,
|
||||||
|
columnOrder: 8,
|
||||||
|
metadata: {
|
||||||
|
type: 'moneyAmount',
|
||||||
|
fieldName: 'annualRecurringRevenue',
|
||||||
|
},
|
||||||
|
} satisfies ViewFieldDefinition<ViewFieldMoneyMetadata>,
|
||||||
|
{
|
||||||
|
id: 'xUrl',
|
||||||
|
columnLabel: 'Twitter',
|
||||||
|
columnIcon: <IconBrandX />,
|
||||||
|
columnSize: 150,
|
||||||
|
columnOrder: 8,
|
||||||
|
metadata: {
|
||||||
|
type: 'url',
|
||||||
|
fieldName: 'xUrl',
|
||||||
|
placeHolder: 'X',
|
||||||
|
},
|
||||||
|
isVisible: false,
|
||||||
|
} satisfies ViewFieldDefinition<ViewFieldURLMetadata>,
|
||||||
];
|
];
|
||||||
|
|||||||
@ -13,6 +13,9 @@ export const COMPANY_FIELDS_FRAGMENT = gql`
|
|||||||
domainName
|
domainName
|
||||||
employees
|
employees
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,9 @@ export const GET_COMPANIES = gql`
|
|||||||
createdAt
|
createdAt
|
||||||
address
|
address
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
employees
|
employees
|
||||||
_activityCount
|
_activityCount
|
||||||
accountOwner {
|
accountOwner {
|
||||||
|
|||||||
@ -9,6 +9,9 @@ export const GET_COMPANY = gql`
|
|||||||
createdAt
|
createdAt
|
||||||
address
|
address
|
||||||
linkedinUrl
|
linkedinUrl
|
||||||
|
xUrl
|
||||||
|
annualRecurringRevenue
|
||||||
|
idealCustomerProfile
|
||||||
employees
|
employees
|
||||||
_activityCount
|
_activityCount
|
||||||
accountOwner {
|
accountOwner {
|
||||||
|
|||||||
@ -10,6 +10,9 @@ type MockedCompany = Pick<
|
|||||||
| 'address'
|
| 'address'
|
||||||
| 'employees'
|
| 'employees'
|
||||||
| 'linkedinUrl'
|
| 'linkedinUrl'
|
||||||
|
| 'xUrl'
|
||||||
|
| 'annualRecurringRevenue'
|
||||||
|
| 'idealCustomerProfile'
|
||||||
| '_activityCount'
|
| '_activityCount'
|
||||||
> & {
|
> & {
|
||||||
accountOwner: Pick<
|
accountOwner: Pick<
|
||||||
@ -30,6 +33,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
domainName: 'airbnb.com',
|
domainName: 'airbnb.com',
|
||||||
name: 'Airbnb',
|
name: 'Airbnb',
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/airbnb/',
|
linkedinUrl: 'https://www.linkedin.com/company/airbnb/',
|
||||||
|
xUrl: 'https://twitter.com/airbnb',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
createdAt: '2023-04-26T10:08:54.724515+00:00',
|
createdAt: '2023-04-26T10:08:54.724515+00:00',
|
||||||
address: 'San Francisco, CA',
|
address: 'San Francisco, CA',
|
||||||
employees: 5000,
|
employees: 5000,
|
||||||
@ -50,6 +56,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
domainName: 'qonto.com',
|
domainName: 'qonto.com',
|
||||||
name: 'Qonto',
|
name: 'Qonto',
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/qonto/',
|
linkedinUrl: 'https://www.linkedin.com/company/qonto/',
|
||||||
|
xUrl: 'https://twitter.com/qonto',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||||
address: 'Paris, France',
|
address: 'Paris, France',
|
||||||
employees: 800,
|
employees: 800,
|
||||||
@ -62,6 +71,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
domainName: 'stripe.com',
|
domainName: 'stripe.com',
|
||||||
name: 'Stripe',
|
name: 'Stripe',
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/stripe/',
|
linkedinUrl: 'https://www.linkedin.com/company/stripe/',
|
||||||
|
xUrl: 'https://twitter.com/stripe',
|
||||||
|
annualRecurringRevenue: 5000000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
createdAt: '2023-04-26T10:10:32.530184+00:00',
|
createdAt: '2023-04-26T10:10:32.530184+00:00',
|
||||||
address: 'San Francisco, CA',
|
address: 'San Francisco, CA',
|
||||||
employees: 8000,
|
employees: 8000,
|
||||||
@ -73,6 +85,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
id: 'b1cfd51b-a831-455f-ba07-4e30671e1dc3',
|
id: 'b1cfd51b-a831-455f-ba07-4e30671e1dc3',
|
||||||
domainName: 'figma.com',
|
domainName: 'figma.com',
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/figma/',
|
linkedinUrl: 'https://www.linkedin.com/company/figma/',
|
||||||
|
xUrl: 'https://twitter.com/figma',
|
||||||
|
annualRecurringRevenue: 50000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
name: 'Figma',
|
name: 'Figma',
|
||||||
createdAt: '2023-03-21T06:30:25.39474+00:00',
|
createdAt: '2023-03-21T06:30:25.39474+00:00',
|
||||||
address: 'San Francisco, CA',
|
address: 'San Francisco, CA',
|
||||||
@ -85,6 +100,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
id: '5c21e19e-e049-4393-8c09-3e3f8fb09ecb',
|
id: '5c21e19e-e049-4393-8c09-3e3f8fb09ecb',
|
||||||
domainName: 'notion.com',
|
domainName: 'notion.com',
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/notion/',
|
linkedinUrl: 'https://www.linkedin.com/company/notion/',
|
||||||
|
xUrl: 'https://twitter.com/notion',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
name: 'Notion',
|
name: 'Notion',
|
||||||
createdAt: '2023-04-26T10:13:29.712485+00:00',
|
createdAt: '2023-04-26T10:13:29.712485+00:00',
|
||||||
address: 'San Francisco, CA',
|
address: 'San Francisco, CA',
|
||||||
|
|||||||
@ -9,10 +9,12 @@ export type FieldType =
|
|||||||
| 'double-text-chip'
|
| 'double-text-chip'
|
||||||
| 'double-text'
|
| 'double-text'
|
||||||
| 'number'
|
| 'number'
|
||||||
|
| 'boolean'
|
||||||
| 'date'
|
| 'date'
|
||||||
| 'phone'
|
| 'phone'
|
||||||
| 'url'
|
| 'url'
|
||||||
| 'probability';
|
| 'probability'
|
||||||
|
| 'moneyAmount';
|
||||||
|
|
||||||
export type FieldTextMetadata = {
|
export type FieldTextMetadata = {
|
||||||
placeHolder: string;
|
placeHolder: string;
|
||||||
|
|||||||
@ -11,7 +11,9 @@ export type ViewFieldType =
|
|||||||
| 'date'
|
| 'date'
|
||||||
| 'phone'
|
| 'phone'
|
||||||
| 'url'
|
| 'url'
|
||||||
| 'probability';
|
| 'probability'
|
||||||
|
| 'boolean'
|
||||||
|
| 'moneyAmount';
|
||||||
|
|
||||||
export type ViewFieldTextMetadata = {
|
export type ViewFieldTextMetadata = {
|
||||||
type: 'text';
|
type: 'text';
|
||||||
@ -42,6 +44,16 @@ export type ViewFieldNumberMetadata = {
|
|||||||
isPositive?: boolean;
|
isPositive?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ViewFieldMoneyMetadata = {
|
||||||
|
type: 'moneyAmount';
|
||||||
|
fieldName: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewFieldBooleanMetadata = {
|
||||||
|
type: 'boolean';
|
||||||
|
fieldName: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type ViewFieldRelationMetadata = {
|
export type ViewFieldRelationMetadata = {
|
||||||
type: 'relation';
|
type: 'relation';
|
||||||
relationType: Entity;
|
relationType: Entity;
|
||||||
@ -89,8 +101,10 @@ export type ViewFieldMetadata = { type: ViewFieldType } & (
|
|||||||
| ViewFieldPhoneMetadata
|
| ViewFieldPhoneMetadata
|
||||||
| ViewFieldURLMetadata
|
| ViewFieldURLMetadata
|
||||||
| ViewFieldNumberMetadata
|
| ViewFieldNumberMetadata
|
||||||
|
| ViewFieldBooleanMetadata
|
||||||
| ViewFieldDateMetadata
|
| ViewFieldDateMetadata
|
||||||
| ViewFieldProbabilityMetadata
|
| ViewFieldProbabilityMetadata
|
||||||
|
| ViewFieldMoneyMetadata
|
||||||
);
|
);
|
||||||
|
|
||||||
export type ViewFieldDefinition<T extends ViewFieldMetadata | unknown> = {
|
export type ViewFieldDefinition<T extends ViewFieldMetadata | unknown> = {
|
||||||
@ -109,6 +123,8 @@ export type ViewFieldTextValue = string;
|
|||||||
export type ViewFieldChipValue = string;
|
export type ViewFieldChipValue = string;
|
||||||
export type ViewFieldDateValue = string;
|
export type ViewFieldDateValue = string;
|
||||||
export type ViewFieldPhoneValue = string;
|
export type ViewFieldPhoneValue = string;
|
||||||
|
export type ViewFieldBooleanValue = boolean;
|
||||||
|
export type ViewFieldMoneyValue = number;
|
||||||
export type ViewFieldURLValue = string;
|
export type ViewFieldURLValue = string;
|
||||||
export type ViewFieldNumberValue = number | null;
|
export type ViewFieldNumberValue = number | null;
|
||||||
export type ViewFieldProbabilityValue = number;
|
export type ViewFieldProbabilityValue = number;
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
import {
|
||||||
|
ViewFieldBooleanMetadata,
|
||||||
|
ViewFieldDefinition,
|
||||||
|
ViewFieldMetadata,
|
||||||
|
} from '../ViewField';
|
||||||
|
|
||||||
|
export function isViewFieldBoolean(
|
||||||
|
field: ViewFieldDefinition<ViewFieldMetadata>,
|
||||||
|
): field is ViewFieldDefinition<ViewFieldBooleanMetadata> {
|
||||||
|
return field.metadata.type === 'boolean';
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { ViewFieldBooleanValue } from '../ViewField';
|
||||||
|
|
||||||
|
export function isViewFieldBooleanValue(
|
||||||
|
fieldValue: unknown,
|
||||||
|
): fieldValue is ViewFieldBooleanValue {
|
||||||
|
return typeof fieldValue === 'boolean';
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import {
|
||||||
|
ViewFieldDefinition,
|
||||||
|
ViewFieldMetadata,
|
||||||
|
ViewFieldMoneyMetadata,
|
||||||
|
} from '../ViewField';
|
||||||
|
|
||||||
|
export function isViewFieldMoney(
|
||||||
|
field: ViewFieldDefinition<ViewFieldMetadata>,
|
||||||
|
): field is ViewFieldDefinition<ViewFieldMoneyMetadata> {
|
||||||
|
return field.metadata.type === 'moneyAmount';
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { ViewFieldMoneyValue } from '../ViewField';
|
||||||
|
|
||||||
|
export function isViewFieldMoneyValue(
|
||||||
|
fieldValue: unknown,
|
||||||
|
): fieldValue is ViewFieldMoneyValue {
|
||||||
|
return typeof fieldValue === 'number';
|
||||||
|
}
|
||||||
@ -45,6 +45,7 @@ export {
|
|||||||
IconMail,
|
IconMail,
|
||||||
IconMap,
|
IconMap,
|
||||||
IconMinus,
|
IconMinus,
|
||||||
|
IconMoneybag,
|
||||||
IconNotes,
|
IconNotes,
|
||||||
IconPencil,
|
IconPencil,
|
||||||
IconPhone,
|
IconPhone,
|
||||||
@ -53,6 +54,7 @@ export {
|
|||||||
IconSearch,
|
IconSearch,
|
||||||
IconSettings,
|
IconSettings,
|
||||||
IconTag,
|
IconTag,
|
||||||
|
IconTarget,
|
||||||
IconTargetArrow,
|
IconTargetArrow,
|
||||||
IconTimelineEvent,
|
IconTimelineEvent,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
import { isViewFieldBoolean } from '@/ui/editable-field/types/guards/isViewFieldBoolean';
|
||||||
import { isViewFieldDate } from '@/ui/editable-field/types/guards/isViewFieldDate';
|
import { isViewFieldDate } from '@/ui/editable-field/types/guards/isViewFieldDate';
|
||||||
import { isViewFieldDoubleText } from '@/ui/editable-field/types/guards/isViewFieldDoubleText';
|
import { isViewFieldDoubleText } from '@/ui/editable-field/types/guards/isViewFieldDoubleText';
|
||||||
import { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
import { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
||||||
|
import { isViewFieldMoney } from '@/ui/editable-field/types/guards/isViewFieldMoney';
|
||||||
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
||||||
import { isViewFieldPhone } from '@/ui/editable-field/types/guards/isViewFieldPhone';
|
import { isViewFieldPhone } from '@/ui/editable-field/types/guards/isViewFieldPhone';
|
||||||
import { isViewFieldRelation } from '@/ui/editable-field/types/guards/isViewFieldRelation';
|
import { isViewFieldRelation } from '@/ui/editable-field/types/guards/isViewFieldRelation';
|
||||||
@ -12,10 +14,12 @@ import {
|
|||||||
} from '@/ui/editable-field/types/ViewField';
|
} from '@/ui/editable-field/types/ViewField';
|
||||||
|
|
||||||
import { isViewFieldChip } from '../../../editable-field/types/guards/isViewFieldChip';
|
import { isViewFieldChip } from '../../../editable-field/types/guards/isViewFieldChip';
|
||||||
|
import { GenericEditableBooleanCell } from '../type/components/GenericEditableBooleanCell';
|
||||||
import { GenericEditableChipCell } from '../type/components/GenericEditableChipCell';
|
import { GenericEditableChipCell } from '../type/components/GenericEditableChipCell';
|
||||||
import { GenericEditableDateCell } from '../type/components/GenericEditableDateCell';
|
import { GenericEditableDateCell } from '../type/components/GenericEditableDateCell';
|
||||||
import { GenericEditableDoubleTextCell } from '../type/components/GenericEditableDoubleTextCell';
|
import { GenericEditableDoubleTextCell } from '../type/components/GenericEditableDoubleTextCell';
|
||||||
import { GenericEditableDoubleTextChipCell } from '../type/components/GenericEditableDoubleTextChipCell';
|
import { GenericEditableDoubleTextChipCell } from '../type/components/GenericEditableDoubleTextChipCell';
|
||||||
|
import { GenericEditableMoneyCell } from '../type/components/GenericEditableMoneyCell';
|
||||||
import { GenericEditableNumberCell } from '../type/components/GenericEditableNumberCell';
|
import { GenericEditableNumberCell } from '../type/components/GenericEditableNumberCell';
|
||||||
import { GenericEditablePhoneCell } from '../type/components/GenericEditablePhoneCell';
|
import { GenericEditablePhoneCell } from '../type/components/GenericEditablePhoneCell';
|
||||||
import { GenericEditableRelationCell } from '../type/components/GenericEditableRelationCell';
|
import { GenericEditableRelationCell } from '../type/components/GenericEditableRelationCell';
|
||||||
@ -43,8 +47,12 @@ export function GenericEditableCell({ viewField: fieldDefinition }: OwnProps) {
|
|||||||
return <GenericEditableDateCell viewField={fieldDefinition} />;
|
return <GenericEditableDateCell viewField={fieldDefinition} />;
|
||||||
} else if (isViewFieldNumber(fieldDefinition)) {
|
} else if (isViewFieldNumber(fieldDefinition)) {
|
||||||
return <GenericEditableNumberCell viewField={fieldDefinition} />;
|
return <GenericEditableNumberCell viewField={fieldDefinition} />;
|
||||||
|
} else if (isViewFieldBoolean(fieldDefinition)) {
|
||||||
|
return <GenericEditableBooleanCell viewField={fieldDefinition} />;
|
||||||
} else if (isViewFieldChip(fieldDefinition)) {
|
} else if (isViewFieldChip(fieldDefinition)) {
|
||||||
return <GenericEditableChipCell viewField={fieldDefinition} />;
|
return <GenericEditableChipCell viewField={fieldDefinition} />;
|
||||||
|
} else if (isViewFieldMoney(fieldDefinition)) {
|
||||||
|
return <GenericEditableMoneyCell viewField={fieldDefinition} />;
|
||||||
} else {
|
} else {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Unknown field metadata type: ${fieldDefinition.metadata.type} in GenericEditableCell`,
|
`Unknown field metadata type: ${fieldDefinition.metadata.type} in GenericEditableCell`,
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
|
import { IconCheck, IconX } from '@tabler/icons-react';
|
||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ViewFieldBooleanMetadata,
|
||||||
|
ViewFieldDefinition,
|
||||||
|
} from '@/ui/editable-field/types/ViewField';
|
||||||
|
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
|
||||||
|
import { useUpdateEntityField } from '@/ui/table/hooks/useUpdateEntityField';
|
||||||
|
import { tableEntityFieldFamilySelector } from '@/ui/table/states/selectors/tableEntityFieldFamilySelector';
|
||||||
|
|
||||||
|
import { EditableCellDisplayContainer } from '../../components/EditableCellContainer';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
viewField: ViewFieldDefinition<ViewFieldBooleanMetadata>;
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledCellBaseContainer = styled.div`
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
height: ${({ theme }) => theme.spacing(8)};
|
||||||
|
position: relative;
|
||||||
|
user-select: none;
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledCellBooleancontainer = styled.div`
|
||||||
|
margin-left: 5px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
function capitalizeFirstLetter(value: string) {
|
||||||
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GenericEditableBooleanCell({ viewField }: OwnProps) {
|
||||||
|
const currentRowEntityId = useCurrentRowEntityId();
|
||||||
|
|
||||||
|
const [fieldValue, setFieldValue] = useRecoilState<boolean>(
|
||||||
|
tableEntityFieldFamilySelector({
|
||||||
|
entityId: currentRowEntityId ?? '',
|
||||||
|
fieldName: viewField.metadata.fieldName,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const updateField = useUpdateEntityField();
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
const newValue = !fieldValue;
|
||||||
|
try {
|
||||||
|
setFieldValue(newValue);
|
||||||
|
|
||||||
|
if (currentRowEntityId && updateField) {
|
||||||
|
updateField(currentRowEntityId, viewField, newValue);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(
|
||||||
|
`In GenericEditableBooleanCellEditMode, Invalid value: ${newValue}, ${error}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledCellBaseContainer>
|
||||||
|
<EditableCellDisplayContainer onClick={handleClick}>
|
||||||
|
{fieldValue ? <IconCheck /> : <IconX />}
|
||||||
|
<StyledCellBooleancontainer>
|
||||||
|
{fieldValue !== undefined &&
|
||||||
|
capitalizeFirstLetter(fieldValue.toString())}
|
||||||
|
</StyledCellBooleancontainer>
|
||||||
|
</EditableCellDisplayContainer>
|
||||||
|
</StyledCellBaseContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ViewFieldDefinition,
|
||||||
|
ViewFieldMoneyMetadata,
|
||||||
|
} from '@/ui/editable-field/types/ViewField';
|
||||||
|
import { EditableCell } from '@/ui/table/editable-cell/components/EditableCell';
|
||||||
|
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
|
||||||
|
import { tableEntityFieldFamilySelector } from '@/ui/table/states/selectors/tableEntityFieldFamilySelector';
|
||||||
|
|
||||||
|
import { GenericEditableMoneyCellEditMode } from './GenericEditableMoneyCellEditMode';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
viewField: ViewFieldDefinition<ViewFieldMoneyMetadata>;
|
||||||
|
editModeHorizontalAlign?: 'left' | 'right';
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatNumber(value: number) {
|
||||||
|
// Formats the value to a string and add commas to it ex: 50,000 | 500,000
|
||||||
|
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GenericEditableMoneyCell({
|
||||||
|
viewField,
|
||||||
|
editModeHorizontalAlign,
|
||||||
|
}: OwnProps) {
|
||||||
|
const currentRowEntityId = useCurrentRowEntityId();
|
||||||
|
|
||||||
|
const fieldValue = useRecoilValue<number>(
|
||||||
|
tableEntityFieldFamilySelector({
|
||||||
|
entityId: currentRowEntityId ?? '',
|
||||||
|
fieldName: viewField.metadata.fieldName,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EditableCell
|
||||||
|
editModeHorizontalAlign={editModeHorizontalAlign}
|
||||||
|
editModeContent={
|
||||||
|
<GenericEditableMoneyCellEditMode viewField={viewField} />
|
||||||
|
}
|
||||||
|
nonEditModeContent={
|
||||||
|
<>{fieldValue ? `$${formatNumber(fieldValue)}` : ''}</>
|
||||||
|
}
|
||||||
|
></EditableCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ViewFieldDefinition,
|
||||||
|
ViewFieldMoneyMetadata,
|
||||||
|
} from '@/ui/editable-field/types/ViewField';
|
||||||
|
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
|
||||||
|
import { useUpdateEntityField } from '@/ui/table/hooks/useUpdateEntityField';
|
||||||
|
import { tableEntityFieldFamilySelector } from '@/ui/table/states/selectors/tableEntityFieldFamilySelector';
|
||||||
|
|
||||||
|
import { TextCellEdit } from './TextCellEdit';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
viewField: ViewFieldDefinition<ViewFieldMoneyMetadata>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function GenericEditableMoneyCellEditMode({ viewField }: OwnProps) {
|
||||||
|
const currentRowEntityId = useCurrentRowEntityId();
|
||||||
|
|
||||||
|
const [fieldValue, setFieldValue] = useRecoilState<string>(
|
||||||
|
tableEntityFieldFamilySelector({
|
||||||
|
entityId: currentRowEntityId ?? '',
|
||||||
|
fieldName: viewField.metadata.fieldName,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const updateField = useUpdateEntityField();
|
||||||
|
|
||||||
|
function handleSubmit(newText: string) {
|
||||||
|
if (newText === fieldValue) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const numberValue = parseInt(newText);
|
||||||
|
|
||||||
|
if (isNaN(numberValue)) {
|
||||||
|
throw new Error('Not a number');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numberValue > 2000000000) {
|
||||||
|
throw new Error('Number too big');
|
||||||
|
}
|
||||||
|
|
||||||
|
setFieldValue(numberValue.toString());
|
||||||
|
|
||||||
|
if (currentRowEntityId && updateField) {
|
||||||
|
updateField(currentRowEntityId, viewField, numberValue);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(
|
||||||
|
`In GenericEditableMoneyCellEditMode, Invalid number: ${newText}, ${error}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TextCellEdit autoFocus value={fieldValue ?? ''} onSubmit={handleSubmit} />
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
|
|
||||||
|
import { isViewFieldBoolean } from '@/ui/editable-field/types/guards/isViewFieldBoolean';
|
||||||
|
import { isViewFieldBooleanValue } from '@/ui/editable-field/types/guards/isViewFieldBooleanValue';
|
||||||
import { isViewFieldChip } from '@/ui/editable-field/types/guards/isViewFieldChip';
|
import { isViewFieldChip } from '@/ui/editable-field/types/guards/isViewFieldChip';
|
||||||
import { isViewFieldDate } from '@/ui/editable-field/types/guards/isViewFieldDate';
|
import { isViewFieldDate } from '@/ui/editable-field/types/guards/isViewFieldDate';
|
||||||
import { isViewFieldDateValue } from '@/ui/editable-field/types/guards/isViewFieldDateValue';
|
import { isViewFieldDateValue } from '@/ui/editable-field/types/guards/isViewFieldDateValue';
|
||||||
@ -7,6 +9,8 @@ import { isViewFieldDoubleText } from '@/ui/editable-field/types/guards/isViewFi
|
|||||||
import { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
import { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
||||||
import { isViewFieldDoubleTextChipValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChipValue';
|
import { isViewFieldDoubleTextChipValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChipValue';
|
||||||
import { isViewFieldDoubleTextValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextValue';
|
import { isViewFieldDoubleTextValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextValue';
|
||||||
|
import { isViewFieldMoney } from '@/ui/editable-field/types/guards/isViewFieldMoney';
|
||||||
|
import { isViewFieldMoneyValue } from '@/ui/editable-field/types/guards/isViewFieldMoneyValue';
|
||||||
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
||||||
import { isViewFieldNumberValue } from '@/ui/editable-field/types/guards/isViewFieldNumberValue';
|
import { isViewFieldNumberValue } from '@/ui/editable-field/types/guards/isViewFieldNumberValue';
|
||||||
import { isViewFieldPhone } from '@/ui/editable-field/types/guards/isViewFieldPhone';
|
import { isViewFieldPhone } from '@/ui/editable-field/types/guards/isViewFieldPhone';
|
||||||
@ -202,6 +206,32 @@ export function useUpdateEntityField() {
|
|||||||
) {
|
) {
|
||||||
const newContent = newFieldValueUnknown;
|
const newContent = newFieldValueUnknown;
|
||||||
|
|
||||||
|
updateEntity({
|
||||||
|
variables: {
|
||||||
|
where: { id: currentEntityId },
|
||||||
|
data: { [viewField.metadata.fieldName]: newContent },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Boolean
|
||||||
|
} else if (
|
||||||
|
isViewFieldBoolean(viewField) &&
|
||||||
|
isViewFieldBooleanValue(newFieldValueUnknown)
|
||||||
|
) {
|
||||||
|
const newContent = newFieldValueUnknown;
|
||||||
|
|
||||||
|
updateEntity({
|
||||||
|
variables: {
|
||||||
|
where: { id: currentEntityId },
|
||||||
|
data: { [viewField.metadata.fieldName]: newContent },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Money
|
||||||
|
} else if (
|
||||||
|
isViewFieldMoney(viewField) &&
|
||||||
|
isViewFieldMoneyValue(newFieldValueUnknown)
|
||||||
|
) {
|
||||||
|
const newContent = newFieldValueUnknown;
|
||||||
|
|
||||||
updateEntity({
|
updateEntity({
|
||||||
variables: {
|
variables: {
|
||||||
where: { id: currentEntityId },
|
where: { id: currentEntityId },
|
||||||
|
|||||||
@ -11,6 +11,9 @@ type MockedCompany = Pick<
|
|||||||
| 'address'
|
| 'address'
|
||||||
| 'employees'
|
| 'employees'
|
||||||
| 'linkedinUrl'
|
| 'linkedinUrl'
|
||||||
|
| 'xUrl'
|
||||||
|
| 'annualRecurringRevenue'
|
||||||
|
| 'idealCustomerProfile'
|
||||||
| '_activityCount'
|
| '_activityCount'
|
||||||
> & {
|
> & {
|
||||||
accountOwner: Pick<
|
accountOwner: Pick<
|
||||||
@ -34,6 +37,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '17 rue de clignancourt',
|
address: '17 rue de clignancourt',
|
||||||
employees: 12,
|
employees: 12,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/airbnb/',
|
linkedinUrl: 'https://www.linkedin.com/company/airbnb/',
|
||||||
|
xUrl: 'https://twitter.com/airbnb',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
_activityCount: 1,
|
_activityCount: 1,
|
||||||
accountOwner: {
|
accountOwner: {
|
||||||
email: 'charles@test.com',
|
email: 'charles@test.com',
|
||||||
@ -54,6 +60,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '',
|
address: '',
|
||||||
employees: 1,
|
employees: 1,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/aircall/',
|
linkedinUrl: 'https://www.linkedin.com/company/aircall/',
|
||||||
|
xUrl: 'https://twitter.com/aircall',
|
||||||
|
annualRecurringRevenue: 50000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
_activityCount: 1,
|
_activityCount: 1,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
@ -66,6 +75,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '',
|
address: '',
|
||||||
employees: 1,
|
employees: 1,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/algolia/',
|
linkedinUrl: 'https://www.linkedin.com/company/algolia/',
|
||||||
|
xUrl: 'https://twitter.com/algolia',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
_activityCount: 1,
|
_activityCount: 1,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
@ -78,6 +90,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '',
|
address: '',
|
||||||
employees: 10,
|
employees: 10,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/apple/',
|
linkedinUrl: 'https://www.linkedin.com/company/apple/',
|
||||||
|
xUrl: 'https://twitter.com/apple',
|
||||||
|
annualRecurringRevenue: 5000000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
_activityCount: 0,
|
_activityCount: 0,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
@ -90,6 +105,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '10 rue de la Paix',
|
address: '10 rue de la Paix',
|
||||||
employees: 1,
|
employees: 1,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/qonto/',
|
linkedinUrl: 'https://www.linkedin.com/company/qonto/',
|
||||||
|
xUrl: 'https://twitter.com/qonto',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: false,
|
||||||
_activityCount: 2,
|
_activityCount: 2,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
@ -102,6 +120,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '',
|
address: '',
|
||||||
employees: 1,
|
employees: 1,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/facebook/',
|
linkedinUrl: 'https://www.linkedin.com/company/facebook/',
|
||||||
|
xUrl: 'https://twitter.com/facebook',
|
||||||
|
annualRecurringRevenue: 5000000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
_activityCount: 13,
|
_activityCount: 13,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
@ -114,6 +135,9 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
|||||||
address: '',
|
address: '',
|
||||||
employees: 1,
|
employees: 1,
|
||||||
linkedinUrl: 'https://www.linkedin.com/company/sequoia/',
|
linkedinUrl: 'https://www.linkedin.com/company/sequoia/',
|
||||||
|
xUrl: 'https://twitter.com/sequoia',
|
||||||
|
annualRecurringRevenue: 500000,
|
||||||
|
idealCustomerProfile: true,
|
||||||
_activityCount: 1,
|
_activityCount: 1,
|
||||||
accountOwner: null,
|
accountOwner: null,
|
||||||
__typename: 'Company',
|
__typename: 'Company',
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "companies" ADD COLUMN "annualRecurringRevenue" INTEGER,
|
||||||
|
ADD COLUMN "idealCustomerProfile" BOOLEAN DEFAULT false,
|
||||||
|
ADD COLUMN "xUrl" TEXT;
|
||||||
@ -226,6 +226,15 @@ model Company {
|
|||||||
/// @Validator.IsString()
|
/// @Validator.IsString()
|
||||||
/// @Validator.IsOptional()
|
/// @Validator.IsOptional()
|
||||||
linkedinUrl String?
|
linkedinUrl String?
|
||||||
|
/// @Validator.IsNumber()
|
||||||
|
/// @Validator.IsOptional()
|
||||||
|
annualRecurringRevenue Int?
|
||||||
|
/// @Validator.IsBoolean()
|
||||||
|
/// @Validator.IsOptional()
|
||||||
|
idealCustomerProfile Boolean @default(false)
|
||||||
|
/// @Validator.IsString()
|
||||||
|
/// @Validator.IsOptional()
|
||||||
|
xUrl String?
|
||||||
/// @Validator.IsString()
|
/// @Validator.IsString()
|
||||||
/// @Validator.IsOptional()
|
/// @Validator.IsOptional()
|
||||||
address String
|
address String
|
||||||
|
|||||||
Reference in New Issue
Block a user