feat: email and calendar events for opportunities (#13613)
This commit is contained in:
@@ -5,6 +5,7 @@ import { CalendarMonthCard } from '@/activities/calendar/components/CalendarMont
|
||||
import { TIMELINE_CALENDAR_EVENTS_DEFAULT_PAGE_SIZE } from '@/activities/calendar/constants/Calendar';
|
||||
import { CalendarContext } from '@/activities/calendar/contexts/CalendarContext';
|
||||
import { getTimelineCalendarEventsFromCompanyId } from '@/activities/calendar/graphql/queries/getTimelineCalendarEventsFromCompanyId';
|
||||
import { getTimelineCalendarEventsFromOpportunityId } from '@/activities/calendar/graphql/queries/getTimelineCalendarEventsFromOpportunityId';
|
||||
import { getTimelineCalendarEventsFromPersonId } from '@/activities/calendar/graphql/queries/getTimelineCalendarEventsFromPersonId';
|
||||
import { useCalendarEvents } from '@/activities/calendar/hooks/useCalendarEvents';
|
||||
import { CustomResolverFetchMoreLoader } from '@/activities/components/CustomResolverFetchMoreLoader';
|
||||
@@ -53,10 +54,16 @@ export const Calendar = ({
|
||||
getTimelineCalendarEventsFromPersonId,
|
||||
'getTimelineCalendarEventsFromPersonId',
|
||||
]
|
||||
: [
|
||||
getTimelineCalendarEventsFromCompanyId,
|
||||
'getTimelineCalendarEventsFromCompanyId',
|
||||
];
|
||||
: targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Company
|
||||
? [
|
||||
getTimelineCalendarEventsFromCompanyId,
|
||||
'getTimelineCalendarEventsFromCompanyId',
|
||||
]
|
||||
: [
|
||||
getTimelineCalendarEventsFromOpportunityId,
|
||||
'getTimelineCalendarEventsFromOpportunityId',
|
||||
];
|
||||
|
||||
const { data, firstQueryLoading, isFetchingMore, fetchMoreRecords } =
|
||||
useCustomResolver<TimelineCalendarEventsWithTotal>(
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
import { timelineCalendarEventWithTotalFragment } from '@/activities/calendar/graphql/queries/fragments/timelineCalendarEventWithTotalFragment';
|
||||
|
||||
export const getTimelineCalendarEventsFromOpportunityId = gql`
|
||||
query GetTimelineCalendarEventsFromOpportunityId(
|
||||
$opportunityId: UUID!
|
||||
$page: Int!
|
||||
$pageSize: Int!
|
||||
) {
|
||||
getTimelineCalendarEventsFromOpportunityId(
|
||||
opportunityId: $opportunityId
|
||||
page: $page
|
||||
pageSize: $pageSize
|
||||
) {
|
||||
...TimelineCalendarEventsWithTotalFragment
|
||||
}
|
||||
}
|
||||
${timelineCalendarEventWithTotalFragment}
|
||||
`;
|
||||
@@ -7,6 +7,7 @@ import { EmailThreadPreview } from '@/activities/emails/components/EmailThreadPr
|
||||
import { TIMELINE_THREADS_DEFAULT_PAGE_SIZE } from '@/activities/emails/constants/Messaging';
|
||||
import { getTimelineThreadsFromCompanyId } from '@/activities/emails/graphql/queries/getTimelineThreadsFromCompanyId';
|
||||
import { getTimelineThreadsFromPersonId } from '@/activities/emails/graphql/queries/getTimelineThreadsFromPersonId';
|
||||
import { getTimelineThreadsFromOpportunityId } from '@/activities/emails/graphql/queries/getTimelineThreadsFromOpportunityId';
|
||||
import { useCustomResolver } from '@/activities/hooks/useCustomResolver';
|
||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
@@ -48,7 +49,13 @@ export const EmailThreads = ({
|
||||
const [query, queryName] =
|
||||
targetableObject.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||
? [getTimelineThreadsFromPersonId, 'getTimelineThreadsFromPersonId']
|
||||
: [getTimelineThreadsFromCompanyId, 'getTimelineThreadsFromCompanyId'];
|
||||
: targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Company
|
||||
? [getTimelineThreadsFromCompanyId, 'getTimelineThreadsFromCompanyId']
|
||||
: [
|
||||
getTimelineThreadsFromOpportunityId,
|
||||
'getTimelineThreadsFromOpportunityId',
|
||||
];
|
||||
|
||||
const { data, firstQueryLoading, isFetchingMore, fetchMoreRecords } =
|
||||
useCustomResolver<TimelineThreadsWithTotal>(
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
import { timelineThreadWithTotalFragment } from '@/activities/emails/graphql/queries/fragments/timelineThreadWithTotalFragment';
|
||||
|
||||
export const getTimelineThreadsFromOpportunityId = gql`
|
||||
query GetTimelineThreadsFromOpportunityId(
|
||||
$opportunityId: UUID!
|
||||
$page: Int!
|
||||
$pageSize: Int!
|
||||
) {
|
||||
getTimelineThreadsFromOpportunityId(
|
||||
opportunityId: $opportunityId
|
||||
page: $page
|
||||
pageSize: $pageSize
|
||||
) {
|
||||
...TimelineThreadsWithTotalFragment
|
||||
}
|
||||
}
|
||||
${timelineThreadWithTotalFragment}
|
||||
`;
|
||||
@@ -49,7 +49,10 @@ export const useCustomResolver = <
|
||||
...(activityTargetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Person
|
||||
? { personId: activityTargetableObject.id }
|
||||
: { companyId: activityTargetableObject.id }),
|
||||
: activityTargetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Opportunity
|
||||
? { opportunityId: activityTargetableObject.id }
|
||||
: { companyId: activityTargetableObject.id }),
|
||||
page: 1,
|
||||
pageSize,
|
||||
};
|
||||
|
||||
+32
@@ -142,6 +142,38 @@ export const useRecordShowContainerTabs = (
|
||||
},
|
||||
},
|
||||
},
|
||||
[CoreObjectNameSingular.Opportunity]: {
|
||||
tabs: {
|
||||
emails: {
|
||||
title: 'Emails',
|
||||
position: 600,
|
||||
Icon: IconMail,
|
||||
cards: [{ type: CardType.EmailCard }],
|
||||
hide: {
|
||||
ifMobile: false,
|
||||
ifDesktop: false,
|
||||
ifInRightDrawer: false,
|
||||
ifFeaturesDisabled: [],
|
||||
ifRequiredObjectsInactive: [],
|
||||
ifRelationsMissing: [],
|
||||
},
|
||||
},
|
||||
calendar: {
|
||||
title: 'Calendar',
|
||||
position: 700,
|
||||
Icon: IconCalendarEvent,
|
||||
cards: [{ type: CardType.CalendarCard }],
|
||||
hide: {
|
||||
ifMobile: false,
|
||||
ifDesktop: false,
|
||||
ifInRightDrawer: false,
|
||||
ifFeaturesDisabled: [],
|
||||
ifRequiredObjectsInactive: [],
|
||||
ifRelationsMissing: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
[CoreObjectNameSingular.Workflow]: {
|
||||
hideSummaryAndFields: true,
|
||||
tabs: {
|
||||
|
||||
Reference in New Issue
Block a user