Disable activities creation for custom objects
This commit is contained in:
@ -47,7 +47,8 @@ export const ActivityBodyEditor = ({
|
||||
}, [updateOneObject, activity.id]);
|
||||
|
||||
const editor: BlockNoteEditor | null = useBlockNote({
|
||||
initialContent: activity.body ? JSON.parse(activity.body) : undefined,
|
||||
initialContent:
|
||||
activity.body !== '{}' ? JSON.parse(activity.body) : undefined,
|
||||
editorDOMAttributes: { class: 'editor' },
|
||||
onEditorContentChange: (editor) => {
|
||||
debounceOnChange(JSON.stringify(editor.topLevelBlocks) ?? '');
|
||||
|
||||
@ -49,7 +49,7 @@ export const Notes = ({ entity }: { entity: ActivityTargetableEntity }) => {
|
||||
|
||||
const openCreateActivity = useOpenCreateActivityDrawer();
|
||||
|
||||
if (notes?.length === 0) {
|
||||
if (notes?.length === 0 && entity.type !== 'Custom') {
|
||||
return (
|
||||
<StyledTaskGroupEmptyContainer>
|
||||
<StyledEmptyTaskGroupTitle>No note yet</StyledEmptyTaskGroupTitle>
|
||||
|
||||
@ -66,6 +66,10 @@ export const TaskGroups = ({ entity, showAddButton }: TaskGroupsProps) => {
|
||||
TasksRecoilScopeContext,
|
||||
);
|
||||
|
||||
if (entity?.type === 'Custom') {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (
|
||||
(activeTabId !== 'done' &&
|
||||
todayOrPreviousTasks?.length === 0 &&
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
|
||||
import { ActivityTargetChips } from '@/activities/components/ActivityTargetChips';
|
||||
import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
|
||||
@ -72,8 +71,7 @@ export const TaskRow = ({
|
||||
const theme = useTheme();
|
||||
const openActivityRightDrawer = useOpenActivityRightDrawer();
|
||||
|
||||
const body = JSON.parse(isNonEmptyString(task.body) ? task.body : '{}')[0]
|
||||
?.content[0]?.text;
|
||||
const body = JSON.parse(task.body)[0]?.content[0]?.text;
|
||||
const { completeTask } = useCompleteTask(task);
|
||||
|
||||
const activityTargetIds =
|
||||
|
||||
@ -70,7 +70,7 @@ export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
|
||||
|
||||
const openCreateActivity = useOpenCreateActivityDrawer();
|
||||
|
||||
if (loading) {
|
||||
if (loading || entity.type === 'Custom') {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export type ActivityTargetableEntityType = 'Person' | 'Company';
|
||||
export type ActivityTargetableEntityType = 'Person' | 'Company' | 'Custom';
|
||||
|
||||
export type ActivityTargetableEntity = {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user