Enable editing for calendar event custom fields (#17063)
## Summary - Enable editing for custom calendar event fields while keeping standard fields read-only - Load calendar event fields dynamically so custom field values are editable everywhere they appear - Preserve calendar event participants rendering ## Testing - npx nx run twenty-front:lint:diff-with-main --skip-nx-cache --output-style=stream - npx jest --config packages/twenty-front/jest.config.mjs --runTestsByPath packages/twenty-front/src/modules/activities/calendar/hooks/__tests__/useCalendarEvents.test.tsx ## Notes - Full nx lint/test are very slow locally after barrel generation; CI should run the full suite --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+25
-4
@@ -1,8 +1,9 @@
|
||||
import { CalendarEventDetails } from '@/activities/calendar/components/CalendarEventDetails';
|
||||
import { CalendarEventDetailsEffect } from '@/activities/calendar/components/CalendarEventDetailsEffect';
|
||||
import { FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE } from '@/activities/calendar/graphql/operation-signatures/FindOneCalendarEventOperationSignature';
|
||||
import { type CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
|
||||
import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graphql/record-gql-fields/hooks/useGenerateDepthRecordGqlFieldsFromObject';
|
||||
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
@@ -13,11 +14,31 @@ export const CommandMenuCalendarEventPage = () => {
|
||||
viewableRecordIdComponentState,
|
||||
);
|
||||
|
||||
const { recordGqlFields } = useGenerateDepthRecordGqlFieldsFromObject({
|
||||
objectNameSingular: CoreObjectNameSingular.CalendarEvent,
|
||||
depth: 1,
|
||||
});
|
||||
|
||||
const calendarEventRecordGqlFields = {
|
||||
...recordGqlFields,
|
||||
calendarEventParticipants: {
|
||||
id: true,
|
||||
person: true,
|
||||
workspaceMember: true,
|
||||
isOrganizer: true,
|
||||
responseStatus: true,
|
||||
handle: true,
|
||||
createdAt: true,
|
||||
calendarEventId: true,
|
||||
updatedAt: true,
|
||||
displayName: true,
|
||||
},
|
||||
};
|
||||
|
||||
const { record: calendarEvent } = useFindOneRecord<CalendarEvent>({
|
||||
objectNameSingular:
|
||||
FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE.objectNameSingular,
|
||||
objectNameSingular: CoreObjectNameSingular.CalendarEvent,
|
||||
objectRecordId: viewableRecordId ?? '',
|
||||
recordGqlFields: FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE.fields,
|
||||
recordGqlFields: calendarEventRecordGqlFields,
|
||||
// TODO: this is not executed on sub-sequent runs, make sure that it is intended
|
||||
onCompleted: (record) => {
|
||||
upsertRecordsInStore({ partialRecords: [record] });
|
||||
|
||||
Reference in New Issue
Block a user