Activity as standard object (#6219)
In this PR I layout the first steps to migrate Activity to a traditional Standard objects Since this is a big transition, I'd rather split it into several deployments / PRs <img width="1512" alt="image" src="https://github.com/user-attachments/assets/012e2bbf-9d1b-4723-aaf6-269ef588b050"> --------- Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Co-authored-by: Weiko <corentin@twenty.com> Co-authored-by: Faisal-imtiyaz123 <142205282+Faisal-imtiyaz123@users.noreply.github.com> Co-authored-by: Prateek Jain <prateekj1171998@gmail.com>
This commit is contained in:
@ -3,9 +3,7 @@ import { AvatarChip, AvatarChipVariant } from 'twenty-ui';
|
||||
import { getLinkToShowPage } from '@/object-metadata/utils/getLinkToShowPage';
|
||||
import { useRecordChipData } from '@/object-record/hooks/useRecordChipData';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { MouseEvent } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink';
|
||||
|
||||
export type RecordChipProps = {
|
||||
objectNameSingular: string;
|
||||
@ -20,31 +18,22 @@ export const RecordChip = ({
|
||||
className,
|
||||
variant,
|
||||
}: RecordChipProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { recordChipData } = useRecordChipData({
|
||||
objectNameSingular,
|
||||
record,
|
||||
});
|
||||
|
||||
const handleAvatarChipClick = (event: MouseEvent) => {
|
||||
const linkToShowPage = getLinkToShowPage(objectNameSingular, record);
|
||||
|
||||
if (isNonEmptyString(linkToShowPage)) {
|
||||
event.stopPropagation();
|
||||
navigate(linkToShowPage);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<AvatarChip
|
||||
placeholderColorSeed={record.id}
|
||||
name={recordChipData.name}
|
||||
avatarType={recordChipData.avatarType}
|
||||
avatarUrl={recordChipData.avatarUrl ?? ''}
|
||||
onClick={handleAvatarChipClick}
|
||||
className={className}
|
||||
variant={variant}
|
||||
/>
|
||||
<UndecoratedLink to={getLinkToShowPage(objectNameSingular, record)}>
|
||||
<AvatarChip
|
||||
placeholderColorSeed={record.id}
|
||||
name={recordChipData.name}
|
||||
avatarType={recordChipData.avatarType}
|
||||
avatarUrl={recordChipData.avatarUrl ?? ''}
|
||||
className={className}
|
||||
variant={variant}
|
||||
onClick={() => {}}
|
||||
/>
|
||||
</UndecoratedLink>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user