Feat/activities custom objects (#3213)
* WIP * WIP - MultiObjectSearch * WIP * WIP * Finished working version * Fix * Fixed and cleaned * Fix * Disabled files and emails for custom objects * Cleaned console.log * Fixed attachment * Fixed * fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { EntityChip } from '@/ui/display/chip/components/EntityChip';
|
||||
|
||||
export type RecordChipProps = {
|
||||
objectNameSingular: string;
|
||||
record: ObjectRecord;
|
||||
};
|
||||
|
||||
export const RecordChip = ({ objectNameSingular, record }: RecordChipProps) => {
|
||||
const { mapToObjectRecordIdentifier } = useObjectMetadataItem({
|
||||
objectNameSingular,
|
||||
});
|
||||
|
||||
const objectRecordIdentifier = mapToObjectRecordIdentifier(record);
|
||||
|
||||
return (
|
||||
<EntityChip
|
||||
entityId={record.id}
|
||||
name={objectRecordIdentifier.name}
|
||||
avatarType={objectRecordIdentifier.avatarType}
|
||||
avatarUrl={objectRecordIdentifier.avatarUrl ?? undefined}
|
||||
linkToEntity={objectRecordIdentifier.linkToShowPage}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -77,13 +77,6 @@ export const RecordShowPage = () => {
|
||||
objectNameSingular,
|
||||
});
|
||||
|
||||
const objectMetadataType =
|
||||
objectMetadataItem?.nameSingular === 'company'
|
||||
? 'Company'
|
||||
: objectMetadataItem?.nameSingular === 'person'
|
||||
? 'Person'
|
||||
: 'Custom';
|
||||
|
||||
const useUpdateOneObjectRecordMutation: RecordUpdateHook = () => {
|
||||
const updateEntity = ({ variables }: RecordUpdateHookParams) => {
|
||||
updateOneRecord?.({
|
||||
@ -171,7 +164,7 @@ export const RecordShowPage = () => {
|
||||
hasBackButton
|
||||
Icon={IconBuildingSkyscraper}
|
||||
>
|
||||
{record && objectMetadataType !== 'Custom' && (
|
||||
{record && (
|
||||
<>
|
||||
<PageFavoriteButton
|
||||
isFavorite={isFavorite}
|
||||
@ -181,7 +174,7 @@ export const RecordShowPage = () => {
|
||||
key="add"
|
||||
entity={{
|
||||
id: record.id,
|
||||
type: objectMetadataType,
|
||||
targetObjectNameSingular: objectMetadataItem?.nameSingular,
|
||||
}}
|
||||
/>
|
||||
<ShowPageMoreButton
|
||||
@ -275,15 +268,9 @@ export const RecordShowPage = () => {
|
||||
)}
|
||||
</ShowPageLeftContainer>
|
||||
<ShowPageRightContainer
|
||||
entity={{
|
||||
id: record?.id || '',
|
||||
// TODO: refacto
|
||||
type:
|
||||
objectMetadataItem?.nameSingular === 'company'
|
||||
? 'Company'
|
||||
: objectMetadataItem?.nameSingular === 'person'
|
||||
? 'Person'
|
||||
: 'Custom',
|
||||
targetableObject={{
|
||||
id: record?.id ?? '',
|
||||
targetObjectNameSingular: objectMetadataItem?.nameSingular,
|
||||
}}
|
||||
timeline
|
||||
tasks
|
||||
|
||||
Reference in New Issue
Block a user