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>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
|
import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
|
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
|
|
|
export const getLinkToShowPage = (
|
|
objectNameSingular: string,
|
|
record: Partial<ObjectRecord>,
|
|
) => {
|
|
const basePathToShowPage = getBasePathToShowPage({
|
|
objectNameSingular,
|
|
});
|
|
|
|
const isWorkspaceMemberObjectMetadata =
|
|
objectNameSingular === CoreObjectNameSingular.WorkspaceMember;
|
|
|
|
if (objectNameSingular === CoreObjectNameSingular.NoteTarget) {
|
|
return (
|
|
getBasePathToShowPage({
|
|
objectNameSingular: CoreObjectNameSingular.Note,
|
|
}) + record.note?.id
|
|
);
|
|
}
|
|
|
|
if (objectNameSingular === CoreObjectNameSingular.TaskTarget) {
|
|
return (
|
|
getBasePathToShowPage({
|
|
objectNameSingular: CoreObjectNameSingular.Task,
|
|
}) + record.task?.id
|
|
);
|
|
}
|
|
|
|
const linkToShowPage =
|
|
isWorkspaceMemberObjectMetadata || !record.id
|
|
? ''
|
|
: `${basePathToShowPage}${record.id}`;
|
|
|
|
return linkToShowPage;
|
|
};
|