Skip to content

🐛Fix: All-day Drag position#242

Merged
tyler-dane merged 3 commits intomainfrom
refactor/236-overlapping-events
Jan 31, 2025
Merged

🐛Fix: All-day Drag position#242
tyler-dane merged 3 commits intomainfrom
refactor/236-overlapping-events

Conversation

@tyler-dane
Copy link
Copy Markdown
Contributor

@tyler-dane tyler-dane commented Jan 31, 2025

Fixes bug from #240, which caused all-day events to lose their position during drags.

Also does minor follow-ups to #236 , which also cleans up surrounding code for readability

This pull request includes significant changes aimed at refactoring and simplifying the codebase, specifically around event positioning and width calculations in the calendar grid. The changes involve moving several utility functions to a new file and removing redundant code.

Refactoring and Simplification:

  • packages/web/src/common/utils/grid.util.ts: Removed multiple methods related to event positioning and width calculations, such as getAllDayEventWidth, getEventCategory, getLeftPosition, and widthMinusPadding. These methods were moved to a new file for better organization. [1] [2] [3] [4]
  • packages/web/src/common/utils/position.util.ts: Added a new file that now contains the methods for calculating event positions and widths, such as getAbsoluteLeftPosition, getAllDayEventWidth, getEventCategory, and getLeftPosition. This helps in organizing the code better and making it more modular.

File Renaming and Import Adjustments:

  • packages/web/src/__tests__/utils/grid.util/grid.util2.test.ts: Renamed to packages/web/src/common/utils/position.util.test.ts to reflect the new organization of utility functions.
  • packages/web/src/views/Calendar/components/Event/Grid/GridEvent/GridEvent.tsx and packages/web/src/views/Calendar/components/Grid/AllDayRow/AllDayEvent.tsx: Updated imports to use the newly created position.util.ts file for event positioning functions. [1] [2]

Removal of Redundant Files:

  • packages/web/src/views/Calendar/hooks/event/getPosition.ts and packages/web/src/views/Calendar/hooks/event/useEventPosition.ts: Removed these files as their functionality has been moved to the new position.util.ts file. [1] [2]

Layout Constants Adjustment:

@tyler-dane tyler-dane force-pushed the refactor/236-overlapping-events branch from 18b219d to a947f62 Compare January 31, 2025 14:39
@tyler-dane tyler-dane changed the title ♻️ Refactor: Cleanup event positioning utilities 🐛Fix: All-day Drag position Jan 31, 2025
@tyler-dane tyler-dane marked this pull request as ready for review January 31, 2025 15:32
@tyler-dane tyler-dane linked an issue Jan 31, 2025 that may be closed by this pull request
2 tasks
@tyler-dane tyler-dane merged commit 393cdff into main Jan 31, 2025
3 checks passed
@tyler-dane tyler-dane deleted the refactor/236-overlapping-events branch January 31, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve overlapping events: spacing and drag-and-drop UX

1 participant