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;
|
||||
|
||||
@ -238,7 +238,7 @@ export const RecordShowPage = () => {
|
||||
? 'Company'
|
||||
: objectMetadataItem?.nameSingular === 'person'
|
||||
? 'Person'
|
||||
: 'Person',
|
||||
: 'Custom',
|
||||
}}
|
||||
timeline
|
||||
tasks
|
||||
|
||||
@ -5,13 +5,7 @@ import { useRecoilCallback, useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
import { useFavorites } from '@/favorites/hooks/useFavorites';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { useDeleteOneObjectRecord } from '@/object-record/hooks/useDeleteOneObjectRecord';
|
||||
import {
|
||||
IconCheckbox,
|
||||
IconHeart,
|
||||
IconHeartOff,
|
||||
IconNotes,
|
||||
IconTrash,
|
||||
} from '@/ui/display/icon';
|
||||
import { IconHeart, IconHeartOff, IconTrash } from '@/ui/display/icon';
|
||||
import { actionBarEntriesState } from '@/ui/navigation/action-bar/states/actionBarEntriesState';
|
||||
import { contextMenuEntriesState } from '@/ui/navigation/context-menu/states/contextMenuEntriesState';
|
||||
import { useRecordTable } from '@/ui/object/record-table/hooks/useRecordTable';
|
||||
@ -91,16 +85,16 @@ export const useRecordTableContextMenuEntries = () => {
|
||||
!!favorites?.find((favorite) => favorite.recordId === selectedRowId);
|
||||
|
||||
const contextMenuEntries = [
|
||||
{
|
||||
label: 'New task',
|
||||
Icon: IconCheckbox,
|
||||
onClick: () => {},
|
||||
},
|
||||
{
|
||||
label: 'New note',
|
||||
Icon: IconNotes,
|
||||
onClick: () => {},
|
||||
},
|
||||
// {
|
||||
// label: 'New task',
|
||||
// Icon: IconCheckbox,
|
||||
// onClick: () => {},
|
||||
// },
|
||||
// {
|
||||
// label: 'New note',
|
||||
// Icon: IconNotes,
|
||||
// onClick: () => {},
|
||||
// },
|
||||
{
|
||||
label: isFavorite ? 'Remove from favorites' : 'Add to favorites',
|
||||
Icon: isFavorite ? IconHeartOff : IconHeart,
|
||||
@ -129,16 +123,16 @@ export const useRecordTableContextMenuEntries = () => {
|
||||
|
||||
setActionBarEntries: useRecoilCallback(() => () => {
|
||||
setActionBarEntriesState([
|
||||
{
|
||||
label: 'Task',
|
||||
Icon: IconCheckbox,
|
||||
onClick: () => {},
|
||||
},
|
||||
{
|
||||
label: 'Note',
|
||||
Icon: IconNotes,
|
||||
onClick: () => {},
|
||||
},
|
||||
// {
|
||||
// label: 'Task',
|
||||
// Icon: IconCheckbox,
|
||||
// onClick: () => {},
|
||||
// },
|
||||
// {
|
||||
// label: 'Note',
|
||||
// Icon: IconNotes,
|
||||
// onClick: () => {},
|
||||
// },
|
||||
{
|
||||
label: 'Delete',
|
||||
Icon: IconTrash,
|
||||
|
||||
@ -56,18 +56,21 @@ export const ShowPageRightContainer = ({
|
||||
title: 'Timeline',
|
||||
Icon: IconTimelineEvent,
|
||||
hide: !timeline,
|
||||
disabled: entity.type === 'Custom',
|
||||
},
|
||||
{
|
||||
id: 'tasks',
|
||||
title: 'Tasks',
|
||||
Icon: IconCheckbox,
|
||||
hide: !tasks,
|
||||
disabled: entity.type === 'Custom',
|
||||
},
|
||||
{
|
||||
id: 'notes',
|
||||
title: 'Notes',
|
||||
Icon: IconNotes,
|
||||
hide: !notes,
|
||||
disabled: entity.type === 'Custom',
|
||||
},
|
||||
{
|
||||
id: 'emails',
|
||||
|
||||
@ -198,6 +198,7 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
FieldMetadataType.Currency,
|
||||
FieldMetadataType.Email,
|
||||
FieldMetadataType.Enum,
|
||||
FieldMetadataType.Numeric,
|
||||
FieldMetadataType.FullName,
|
||||
FieldMetadataType.Link,
|
||||
FieldMetadataType.Phone,
|
||||
|
||||
Reference in New Issue
Block a user