mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-27 11:03:40 +03:00
Replace all hardcoded core object name by enum (#3170)
* Replace hardcoded core object name by enum Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com> * Fix typo Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com> * Fixed duplicate import --------- Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
parent
c422045ea6
commit
fd607789f4
@ -11,6 +11,7 @@ import { BlockEditor } from '@/ui/input/editor/components/BlockEditor';
|
|||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
|
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledBlockNoteStyledContainer = styled.div`
|
const StyledBlockNoteStyledContainer = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -27,7 +28,7 @@ export const ActivityBodyEditor = ({
|
|||||||
}: ActivityBodyEditorProps) => {
|
}: ActivityBodyEditorProps) => {
|
||||||
const [body, setBody] = useState<string | null>(null);
|
const [body, setBody] = useState<string | null>(null);
|
||||||
const { updateOneRecord } = useUpdateOneRecord({
|
const { updateOneRecord } = useUpdateOneRecord({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
AutosizeTextInputVariant,
|
AutosizeTextInputVariant,
|
||||||
} from '@/ui/input/components/AutosizeTextInput';
|
} from '@/ui/input/components/AutosizeTextInput';
|
||||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledThreadItemListContainer = styled.div`
|
const StyledThreadItemListContainer = styled.div`
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@ -61,13 +62,13 @@ export const ActivityComments = ({
|
|||||||
scrollableContainerRef,
|
scrollableContainerRef,
|
||||||
}: ActivityCommentsProps) => {
|
}: ActivityCommentsProps) => {
|
||||||
const { createOneRecord: createOneComment } = useCreateOneRecord({
|
const { createOneRecord: createOneComment } = useCreateOneRecord({
|
||||||
objectNameSingular: 'comment',
|
objectNameSingular: CoreObjectNameSingular.Comment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
||||||
|
|
||||||
const { records: comments } = useFindManyRecords({
|
const { records: comments } = useFindManyRecords({
|
||||||
objectNameSingular: 'comment',
|
objectNameSingular: CoreObjectNameSingular.Comment,
|
||||||
filter: {
|
filter: {
|
||||||
activityId: {
|
activityId: {
|
||||||
eq: activity?.id ?? '',
|
eq: activity?.id ?? '',
|
||||||
|
@ -9,6 +9,7 @@ import { Activity } from '@/activities/types/Activity';
|
|||||||
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
||||||
import { Comment } from '@/activities/types/Comment';
|
import { Comment } from '@/activities/types/Comment';
|
||||||
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
|
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
|
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
|
||||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||||
import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
|
import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
|
||||||
@ -81,11 +82,11 @@ export const ActivityEditor = ({
|
|||||||
|
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
|
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { FieldContextProvider: DueAtFieldContextProvider } = useFieldContext({
|
const { FieldContextProvider: DueAtFieldContextProvider } = useFieldContext({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
objectRecordId: activity.id,
|
objectRecordId: activity.id,
|
||||||
fieldMetadataName: 'dueAt',
|
fieldMetadataName: 'dueAt',
|
||||||
fieldPosition: 0,
|
fieldPosition: 0,
|
||||||
@ -93,7 +94,7 @@ export const ActivityEditor = ({
|
|||||||
|
|
||||||
const { FieldContextProvider: AssigneeFieldContextProvider } =
|
const { FieldContextProvider: AssigneeFieldContextProvider } =
|
||||||
useFieldContext({
|
useFieldContext({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
objectRecordId: activity.id,
|
objectRecordId: activity.id,
|
||||||
fieldMetadataName: 'assignee',
|
fieldMetadataName: 'assignee',
|
||||||
fieldPosition: 1,
|
fieldPosition: 1,
|
||||||
|
@ -14,6 +14,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
|||||||
import { IconCalendar } from '@/ui/display/icon';
|
import { IconCalendar } from '@/ui/display/icon';
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
import { formatToHumanReadableDate } from '~/utils';
|
import { formatToHumanReadableDate } from '~/utils';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledRow = styled.div`
|
const StyledRow = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -63,7 +64,7 @@ export const AttachmentRow = ({ attachment }: { attachment: Attachment }) => {
|
|||||||
|
|
||||||
const { deleteOneRecord: deleteOneAttachment } =
|
const { deleteOneRecord: deleteOneAttachment } =
|
||||||
useDeleteOneRecord<Attachment>({
|
useDeleteOneRecord<Attachment>({
|
||||||
objectNameSingular: 'attachment',
|
objectNameSingular: CoreObjectNameSingular.Attachment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
|
@ -12,6 +12,7 @@ import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
|||||||
import { IconPlus } from '@/ui/display/icon';
|
import { IconPlus } from '@/ui/display/icon';
|
||||||
import { Button } from '@/ui/input/button/components/Button';
|
import { Button } from '@/ui/input/button/components/Button';
|
||||||
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
|
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledTaskGroupEmptyContainer = styled.div`
|
const StyledTaskGroupEmptyContainer = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -67,7 +68,7 @@ export const Attachments = ({
|
|||||||
|
|
||||||
const { createOneRecord: createOneAttachment } =
|
const { createOneRecord: createOneAttachment } =
|
||||||
useCreateOneRecord<Attachment>({
|
useCreateOneRecord<Attachment>({
|
||||||
objectNameSingular: 'attachment',
|
objectNameSingular: CoreObjectNameSingular.Attachment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
|
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
@ -2,11 +2,12 @@ import { Attachment } from '@/activities/files/types/Attachment';
|
|||||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||||
|
|
||||||
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
|
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
// do we need to test this?
|
// do we need to test this?
|
||||||
export const useAttachments = (entity: ActivityTargetableEntity) => {
|
export const useAttachments = (entity: ActivityTargetableEntity) => {
|
||||||
const { records: attachments } = useFindManyRecords({
|
const { records: attachments } = useFindManyRecords({
|
||||||
objectNameSingular: 'attachment',
|
objectNameSingular: CoreObjectNameSingular.Attachment,
|
||||||
filter: {
|
filter: {
|
||||||
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||||
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
||||||
|
|
||||||
@ -11,10 +12,10 @@ export const useHandleCheckableActivityTargetChange = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { createOneRecord: createOneActivityTarget } =
|
const { createOneRecord: createOneActivityTarget } =
|
||||||
useCreateOneRecord<ActivityTarget>({
|
useCreateOneRecord<ActivityTarget>({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
});
|
});
|
||||||
const { deleteOneRecord: deleteOneActivityTarget } = useDeleteOneRecord({
|
const { deleteOneRecord: deleteOneActivityTarget } = useDeleteOneRecord({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
});
|
});
|
||||||
|
|
||||||
return async (
|
return async (
|
||||||
|
@ -15,15 +15,16 @@ import { activityTargetableEntityArrayState } from '../states/activityTargetable
|
|||||||
import { viewableActivityIdState } from '../states/viewableActivityIdState';
|
import { viewableActivityIdState } from '../states/viewableActivityIdState';
|
||||||
import { ActivityTargetableEntity } from '../types/ActivityTargetableEntity';
|
import { ActivityTargetableEntity } from '../types/ActivityTargetableEntity';
|
||||||
import { getTargetableEntitiesWithParents } from '../utils/getTargetableEntitiesWithParents';
|
import { getTargetableEntitiesWithParents } from '../utils/getTargetableEntitiesWithParents';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useOpenCreateActivityDrawer = () => {
|
export const useOpenCreateActivityDrawer = () => {
|
||||||
const { openRightDrawer } = useRightDrawer();
|
const { openRightDrawer } = useRightDrawer();
|
||||||
const { createOneRecord: createOneActivityTarget } =
|
const { createOneRecord: createOneActivityTarget } =
|
||||||
useCreateOneRecord<ActivityTarget>({
|
useCreateOneRecord<ActivityTarget>({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
});
|
});
|
||||||
const { createOneRecord: createOneActivity } = useCreateOneRecord<Activity>({
|
const { createOneRecord: createOneActivity } = useCreateOneRecord<Activity>({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
});
|
});
|
||||||
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
||||||
const setHotkeyScope = useSetHotkeyScope();
|
const setHotkeyScope = useSetHotkeyScope();
|
||||||
|
@ -11,6 +11,7 @@ import { MultipleEntitySelect } from '@/object-record/relation-picker/components
|
|||||||
import { useRelationPicker } from '@/object-record/relation-picker/hooks/useRelationPicker';
|
import { useRelationPicker } from '@/object-record/relation-picker/hooks/useRelationPicker';
|
||||||
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
|
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
|
||||||
import { assertNotNull } from '~/utils/assert';
|
import { assertNotNull } from '~/utils/assert';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
type ActivityTargetInlineCellEditModeProps = {
|
type ActivityTargetInlineCellEditModeProps = {
|
||||||
activityId: string;
|
activityId: string;
|
||||||
@ -56,12 +57,12 @@ export const ActivityTargetInlineCellEditMode = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { findManyRecordsQuery: findManyPeopleQuery } = useObjectMetadataItem({
|
const { findManyRecordsQuery: findManyPeopleQuery } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { findManyRecordsQuery: findManyCompaniesQuery } =
|
const { findManyRecordsQuery: findManyCompaniesQuery } =
|
||||||
useObjectMetadataItem({
|
useObjectMetadataItem({
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
|
|
||||||
const useFindManyPeopleQuery = (options: any) =>
|
const useFindManyPeopleQuery = (options: any) =>
|
||||||
@ -87,7 +88,7 @@ export const ActivityTargetInlineCellEditMode = ({
|
|||||||
orderByField: 'createdAt',
|
orderByField: 'createdAt',
|
||||||
mappingFunction: (record: any) => identifiersMapper?.(record, 'person'),
|
mappingFunction: (record: any) => identifiersMapper?.(record, 'person'),
|
||||||
selectedIds: initialPeopleIds,
|
selectedIds: initialPeopleIds,
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
limit: 3,
|
limit: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ export const ActivityTargetInlineCellEditMode = ({
|
|||||||
orderByField: 'createdAt',
|
orderByField: 'createdAt',
|
||||||
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
||||||
selectedIds: initialCompanyIds,
|
selectedIds: initialCompanyIds,
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
limit: 3,
|
limit: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import { ActivityTargetChips } from '@/activities/components/ActivityTargetChips
|
|||||||
import { ActivityTargetInlineCellEditMode } from '@/activities/inline-cell/components/ActivityTargetInlineCellEditMode';
|
import { ActivityTargetInlineCellEditMode } from '@/activities/inline-cell/components/ActivityTargetInlineCellEditMode';
|
||||||
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
import { ActivityTarget } from '@/activities/types/ActivityTarget';
|
||||||
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
|
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||||
import { RecordInlineCellContainer } from '@/object-record/record-inline-cell/components/RecordInlineCellContainer';
|
import { RecordInlineCellContainer } from '@/object-record/record-inline-cell/components/RecordInlineCellContainer';
|
||||||
import { FieldRecoilScopeContext } from '@/object-record/record-inline-cell/states/recoil-scope-contexts/FieldRecoilScopeContext';
|
import { FieldRecoilScopeContext } from '@/object-record/record-inline-cell/states/recoil-scope-contexts/FieldRecoilScopeContext';
|
||||||
@ -28,7 +29,7 @@ export const ActivityTargetsInlineCell = ({
|
|||||||
) ?? [];
|
) ?? [];
|
||||||
|
|
||||||
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
|
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
filter: { id: { in: activityTargetIds } },
|
filter: { id: { in: activityTargetIds } },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,10 +3,11 @@ import { OrderByField } from '@/object-metadata/types/OrderByField';
|
|||||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||||
|
|
||||||
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
|
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useNotes = (entity: ActivityTargetableEntity) => {
|
export const useNotes = (entity: ActivityTargetableEntity) => {
|
||||||
const { records: activityTargets } = useFindManyRecords({
|
const { records: activityTargets } = useFindManyRecords({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
filter: {
|
filter: {
|
||||||
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
||||||
},
|
},
|
||||||
@ -24,7 +25,7 @@ export const useNotes = (entity: ActivityTargetableEntity) => {
|
|||||||
|
|
||||||
const { records: notes } = useFindManyRecords({
|
const { records: notes } = useFindManyRecords({
|
||||||
skip: !activityTargets?.length,
|
skip: !activityTargets?.length,
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
filter,
|
filter,
|
||||||
orderBy,
|
orderBy,
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
|||||||
import { IconTrash } from '@/ui/display/icon';
|
import { IconTrash } from '@/ui/display/icon';
|
||||||
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
||||||
import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
|
import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
type ActivityActionBarProps = {
|
type ActivityActionBarProps = {
|
||||||
activityId: string;
|
activityId: string;
|
||||||
@ -12,7 +13,7 @@ type ActivityActionBarProps = {
|
|||||||
export const ActivityActionBar = ({ activityId }: ActivityActionBarProps) => {
|
export const ActivityActionBar = ({ activityId }: ActivityActionBarProps) => {
|
||||||
const [, setIsRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
|
const [, setIsRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
|
||||||
const { deleteOneRecord: deleteOneActivity } = useDeleteOneRecord({
|
const { deleteOneRecord: deleteOneActivity } = useDeleteOneRecord({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
refetchFindManyQuery: true,
|
refetchFindManyQuery: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { entityFieldsFamilyState } from '@/object-record/field/states/entityFiel
|
|||||||
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
||||||
|
|
||||||
import '@blocknote/core/style.css';
|
import '@blocknote/core/style.css';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -35,7 +36,7 @@ export const RightDrawerActivity = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { record: activity } = useFindOneRecord({
|
const { record: activity } = useFindOneRecord({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
objectRecordId: activityId,
|
objectRecordId: activityId,
|
||||||
skip: !activityId,
|
skip: !activityId,
|
||||||
onCompleted: (activity: Activity) => {
|
onCompleted: (activity: Activity) => {
|
||||||
|
@ -13,6 +13,7 @@ import { Checkbox, CheckboxShape } from '@/ui/input/components/Checkbox';
|
|||||||
import { beautifyExactDate, hasDatePassed } from '~/utils/date-utils';
|
import { beautifyExactDate, hasDatePassed } from '~/utils/date-utils';
|
||||||
|
|
||||||
import { useCompleteTask } from '../hooks/useCompleteTask';
|
import { useCompleteTask } from '../hooks/useCompleteTask';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -81,7 +82,7 @@ export const TaskRow = ({
|
|||||||
) ?? [];
|
) ?? [];
|
||||||
|
|
||||||
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
|
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
filter: { id: { in: activityTargetIds } },
|
filter: { id: { in: activityTargetIds } },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,12 +2,13 @@ import { useCallback } from 'react';
|
|||||||
|
|
||||||
import { Activity } from '@/activities/types/Activity';
|
import { Activity } from '@/activities/types/Activity';
|
||||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
type Task = Pick<Activity, 'id' | 'completedAt'>;
|
type Task = Pick<Activity, 'id' | 'completedAt'>;
|
||||||
|
|
||||||
export const useCompleteTask = (task: Task) => {
|
export const useCompleteTask = (task: Task) => {
|
||||||
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
|
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const completeTask = useCallback(
|
const completeTask = useCallback(
|
||||||
|
@ -4,12 +4,13 @@ import { useRecoilValue } from 'recoil';
|
|||||||
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
||||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||||
import { parseDate } from '~/utils/date-utils';
|
import { parseDate } from '~/utils/date-utils';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useCurrentUserTaskCount = () => {
|
export const useCurrentUserTaskCount = () => {
|
||||||
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
|
||||||
|
|
||||||
const { records: tasks } = useFindManyRecords({
|
const { records: tasks } = useFindManyRecords({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
filter: {
|
filter: {
|
||||||
type: { eq: 'Task' },
|
type: { eq: 'Task' },
|
||||||
completedAt: { is: 'NULL' },
|
completedAt: { is: 'NULL' },
|
||||||
|
@ -7,6 +7,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
|||||||
import { useFilterDropdown } from '@/object-record/object-filter-dropdown/hooks/useFilterDropdown';
|
import { useFilterDropdown } from '@/object-record/object-filter-dropdown/hooks/useFilterDropdown';
|
||||||
import { parseDate } from '~/utils/date-utils';
|
import { parseDate } from '~/utils/date-utils';
|
||||||
import { isDefined } from '~/utils/isDefined';
|
import { isDefined } from '~/utils/isDefined';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
type UseTasksProps = {
|
type UseTasksProps = {
|
||||||
filterDropdownId?: string;
|
filterDropdownId?: string;
|
||||||
@ -21,7 +22,7 @@ export const useTasks = (props?: UseTasksProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { records: activityTargets } = useFindManyRecords({
|
const { records: activityTargets } = useFindManyRecords({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
filter: isDefined(entity)
|
filter: isDefined(entity)
|
||||||
? {
|
? {
|
||||||
[entity?.type === 'Company' ? 'companyId' : 'personId']: {
|
[entity?.type === 'Company' ? 'companyId' : 'personId']: {
|
||||||
@ -32,7 +33,7 @@ export const useTasks = (props?: UseTasksProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { records: completeTasksData } = useFindManyRecords({
|
const { records: completeTasksData } = useFindManyRecords({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
skip: !entity && !selectedFilter,
|
skip: !entity && !selectedFilter,
|
||||||
filter: {
|
filter: {
|
||||||
completedAt: { is: 'NOT_NULL' },
|
completedAt: { is: 'NOT_NULL' },
|
||||||
@ -56,7 +57,7 @@ export const useTasks = (props?: UseTasksProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { records: incompleteTaskData } = useFindManyRecords({
|
const { records: incompleteTaskData } = useFindManyRecords({
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
skip: !entity && !selectedFilter,
|
skip: !entity && !selectedFilter,
|
||||||
filter: {
|
filter: {
|
||||||
completedAt: { is: 'NULL' },
|
completedAt: { is: 'NULL' },
|
||||||
|
@ -9,6 +9,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
|||||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||||
|
|
||||||
import { TimelineItemsContainer } from './TimelineItemsContainer';
|
import { TimelineItemsContainer } from './TimelineItemsContainer';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledMainContainer = styled.div`
|
const StyledMainContainer = styled.div`
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@ -49,7 +50,7 @@ const StyledEmptyTimelineSubTitle = styled.div`
|
|||||||
|
|
||||||
export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
|
export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
|
||||||
const { records: activityTargets, loading } = useFindManyRecords({
|
const { records: activityTargets, loading } = useFindManyRecords({
|
||||||
objectNameSingular: 'activityTarget',
|
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
|
||||||
filter: {
|
filter: {
|
||||||
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
|
||||||
},
|
},
|
||||||
@ -57,7 +58,7 @@ export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
|
|||||||
|
|
||||||
const { records: activities } = useFindManyRecords({
|
const { records: activities } = useFindManyRecords({
|
||||||
skip: !activityTargets?.length,
|
skip: !activityTargets?.length,
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
filter: {
|
filter: {
|
||||||
id: {
|
id: {
|
||||||
in: activityTargets?.map((activityTarget) => activityTarget.activityId),
|
in: activityTargets?.map((activityTarget) => activityTarget.activityId),
|
||||||
|
@ -26,6 +26,7 @@ import { Command, CommandType } from '../types/Command';
|
|||||||
|
|
||||||
import { CommandGroup } from './CommandGroup';
|
import { CommandGroup } from './CommandGroup';
|
||||||
import { CommandMenuItem } from './CommandMenuItem';
|
import { CommandMenuItem } from './CommandMenuItem';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const StyledDialog = styled.div`
|
export const StyledDialog = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
@ -132,7 +133,7 @@ export const CommandMenu = () => {
|
|||||||
|
|
||||||
const { records: people } = useFindManyRecords<Person>({
|
const { records: people } = useFindManyRecords<Person>({
|
||||||
skip: !isCommandMenuOpened,
|
skip: !isCommandMenuOpened,
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
filter: {
|
filter: {
|
||||||
or: [
|
or: [
|
||||||
{ name: { firstName: { ilike: `%${search}%` } } },
|
{ name: { firstName: { ilike: `%${search}%` } } },
|
||||||
@ -144,7 +145,7 @@ export const CommandMenu = () => {
|
|||||||
|
|
||||||
const { records: companies } = useFindManyRecords<Company>({
|
const { records: companies } = useFindManyRecords<Company>({
|
||||||
skip: !isCommandMenuOpened,
|
skip: !isCommandMenuOpened,
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
filter: {
|
filter: {
|
||||||
name: { ilike: `%${search}%` },
|
name: { ilike: `%${search}%` },
|
||||||
},
|
},
|
||||||
@ -153,7 +154,7 @@ export const CommandMenu = () => {
|
|||||||
|
|
||||||
const { records: activities } = useFindManyRecords<Activity>({
|
const { records: activities } = useFindManyRecords<Activity>({
|
||||||
skip: !isCommandMenuOpened,
|
skip: !isCommandMenuOpened,
|
||||||
objectNameSingular: 'activity',
|
objectNameSingular: CoreObjectNameSingular.Activity,
|
||||||
filter: {
|
filter: {
|
||||||
or: [
|
or: [
|
||||||
{ title: { like: `%${search}%` } },
|
{ title: { like: `%${search}%` } },
|
||||||
|
@ -16,6 +16,7 @@ import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
|||||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
position: static;
|
position: static;
|
||||||
@ -73,7 +74,7 @@ export const AddPersonToCompany = ({
|
|||||||
updateOneRecordMutation,
|
updateOneRecordMutation,
|
||||||
createOneRecordMutation,
|
createOneRecordMutation,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [updatePerson] = useMutation(updateOneRecordMutation);
|
const [updatePerson] = useMutation(updateOneRecordMutation);
|
||||||
|
@ -24,6 +24,7 @@ import { getLogoUrlFromDomainName } from '~/utils';
|
|||||||
import { companyProgressesFamilyState } from '../states/companyProgressesFamilyState';
|
import { companyProgressesFamilyState } from '../states/companyProgressesFamilyState';
|
||||||
|
|
||||||
import { CompanyChip } from './CompanyChip';
|
import { CompanyChip } from './CompanyChip';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledBoardCard = styled.div<{ selected: boolean }>`
|
const StyledBoardCard = styled.div<{ selected: boolean }>`
|
||||||
background-color: ${({ theme, selected }) =>
|
background-color: ${({ theme, selected }) =>
|
||||||
@ -151,7 +152,7 @@ export const CompanyBoardCard = () => {
|
|||||||
|
|
||||||
const useUpdateOneRecordMutation: RecordUpdateHook = () => {
|
const useUpdateOneRecordMutation: RecordUpdateHook = () => {
|
||||||
const { updateOneRecord: updateOneOpportunity } = useUpdateOneRecord({
|
const { updateOneRecord: updateOneOpportunity } = useUpdateOneRecord({
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateEntity = ({ variables }: RecordUpdateHookParams) => {
|
const updateEntity = ({ variables }: RecordUpdateHookParams) => {
|
||||||
|
@ -8,6 +8,7 @@ import { mapPaginatedRecordsToRecords } from '@/object-record/utils/mapPaginated
|
|||||||
import { PeopleCard } from '@/people/components/PeopleCard';
|
import { PeopleCard } from '@/people/components/PeopleCard';
|
||||||
|
|
||||||
import { AddPersonToCompany } from './AddPersonToCompany';
|
import { AddPersonToCompany } from './AddPersonToCompany';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type CompanyTeamProps = {
|
export type CompanyTeamProps = {
|
||||||
company: Pick<Company, 'id'>;
|
company: Pick<Company, 'id'>;
|
||||||
@ -48,7 +49,7 @@ const StyledTitle = styled.div`
|
|||||||
|
|
||||||
export const CompanyTeam = ({ company }: { company: any }) => {
|
export const CompanyTeam = ({ company }: { company: any }) => {
|
||||||
const { findManyRecordsQuery } = useObjectMetadataItem({
|
const { findManyRecordsQuery } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data } = useQuery(findManyRecordsQuery, {
|
const { data } = useQuery(findManyRecordsQuery, {
|
||||||
|
@ -14,6 +14,7 @@ import { useViewScopedStates } from '@/views/hooks/internal/useViewScopedStates'
|
|||||||
import { useViewBar } from '@/views/hooks/useViewBar';
|
import { useViewBar } from '@/views/hooks/useViewBar';
|
||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { mapViewFieldsToBoardFieldDefinitions } from '@/views/utils/mapViewFieldsToBoardFieldDefinitions';
|
import { mapViewFieldsToBoardFieldDefinitions } from '@/views/utils/mapViewFieldsToBoardFieldDefinitions';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
type HooksCompanyBoardEffectProps = {
|
type HooksCompanyBoardEffectProps = {
|
||||||
viewBarId: string;
|
viewBarId: string;
|
||||||
@ -33,7 +34,7 @@ export const HooksCompanyBoardEffect = ({
|
|||||||
} = useViewBar({ viewBarId });
|
} = useViewBar({ viewBarId });
|
||||||
|
|
||||||
const { objectMetadataItem } = useObjectMetadataItem({
|
const { objectMetadataItem } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { columnDefinitions, filterDefinitions, sortDefinitions } =
|
const { columnDefinitions, filterDefinitions, sortDefinitions } =
|
||||||
|
@ -11,6 +11,7 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types
|
|||||||
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
|
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
|
||||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const NewOpportunityButton = () => {
|
export const NewOpportunityButton = () => {
|
||||||
const [isCreatingCard, setIsCreatingCard] = useState(false);
|
const [isCreatingCard, setIsCreatingCard] = useState(false);
|
||||||
@ -57,7 +58,7 @@ export const NewOpportunityButton = () => {
|
|||||||
|
|
||||||
// TODO: refactor useFilteredSearchEntityQuery
|
// TODO: refactor useFilteredSearchEntityQuery
|
||||||
const { findManyRecordsQuery } = useObjectMetadataItem({
|
const { findManyRecordsQuery } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
const useFindManyQuery = (options: any) =>
|
const useFindManyQuery = (options: any) =>
|
||||||
useQuery(findManyRecordsQuery, options);
|
useQuery(findManyRecordsQuery, options);
|
||||||
@ -74,7 +75,7 @@ export const NewOpportunityButton = () => {
|
|||||||
orderByField: 'createdAt',
|
orderByField: 'createdAt',
|
||||||
selectedIds: [],
|
selectedIds: [],
|
||||||
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -17,6 +17,7 @@ import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/Dropdow
|
|||||||
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type OpportunityPickerProps = {
|
export type OpportunityPickerProps = {
|
||||||
companyId: string | null;
|
companyId: string | null;
|
||||||
@ -37,7 +38,7 @@ export const OpportunityPicker = ({
|
|||||||
|
|
||||||
// TODO: refactor useFilteredSearchEntityQuery
|
// TODO: refactor useFilteredSearchEntityQuery
|
||||||
const { findManyRecordsQuery: findManyCompanies } = useObjectMetadataItem({
|
const { findManyRecordsQuery: findManyCompanies } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
const useFindManyQuery = (options: any) =>
|
const useFindManyQuery = (options: any) =>
|
||||||
useQuery(findManyCompanies, options);
|
useQuery(findManyCompanies, options);
|
||||||
@ -54,7 +55,7 @@ export const OpportunityPicker = ({
|
|||||||
orderByField: 'createdAt',
|
orderByField: 'createdAt',
|
||||||
selectedIds: [],
|
selectedIds: [],
|
||||||
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [isProgressSelectionUnfolded, setIsProgressSelectionUnfolded] =
|
const [isProgressSelectionUnfolded, setIsProgressSelectionUnfolded] =
|
||||||
|
@ -5,6 +5,7 @@ import { SpreadsheetOptions } from '@/spreadsheet-import/types';
|
|||||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||||
|
|
||||||
import { fieldsForCompany } from '../utils/fieldsForCompany';
|
import { fieldsForCompany } from '../utils/fieldsForCompany';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type FieldCompanyMapping = (typeof fieldsForCompany)[number]['key'];
|
export type FieldCompanyMapping = (typeof fieldsForCompany)[number]['key'];
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ export const useSpreadsheetCompanyImport = () => {
|
|||||||
|
|
||||||
const { createManyRecords: createManyCompanies } =
|
const { createManyRecords: createManyCompanies } =
|
||||||
useCreateManyRecords<Company>({
|
useCreateManyRecords<Company>({
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
});
|
});
|
||||||
|
|
||||||
const openCompanySpreadsheetImport = (
|
const openCompanySpreadsheetImport = (
|
||||||
|
@ -14,6 +14,7 @@ import { PaginatedRecordTypeResults } from '@/object-record/types/PaginatedRecor
|
|||||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||||
|
|
||||||
import { favoritesState } from '../states/favoritesState';
|
import { favoritesState } from '../states/favoritesState';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useFavorites = ({
|
export const useFavorites = ({
|
||||||
objectNamePlural,
|
objectNamePlural,
|
||||||
@ -29,11 +30,11 @@ export const useFavorites = ({
|
|||||||
createOneRecordMutation: createOneFavoriteMutation,
|
createOneRecordMutation: createOneFavoriteMutation,
|
||||||
deleteOneRecordMutation: deleteOneFavoriteMutation,
|
deleteOneRecordMutation: deleteOneFavoriteMutation,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'favorite',
|
objectNameSingular: CoreObjectNameSingular.Favorite,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { triggerOptimisticEffects } = useOptimisticEffect({
|
const { triggerOptimisticEffects } = useOptimisticEffect({
|
||||||
objectNameSingular: 'favorite',
|
objectNameSingular: CoreObjectNameSingular.Favorite,
|
||||||
});
|
});
|
||||||
const { performOptimisticEvict } = useOptimisticEvict();
|
const { performOptimisticEvict } = useOptimisticEvict();
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ export const useFavorites = ({
|
|||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
|
||||||
useFindManyRecords({
|
useFindManyRecords({
|
||||||
objectNameSingular: 'favorite',
|
objectNameSingular: CoreObjectNameSingular.Favorite,
|
||||||
onCompleted: useRecoilCallback(
|
onCompleted: useRecoilCallback(
|
||||||
({ snapshot, set }) =>
|
({ snapshot, set }) =>
|
||||||
async (data: PaginatedRecordTypeResults<Required<Favorite>>) => {
|
async (data: PaginatedRecordTypeResults<Required<Favorite>>) => {
|
||||||
|
@ -1,6 +1,23 @@
|
|||||||
export enum CoreObjectNameSingular {
|
export enum CoreObjectNameSingular {
|
||||||
|
Activity = 'activity',
|
||||||
|
ActivityTarget = 'activityTarget',
|
||||||
|
ApiKey = 'apiKey',
|
||||||
|
Attachment = 'attachment',
|
||||||
|
Comment = 'comment',
|
||||||
Company = 'company',
|
Company = 'company',
|
||||||
Person = 'person',
|
ConenctedAccount = 'conenctedAccount',
|
||||||
WorkspaceMember = 'workspaceMember',
|
Favorite = 'favorite',
|
||||||
|
Message = 'message',
|
||||||
|
MessageChannel = 'messageChannel',
|
||||||
|
MessageRecipient = 'messageRecipient',
|
||||||
|
MessageThread = 'messageThread',
|
||||||
Opportunity = 'opportunity',
|
Opportunity = 'opportunity',
|
||||||
|
Person = 'person',
|
||||||
|
PipelineStep = 'pipelineStep',
|
||||||
|
View = 'view',
|
||||||
|
ViewField = 'viewField',
|
||||||
|
ViewFilter = 'viewFilter',
|
||||||
|
ViewSort = 'viewSort',
|
||||||
|
Webhook = 'webhook',
|
||||||
|
WorkspaceMember = 'workspaceMember',
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import { Opportunity } from '@/pipeline/types/Opportunity';
|
|||||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
||||||
|
|
||||||
import { useFindManyRecords } from './useFindManyRecords';
|
import { useFindManyRecords } from './useFindManyRecords';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useObjectRecordBoard = () => {
|
export const useObjectRecordBoard = () => {
|
||||||
const objectNameSingular = 'opportunity';
|
const objectNameSingular = 'opportunity';
|
||||||
@ -53,7 +54,7 @@ export const useObjectRecordBoard = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useFindManyRecords({
|
useFindManyRecords({
|
||||||
objectNameSingular: 'pipelineStep',
|
objectNameSingular: CoreObjectNameSingular.PipelineStep,
|
||||||
filter: {},
|
filter: {},
|
||||||
onCompleted: useCallback(
|
onCompleted: useCallback(
|
||||||
(data: PaginatedRecordTypeResults<PipelineStep>) => {
|
(data: PaginatedRecordTypeResults<PipelineStep>) => {
|
||||||
@ -69,7 +70,7 @@ export const useObjectRecordBoard = () => {
|
|||||||
fetchMoreRecords: fetchMoreOpportunities,
|
fetchMoreRecords: fetchMoreOpportunities,
|
||||||
} = useFindManyRecords<Opportunity>({
|
} = useFindManyRecords<Opportunity>({
|
||||||
skip: !savedPipelineSteps.length,
|
skip: !savedPipelineSteps.length,
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
filter,
|
filter,
|
||||||
orderBy,
|
orderBy,
|
||||||
onCompleted: useCallback(() => {
|
onCompleted: useCallback(() => {
|
||||||
@ -79,7 +80,7 @@ export const useObjectRecordBoard = () => {
|
|||||||
|
|
||||||
const { fetchMoreRecords: fetchMoreCompanies } = useFindManyRecords({
|
const { fetchMoreRecords: fetchMoreCompanies } = useFindManyRecords({
|
||||||
skip: !savedOpportunities.length,
|
skip: !savedOpportunities.length,
|
||||||
objectNameSingular: 'company',
|
objectNameSingular: CoreObjectNameSingular.Company,
|
||||||
filter: {
|
filter: {
|
||||||
id: {
|
id: {
|
||||||
in: savedOpportunities.map(
|
in: savedOpportunities.map(
|
||||||
|
@ -22,6 +22,7 @@ import { BoardColumnDefinition } from '../types/BoardColumnDefinition';
|
|||||||
import { BoardOptions } from '../types/BoardOptions';
|
import { BoardOptions } from '../types/BoardOptions';
|
||||||
|
|
||||||
import { RecordBoardColumn } from './RecordBoardColumn';
|
import { RecordBoardColumn } from './RecordBoardColumn';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type RecordBoardProps = {
|
export type RecordBoardProps = {
|
||||||
recordBoardId: string;
|
recordBoardId: string;
|
||||||
@ -73,7 +74,7 @@ export const RecordBoard = ({
|
|||||||
|
|
||||||
const { updateOneRecord: updateOneOpportunity } =
|
const { updateOneRecord: updateOneOpportunity } =
|
||||||
useUpdateOneRecord<Opportunity>({
|
useUpdateOneRecord<Opportunity>({
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { unselectAllActiveCards, setCardSelected } =
|
const { unselectAllActiveCards, setCardSelected } =
|
||||||
|
@ -4,11 +4,12 @@ import { v4 } from 'uuid';
|
|||||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||||
import { recordBoardCardIdsByColumnIdFamilyState } from '@/object-record/record-board/states/recordBoardCardIdsByColumnIdFamilyState';
|
import { recordBoardCardIdsByColumnIdFamilyState } from '@/object-record/record-board/states/recordBoardCardIdsByColumnIdFamilyState';
|
||||||
import { Opportunity } from '@/pipeline/types/Opportunity';
|
import { Opportunity } from '@/pipeline/types/Opportunity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useCreateOpportunity = () => {
|
export const useCreateOpportunity = () => {
|
||||||
const { createOneRecord: createOneOpportunity } =
|
const { createOneRecord: createOneOpportunity } =
|
||||||
useCreateOneRecord<Opportunity>({
|
useCreateOneRecord<Opportunity>({
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const createOpportunity = useRecoilCallback(
|
const createOpportunity = useRecoilCallback(
|
||||||
|
@ -6,6 +6,7 @@ import { useRecordBoardScopedStates } from '@/object-record/record-board/hooks/i
|
|||||||
import { Opportunity } from '@/pipeline/types/Opportunity';
|
import { Opportunity } from '@/pipeline/types/Opportunity';
|
||||||
|
|
||||||
import { useRemoveRecordBoardCardIdsInternal } from './useRemoveRecordBoardCardIdsInternal';
|
import { useRemoveRecordBoardCardIdsInternal } from './useRemoveRecordBoardCardIdsInternal';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useDeleteSelectedRecordBoardCardsInternal = () => {
|
export const useDeleteSelectedRecordBoardCardsInternal = () => {
|
||||||
const removeCardIds = useRemoveRecordBoardCardIdsInternal();
|
const removeCardIds = useRemoveRecordBoardCardIdsInternal();
|
||||||
@ -13,7 +14,7 @@ export const useDeleteSelectedRecordBoardCardsInternal = () => {
|
|||||||
|
|
||||||
const { deleteManyRecords: deleteManyOpportunities } =
|
const { deleteManyRecords: deleteManyOpportunities } =
|
||||||
useDeleteManyRecords<Opportunity>({
|
useDeleteManyRecords<Opportunity>({
|
||||||
objectNameSingular: 'opportunity',
|
objectNameSingular: CoreObjectNameSingular.Opportunity,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { selectedCardIdsSelector } = useRecordBoardScopedStates();
|
const { selectedCardIdsSelector } = useRecordBoardScopedStates();
|
||||||
|
@ -6,6 +6,7 @@ import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
|||||||
import { useMoveViewColumns } from '@/views/hooks/useMoveViewColumns';
|
import { useMoveViewColumns } from '@/views/hooks/useMoveViewColumns';
|
||||||
|
|
||||||
import { BoardColumnDefinition } from '../../types/BoardColumnDefinition';
|
import { BoardColumnDefinition } from '../../types/BoardColumnDefinition';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useBoardColumnsInternal = () => {
|
export const useBoardColumnsInternal = () => {
|
||||||
const { boardColumnsState } = useRecordBoardScopedStates();
|
const { boardColumnsState } = useRecordBoardScopedStates();
|
||||||
@ -15,7 +16,7 @@ export const useBoardColumnsInternal = () => {
|
|||||||
|
|
||||||
const { updateOneRecord: updateOnePipelineStep } =
|
const { updateOneRecord: updateOnePipelineStep } =
|
||||||
useUpdateOneRecord<PipelineStep>({
|
useUpdateOneRecord<PipelineStep>({
|
||||||
objectNameSingular: 'pipelineStep',
|
objectNameSingular: CoreObjectNameSingular.PipelineStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const updatedPipelineSteps = (stages: BoardColumnDefinition[]) => {
|
const updatedPipelineSteps = (stages: BoardColumnDefinition[]) => {
|
||||||
|
@ -14,6 +14,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
|
|||||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||||
import { Avatar } from '@/users/components/Avatar';
|
import { Avatar } from '@/users/components/Avatar';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type PeopleCardProps = {
|
export type PeopleCardProps = {
|
||||||
person: Pick<Person, 'id' | 'avatarUrl' | 'name' | 'jobTitle'>;
|
person: Pick<Person, 'id' | 'avatarUrl' | 'name' | 'jobTitle'>;
|
||||||
@ -112,7 +113,7 @@ export const PeopleCard = ({
|
|||||||
updateOneRecordMutation,
|
updateOneRecordMutation,
|
||||||
deleteOneRecordMutation,
|
deleteOneRecordMutation,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [updatePerson] = useMutation(updateOneRecordMutation);
|
const [updatePerson] = useMutation(updateOneRecordMutation);
|
||||||
|
@ -7,6 +7,7 @@ import { SpreadsheetOptions } from '@/spreadsheet-import/types';
|
|||||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||||
|
|
||||||
import { fieldsForPerson } from '../utils/fieldsForPerson';
|
import { fieldsForPerson } from '../utils/fieldsForPerson';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export type FieldPersonMapping = (typeof fieldsForPerson)[number]['key'];
|
export type FieldPersonMapping = (typeof fieldsForPerson)[number]['key'];
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ export const useSpreadsheetPersonImport = () => {
|
|||||||
const { enqueueSnackBar } = useSnackBar();
|
const { enqueueSnackBar } = useSnackBar();
|
||||||
|
|
||||||
const { createManyRecords: createManyPeople } = useCreateManyRecords<Person>({
|
const { createManyRecords: createManyPeople } = useCreateManyRecords<Person>({
|
||||||
objectNameSingular: 'person',
|
objectNameSingular: CoreObjectNameSingular.Person,
|
||||||
});
|
});
|
||||||
|
|
||||||
const openPersonSpreadsheetImport = (
|
const openPersonSpreadsheetImport = (
|
||||||
|
@ -5,16 +5,17 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
|||||||
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
|
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
|
||||||
import { currentPipelineState } from '@/pipeline/states/currentPipelineState';
|
import { currentPipelineState } from '@/pipeline/states/currentPipelineState';
|
||||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const usePipelineSteps = () => {
|
export const usePipelineSteps = () => {
|
||||||
const { createOneRecord: createOnePipelineStep } =
|
const { createOneRecord: createOnePipelineStep } =
|
||||||
useCreateOneRecord<PipelineStep>({
|
useCreateOneRecord<PipelineStep>({
|
||||||
objectNameSingular: 'pipelineStep',
|
objectNameSingular: CoreObjectNameSingular.PipelineStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { deleteOneRecord: deleteOnePipelineStep } =
|
const { deleteOneRecord: deleteOnePipelineStep } =
|
||||||
useDeleteOneRecord<PipelineStep>({
|
useDeleteOneRecord<PipelineStep>({
|
||||||
objectNameSingular: 'pipelineStep',
|
objectNameSingular: CoreObjectNameSingular.PipelineStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlePipelineStepAdd = useRecoilCallback(
|
const handlePipelineStepAdd = useRecoilCallback(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
|
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||||
|
|
||||||
export const useRelationFieldPreviewValue = ({
|
export const useRelationFieldPreviewValue = ({
|
||||||
@ -16,7 +17,7 @@ export const useRelationFieldPreviewValue = ({
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const { records: relationObjects } = useFindManyRecords({
|
const { records: relationObjects } = useFindManyRecords({
|
||||||
objectNameSingular: relationObjectMetadataItem?.nameSingular ?? 'company', // TODO fix this hack
|
objectNameSingular: relationObjectMetadataItem?.nameSingular ?? CoreObjectNameSingular.Company, // TODO fix this hack
|
||||||
skip: skip || !relationObjectMetadataItem,
|
skip: skip || !relationObjectMetadataItem,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe
|
|||||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||||
import { TextInput } from '@/ui/input/components/TextInput';
|
import { TextInput } from '@/ui/input/components/TextInput';
|
||||||
import { logError } from '~/utils/logError';
|
import { logError } from '~/utils/logError';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledComboInputContainer = styled.div`
|
const StyledComboInputContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -41,7 +42,7 @@ export const NameFields = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { updateOneRecord } = useUpdateOneRecord({
|
const { updateOneRecord } = useUpdateOneRecord({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Enhance this with react-web-hook-form (https://www.react-hook-form.com)
|
// TODO: Enhance this with react-web-hook-form (https://www.react-hook-form.com)
|
||||||
|
@ -6,6 +6,7 @@ import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
|||||||
import { ImageInput } from '@/ui/input/components/ImageInput';
|
import { ImageInput } from '@/ui/input/components/ImageInput';
|
||||||
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
|
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
|
||||||
import { useUploadProfilePictureMutation } from '~/generated/graphql';
|
import { useUploadProfilePictureMutation } from '~/generated/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const ProfilePictureUploader = () => {
|
export const ProfilePictureUploader = () => {
|
||||||
const [uploadPicture, { loading: isUploading }] =
|
const [uploadPicture, { loading: isUploading }] =
|
||||||
@ -20,7 +21,7 @@ export const ProfilePictureUploader = () => {
|
|||||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||||
|
|
||||||
const { updateOneRecord } = useUpdateOneRecord({
|
const { updateOneRecord } = useUpdateOneRecord({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleUpload = async (file: File) => {
|
const handleUpload = async (file: File) => {
|
||||||
|
@ -4,6 +4,7 @@ import { useRecoilState } from 'recoil';
|
|||||||
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
||||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||||
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
|
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useColorScheme = () => {
|
export const useColorScheme = () => {
|
||||||
const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilState(
|
const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilState(
|
||||||
@ -11,7 +12,7 @@ export const useColorScheme = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { updateOneRecord: updateOneWorkspaceMember } = useUpdateOneRecord({
|
const { updateOneRecord: updateOneWorkspaceMember } = useUpdateOneRecord({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
|
|
||||||
const colorScheme = currentWorkspaceMember?.colorScheme ?? 'System';
|
const colorScheme = currentWorkspaceMember?.colorScheme ?? 'System';
|
||||||
|
@ -8,6 +8,7 @@ import { GraphQLView } from '@/views/types/GraphQLView';
|
|||||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||||
|
|
||||||
import { useViewScopedStates } from '../hooks/internal/useViewScopedStates';
|
import { useViewScopedStates } from '../hooks/internal/useViewScopedStates';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const ViewBarEffect = () => {
|
export const ViewBarEffect = () => {
|
||||||
const {
|
const {
|
||||||
@ -35,7 +36,7 @@ export const ViewBarEffect = () => {
|
|||||||
|
|
||||||
const { records: newViews } = useFindManyRecords<GraphQLView>({
|
const { records: newViews } = useFindManyRecords<GraphQLView>({
|
||||||
skip: !viewObjectMetadataId,
|
skip: !viewObjectMetadataId,
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
filter: {
|
filter: {
|
||||||
type: { eq: viewType },
|
type: { eq: viewType },
|
||||||
objectMetadataId: { eq: viewObjectMetadataId },
|
objectMetadataId: { eq: viewObjectMetadataId },
|
||||||
|
@ -5,15 +5,16 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
|
|||||||
import { ViewField } from '@/views/types/ViewField';
|
import { ViewField } from '@/views/types/ViewField';
|
||||||
import { getViewScopedStatesFromSnapshot } from '@/views/utils/getViewScopedStatesFromSnapshot';
|
import { getViewScopedStatesFromSnapshot } from '@/views/utils/getViewScopedStatesFromSnapshot';
|
||||||
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useViewFields = (viewScopeId: string) => {
|
export const useViewFields = (viewScopeId: string) => {
|
||||||
const { updateOneRecordMutation, createOneRecordMutation } =
|
const { updateOneRecordMutation, createOneRecordMutation } =
|
||||||
useObjectMetadataItem({
|
useObjectMetadataItem({
|
||||||
objectNameSingular: 'viewField',
|
objectNameSingular: CoreObjectNameSingular.ViewField,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { modifyRecordFromCache } = useObjectMetadataItem({
|
const { modifyRecordFromCache } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
});
|
});
|
||||||
|
|
||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
@ -9,6 +9,7 @@ import { ViewFilter } from '@/views/types/ViewFilter';
|
|||||||
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
||||||
|
|
||||||
import { useViewScopedStates } from './useViewScopedStates';
|
import { useViewScopedStates } from './useViewScopedStates';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useViewFilters = (viewScopeId: string) => {
|
export const useViewFilters = (viewScopeId: string) => {
|
||||||
const {
|
const {
|
||||||
@ -16,11 +17,11 @@ export const useViewFilters = (viewScopeId: string) => {
|
|||||||
createOneRecordMutation,
|
createOneRecordMutation,
|
||||||
deleteOneRecordMutation,
|
deleteOneRecordMutation,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'viewFilter',
|
objectNameSingular: CoreObjectNameSingular.ViewFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { modifyRecordFromCache } = useObjectMetadataItem({
|
const { modifyRecordFromCache } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
});
|
});
|
||||||
|
|
||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
@ -9,6 +9,7 @@ import { ViewSort } from '@/views/types/ViewSort';
|
|||||||
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
||||||
|
|
||||||
import { useViewScopedStates } from './useViewScopedStates';
|
import { useViewScopedStates } from './useViewScopedStates';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useViewSorts = (viewScopeId: string) => {
|
export const useViewSorts = (viewScopeId: string) => {
|
||||||
const {
|
const {
|
||||||
@ -16,11 +17,11 @@ export const useViewSorts = (viewScopeId: string) => {
|
|||||||
createOneRecordMutation,
|
createOneRecordMutation,
|
||||||
deleteOneRecordMutation,
|
deleteOneRecordMutation,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'viewSort',
|
objectNameSingular: CoreObjectNameSingular.ViewSort,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { modifyRecordFromCache } = useObjectMetadataItem({
|
const { modifyRecordFromCache } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
});
|
});
|
||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { useRecoilCallback } from 'recoil';
|
|||||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||||
import { GraphQLView } from '@/views/types/GraphQLView';
|
import { GraphQLView } from '@/views/types/GraphQLView';
|
||||||
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const useViews = (scopeId: string) => {
|
export const useViews = (scopeId: string) => {
|
||||||
const {
|
const {
|
||||||
@ -12,7 +13,7 @@ export const useViews = (scopeId: string) => {
|
|||||||
deleteOneRecordMutation: deleteOneMutation,
|
deleteOneRecordMutation: deleteOneMutation,
|
||||||
findManyRecordsQuery: findManyQuery,
|
findManyRecordsQuery: findManyQuery,
|
||||||
} = useObjectMetadataItem({
|
} = useObjectMetadataItem({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
});
|
});
|
||||||
|
|
||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
@ -21,6 +21,7 @@ import { MainButton } from '@/ui/input/button/components/MainButton';
|
|||||||
import { TextInput } from '@/ui/input/components/TextInput';
|
import { TextInput } from '@/ui/input/components/TextInput';
|
||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||||
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledContentContainer = styled.div`
|
const StyledContentContainer = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -63,7 +64,7 @@ export const CreateProfile = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { updateOneRecord } = useUpdateOneRecord<WorkspaceMember>({
|
const { updateOneRecord } = useUpdateOneRecord<WorkspaceMember>({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Form
|
// Form
|
||||||
|
@ -9,6 +9,7 @@ import { IconTargetArrow } from '@/ui/display/icon';
|
|||||||
import { PageBody } from '@/ui/layout/page/PageBody';
|
import { PageBody } from '@/ui/layout/page/PageBody';
|
||||||
import { PageContainer } from '@/ui/layout/page/PageContainer';
|
import { PageContainer } from '@/ui/layout/page/PageContainer';
|
||||||
import { PageHeader } from '@/ui/layout/page/PageHeader';
|
import { PageHeader } from '@/ui/layout/page/PageHeader';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledBoardContainer = styled.div`
|
const StyledBoardContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -22,7 +23,7 @@ export const Opportunities = () => {
|
|||||||
|
|
||||||
const { updateOneRecord: updateOnePipelineStep } =
|
const { updateOneRecord: updateOnePipelineStep } =
|
||||||
useUpdateOneRecord<PipelineStep>({
|
useUpdateOneRecord<PipelineStep>({
|
||||||
objectNameSingular: 'pipelineStep',
|
objectNameSingular: CoreObjectNameSingular.PipelineStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleEditColumnTitle = ({
|
const handleEditColumnTitle = ({
|
||||||
|
@ -16,6 +16,7 @@ import { Section } from '@/ui/layout/section/components/Section';
|
|||||||
import { WorkspaceInviteLink } from '@/workspace/components/WorkspaceInviteLink';
|
import { WorkspaceInviteLink } from '@/workspace/components/WorkspaceInviteLink';
|
||||||
import { WorkspaceMemberCard } from '@/workspace/components/WorkspaceMemberCard';
|
import { WorkspaceMemberCard } from '@/workspace/components/WorkspaceMemberCard';
|
||||||
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledH1Title = styled(H1Title)`
|
const StyledH1Title = styled(H1Title)`
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@ -35,11 +36,11 @@ export const SettingsWorkspaceMembers = () => {
|
|||||||
>();
|
>();
|
||||||
|
|
||||||
const { records: workspaceMembers } = useFindManyRecords<WorkspaceMember>({
|
const { records: workspaceMembers } = useFindManyRecords<WorkspaceMember>({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
const { deleteOneRecord: deleteOneWorkspaceMember } =
|
const { deleteOneRecord: deleteOneWorkspaceMember } =
|
||||||
useDeleteOneRecord<WorkspaceMember>({
|
useDeleteOneRecord<WorkspaceMember>({
|
||||||
objectNameSingular: 'workspaceMember',
|
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
|
||||||
});
|
});
|
||||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import { View } from '@/views/types/View';
|
|||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const SettingsObjectNewFieldStep2 = () => {
|
export const SettingsObjectNewFieldStep2 = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -83,11 +84,11 @@ export const SettingsObjectNewFieldStep2 = () => {
|
|||||||
const [relationObjectViews, setRelationObjectViews] = useState<View[]>([]);
|
const [relationObjectViews, setRelationObjectViews] = useState<View[]>([]);
|
||||||
|
|
||||||
const { modifyRecordFromCache: modifyViewFromCache } = useObjectMetadataItem({
|
const { modifyRecordFromCache: modifyViewFromCache } = useObjectMetadataItem({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
});
|
});
|
||||||
|
|
||||||
useFindManyRecords({
|
useFindManyRecords({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
filter: {
|
filter: {
|
||||||
type: { eq: ViewType.Table },
|
type: { eq: ViewType.Table },
|
||||||
objectMetadataId: { eq: activeObjectMetadataItem?.id },
|
objectMetadataId: { eq: activeObjectMetadataItem?.id },
|
||||||
@ -102,7 +103,7 @@ export const SettingsObjectNewFieldStep2 = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useFindManyRecords({
|
useFindManyRecords({
|
||||||
objectNameSingular: 'view',
|
objectNameSingular: CoreObjectNameSingular.View,
|
||||||
skip: !formValues.relation?.objectMetadataId,
|
skip: !formValues.relation?.objectMetadataId,
|
||||||
filter: {
|
filter: {
|
||||||
type: { eq: ViewType.Table },
|
type: { eq: ViewType.Table },
|
||||||
|
@ -24,6 +24,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
|
|||||||
import { Section } from '@/ui/layout/section/components/Section';
|
import { Section } from '@/ui/layout/section/components/Section';
|
||||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||||
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
|
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledInfo = styled.span`
|
const StyledInfo = styled.span`
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
@ -51,14 +52,14 @@ export const SettingsDevelopersApiKeyDetail = () => {
|
|||||||
|
|
||||||
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
|
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
|
||||||
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
|
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: CoreObjectNameSingular.ApiKey,
|
||||||
});
|
});
|
||||||
const { updateOneRecord: updateApiKey } = useUpdateOneRecord<ApiKey>({
|
const { updateOneRecord: updateApiKey } = useUpdateOneRecord<ApiKey>({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: CoreObjectNameSingular.ApiKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { record: apiKeyData } = useFindOneRecord({
|
const { record: apiKeyData } = useFindOneRecord({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: CoreObjectNameSingular.ApiKey,
|
||||||
objectRecordId: apiKeyId,
|
objectRecordId: apiKeyId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
|
|||||||
import { Table } from '@/ui/layout/table/components/Table';
|
import { Table } from '@/ui/layout/table/components/Table';
|
||||||
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
||||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
@ -43,7 +44,7 @@ export const SettingsDevelopersApiKeys = () => {
|
|||||||
const [apiKeys, setApiKeys] = useState<Array<ApiFieldItem>>([]);
|
const [apiKeys, setApiKeys] = useState<Array<ApiFieldItem>>([]);
|
||||||
|
|
||||||
useFindManyRecords({
|
useFindManyRecords({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: CoreObjectNameSingular.ApiKey,
|
||||||
filter: { revokedAt: { is: 'NULL' } },
|
filter: { revokedAt: { is: 'NULL' } },
|
||||||
orderBy: {},
|
orderBy: {},
|
||||||
onCompleted: (data) => {
|
onCompleted: (data) => {
|
||||||
|
@ -17,6 +17,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
|
|||||||
import { Section } from '@/ui/layout/section/components/Section';
|
import { Section } from '@/ui/layout/section/components/Section';
|
||||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||||
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
|
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
|
|
||||||
export const SettingsDevelopersApiKeysNew = () => {
|
export const SettingsDevelopersApiKeysNew = () => {
|
||||||
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
|
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
|
||||||
@ -31,7 +32,7 @@ export const SettingsDevelopersApiKeysNew = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
|
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: CoreObjectNameSingular.ApiKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSave = async () => {
|
const onSave = async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user