f8dff23a3e
## Summary This PR refactors the EventRow component structure by extracting shared types and styled components into a dedicated base file, improving code organization and reducing duplication. ## Key Changes - Created new `EventRowBase.tsx` file to centralize shared EventRow utilities - Moved `EventRowDynamicComponentProps` interface from `EventRowDynamicComponent.tsx` to `EventRowBase.tsx` - Moved styled components `StyledEventRowItemColumn` and `StyledEventRowItemAction` from `EventRowDynamicComponent.tsx` to `EventRowBase.tsx` - Updated all imports across 6 files to reference the new `EventRowBase` module instead of `EventRowDynamicComponent` - Simplified `EventRowDynamicComponent.tsx` to re-export types and styles from `EventRowBase` for backward compatibility ## Files Updated - `EventRowDynamicComponent.tsx` - Simplified to import and re-export from EventRowBase - `EventRowActivity.tsx` - Updated import path - `EventRowCalendarEvent.tsx` - Updated import path - `EventRowMainObject.tsx` - Updated import path - `EventRowMainObjectUpdated.tsx` - Updated import path - `EventRowMessage.tsx` - Updated import path ## Benefits - Better separation of concerns with shared base utilities in a dedicated module - Reduced circular dependency risks - Clearer module structure for future EventRow-related components - Maintains backward compatibility through re-exports https://claude.ai/code/session_011EyhBJ56RGuZHxBVWwzEQy --------- Co-authored-by: Claude <noreply@anthropic.com>
74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
import { EventRowActivity } from '@/activities/timeline-activities/rows/activity/components/EventRowActivity';
|
|
import { EventRowCalendarEvent } from '@/activities/timeline-activities/rows/calendar/components/EventRowCalendarEvent';
|
|
import { type EventRowDynamicComponentProps } from '@/activities/timeline-activities/rows/components/EventRowDynamicComponent.types';
|
|
import { EventRowMainObject } from '@/activities/timeline-activities/rows/main-object/components/EventRowMainObject';
|
|
import { EventRowMessage } from '@/activities/timeline-activities/rows/message/components/EventRowMessage';
|
|
import { CoreObjectNameSingular } from 'twenty-shared/types';
|
|
|
|
export const EventRowDynamicComponent = ({
|
|
labelIdentifierValue,
|
|
event,
|
|
mainObjectMetadataItem,
|
|
linkedObjectMetadataItem,
|
|
authorFullName,
|
|
createdAt,
|
|
}: EventRowDynamicComponentProps) => {
|
|
switch (linkedObjectMetadataItem?.nameSingular) {
|
|
case 'calendarEvent':
|
|
return (
|
|
<EventRowCalendarEvent
|
|
labelIdentifierValue={labelIdentifierValue}
|
|
event={event}
|
|
mainObjectMetadataItem={mainObjectMetadataItem}
|
|
linkedObjectMetadataItem={linkedObjectMetadataItem}
|
|
authorFullName={authorFullName}
|
|
/>
|
|
);
|
|
case 'message':
|
|
return (
|
|
<EventRowMessage
|
|
labelIdentifierValue={labelIdentifierValue}
|
|
event={event}
|
|
mainObjectMetadataItem={mainObjectMetadataItem}
|
|
linkedObjectMetadataItem={linkedObjectMetadataItem}
|
|
authorFullName={authorFullName}
|
|
/>
|
|
);
|
|
case 'task':
|
|
return (
|
|
<EventRowActivity
|
|
labelIdentifierValue={labelIdentifierValue}
|
|
event={event}
|
|
mainObjectMetadataItem={mainObjectMetadataItem}
|
|
linkedObjectMetadataItem={linkedObjectMetadataItem}
|
|
authorFullName={authorFullName}
|
|
objectNameSingular={CoreObjectNameSingular.Task}
|
|
createdAt={createdAt}
|
|
/>
|
|
);
|
|
case 'note':
|
|
return (
|
|
<EventRowActivity
|
|
labelIdentifierValue={labelIdentifierValue}
|
|
event={event}
|
|
mainObjectMetadataItem={mainObjectMetadataItem}
|
|
linkedObjectMetadataItem={linkedObjectMetadataItem}
|
|
authorFullName={authorFullName}
|
|
objectNameSingular={CoreObjectNameSingular.Note}
|
|
createdAt={createdAt}
|
|
/>
|
|
);
|
|
default:
|
|
return (
|
|
<EventRowMainObject
|
|
labelIdentifierValue={labelIdentifierValue}
|
|
event={event}
|
|
mainObjectMetadataItem={mainObjectMetadataItem}
|
|
linkedObjectMetadataItem={linkedObjectMetadataItem}
|
|
authorFullName={authorFullName}
|
|
createdAt={createdAt}
|
|
/>
|
|
);
|
|
}
|
|
};
|