Skip to content

[scheduler] Unify EventSkeleton and ErrorContainer between EventCalendar and EventTimeline #22309

Description

@rita-codes

Follow-up from #22308.

The EventCalendar/EventCalendarPremium and EventTimelinePremium duplicate EventSkeleton and ErrorContainer. Both pairs are flagged with cross-referenced TODO #22309 comments in the source.

Current state

ErrorContainer — structurally identical

  • packages/x-scheduler/src/internals/components/error-container/ErrorContainer.tsx
  • packages/x-scheduler-premium/src/event-timeline-premium/error-container/EventTimelinePremiumErrorContainer.tsx

Both versions are structurally identical. The only differences left are:

  • The store context hook (useEventCalendarStoreContext vs useEventTimelinePremiumStoreContext)
  • The styled context hook (useEventCalendarStyledContext vs useEventTimelinePremiumStyledContext)
  • The styled() name field (MuiEventCalendar vs MuiEventTimeline)

EventSkeleton — diverges in sizing

  • packages/x-scheduler/src/internals/components/event-skeleton/EventSkeleton.tsx
  • packages/x-scheduler-premium/src/event-timeline-premium/content/event-skeleton/EventTimelinePremiumSkeleton.tsx

The calendar version takes a required data-variant: 'time-column' | 'day-grid' | 'agenda' prop and applies different layout per variant (absolute positioning vs fixed heights). The timeline version has no variant — single theme-derived height + width: 100%.

Proposed approach

Create two shared components in packages/x-scheduler/src/internals/components/ with their own theme namespaces (following the MuiEventDialog precedent for shared scheduler components):

EventSkeleton

  • New theme name: MuiEventSkeleton.
  • Add a fourth variant 'timeline-row' (theme-derived height + width: 100%) so the timeline can consume the same component.
  • Both products use the shared component with the appropriate variant.
  • Delete EventTimelinePremiumSkeleton.tsx.

ErrorContainer

  • New theme name: MuiEventErrorContainer.
  • Pass the store as a prop (or via a small product-agnostic hook) so the shared component is decoupled from a specific store context.
  • Both products use it.
  • Delete EventTimelinePremiumErrorContainer.tsx.

Each product can keep a thin wrapper if it needs to inject the store/classes from its own styled context, but the styled root + JSX lives in the shared component.

What to clean up

  • The four TODO #22309 comments in the source files linked above.
  • The duplicated component files in packages/x-scheduler-premium/src/event-timeline-premium/.
  • Any imports/exports referencing the removed components.

Notes for the implementer

  • The scheduler is in alpha, so introducing new theme namespaces is acceptable.
  • Existing consumers using theme.components.MuiEventCalendar.styleOverrides.eventSkeleton (or the MuiEventTimeline equivalent) will lose their override after the rename — document this as a breaking change in the PR description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: schedulerChanges related to the scheduler.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions