diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatus.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatus.tsx deleted file mode 100644 index 6d539bb99a..0000000000 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatus.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import groupBy from 'lodash.groupby'; - -import { CalendarEventParticipantsResponseStatusField } from '@/activities/calendar/components/CalendarEventParticipantsResponseStatusField'; -import { type CalendarEventParticipant } from '@/activities/calendar/types/CalendarEventParticipant'; -import { PropertyBox } from '@/object-record/record-inline-cell/property-box/components/PropertyBox'; - -export const CalendarEventParticipantsResponseStatus = ({ - participants, -}: { - participants: CalendarEventParticipant[]; -}) => { - const groupedParticipants = groupBy(participants, (participant) => { - switch (participant.responseStatus) { - case 'ACCEPTED': - return 'Yes'; - case 'DECLINED': - return 'No'; - case 'NEEDS_ACTION': - case 'TENTATIVE': - return 'Maybe'; - default: - return ''; - } - }); - - const responseStatusOrder: Array<'Yes' | 'Maybe' | 'No'> = [ - 'Yes', - 'Maybe', - 'No', - ]; - - return ( - - {responseStatusOrder.map((responseStatus) => ( - - ))} - - ); -}; diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx deleted file mode 100644 index 4cbcb72bcb..0000000000 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { styled } from '@linaria/react'; -import { useContext, useRef } from 'react'; - -import { ParticipantChip } from '@/activities/components/ParticipantChip'; -import { type CalendarEventParticipant } from '@/activities/calendar/types/CalendarEventParticipant'; -import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay'; -import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList'; -import { IconCheck, IconQuestionMark, IconX } from 'twenty-ui/icon'; -import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; - -const StyledResponseStatusRow = styled.div` - align-items: center; - box-sizing: border-box; - display: flex; - gap: ${themeCssVariables.spacing[1]}; - min-height: ${themeCssVariables.spacing[6]}; - position: relative; - user-select: none; - width: 100%; -`; - -const StyledIconContainer = styled.div` - align-items: center; - color: ${themeCssVariables.font.color.tertiary}; - display: flex; - width: 16px; - - svg { - align-items: center; - display: flex; - height: 16px; - justify-content: center; - width: 16px; - } -`; - -const StyledLabelAndIconContainer = styled.div` - align-items: center; - color: ${themeCssVariables.font.color.tertiary}; - display: flex; - gap: ${themeCssVariables.spacing[1]}; -`; - -const StyledLabelContainer = styled.div<{ width?: number }>` - color: ${themeCssVariables.font.color.tertiary}; - font-size: ${themeCssVariables.font.size.sm}; - width: ${({ width }) => (width !== undefined ? `${width}px` : 'auto')}; -`; - -const StyledParticipantsContainer = styled.div` - max-width: 70%; -`; - -export const CalendarEventParticipantsResponseStatusField = ({ - responseStatus, - participants, -}: { - responseStatus: 'Yes' | 'Maybe' | 'No'; - participants: CalendarEventParticipant[]; -}) => { - const { theme } = useContext(ThemeContext); - - const Icon = { - Yes: , - Maybe: , - No: , - }[responseStatus]; - - const orderedParticipants = [ - ...participants.filter((participant) => participant.person), - ...participants.filter((participant) => participant.workspaceMember), - ...participants.filter( - (participant) => !participant.person && !participant.workspaceMember, - ), - ]; - - const participantsContainerRef = useRef(null); - const styledChips = orderedParticipants.map((participant) => ( - - )); - - return ( - - - {Icon} - - {responseStatus} - - - - {styledChips} - - - ); -}; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/CalendarEventParticipantsFieldWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/CalendarEventParticipantsFieldWidget.tsx deleted file mode 100644 index 8155303d5b..0000000000 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/CalendarEventParticipantsFieldWidget.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { CalendarEventParticipantsResponseStatus } from '@/activities/calendar/components/CalendarEventParticipantsResponseStatus'; -import { type CalendarEventParticipant } from '@/activities/calendar/types/CalendarEventParticipant'; -import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; - -const CALENDAR_EVENT_PARTICIPANT_OBJECT_NAME_SINGULAR = - 'calendarEventParticipant'; - -type CalendarEventParticipantsFieldWidgetProps = { - recordId: string; -}; - -type CalendarEventParticipantRecord = CalendarEventParticipant & { - __typename: 'CalendarEventParticipant'; -}; - -export const CalendarEventParticipantsFieldWidget = ({ - recordId, -}: CalendarEventParticipantsFieldWidgetProps) => { - const { records: calendarEventParticipants } = - useFindManyRecords({ - objectNameSingular: CALENDAR_EVENT_PARTICIPANT_OBJECT_NAME_SINGULAR, - filter: { - calendarEventId: { - eq: recordId, - }, - }, - recordGqlFields: { - id: true, - person: true, - workspaceMember: true, - isOrganizer: true, - responseStatus: true, - handle: true, - displayName: true, - }, - }); - - if (calendarEventParticipants.length === 0) { - return null; - } - - return ( - - ); -}; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx index 234be9939e..5709aa270b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx @@ -9,7 +9,6 @@ import { hasJunctionConfig } from '@/object-record/record-field/ui/utils/junctio import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; import { useResolveFieldMetadataIdFromNameOrId } from '@/page-layout/hooks/useResolveFieldMetadataIdFromNameOrId'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; -import { CalendarEventParticipantsFieldWidget } from '@/page-layout/widgets/field/components/CalendarEventParticipantsFieldWidget'; import { FieldWidgetDisplay } from '@/page-layout/widgets/field/components/FieldWidgetDisplay'; import { FieldWidgetJunctionRelationCard } from '@/page-layout/widgets/field/components/FieldWidgetJunctionRelationCard'; import { FieldWidgetJunctionRelationField } from '@/page-layout/widgets/field/components/FieldWidgetJunctionRelationField'; @@ -27,7 +26,6 @@ import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelCont import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; -import { CoreObjectNameSingular } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { AnimatedPlaceholder, @@ -101,19 +99,6 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { const fieldDisplayMode = widget.configuration.fieldDisplayMode; - const isCalendarEventParticipantsField = - targetRecord.targetObjectNameSingular === - CoreObjectNameSingular.CalendarEvent && - fieldMetadataItem.name === 'calendarEventParticipants'; - - if (isCalendarEventParticipantsField) { - return ( - - - - ); - } - if (isFieldMorphRelation(fieldDefinition)) { if (fieldDisplayMode === FieldDisplayMode.CARD) { return (