Commit graph

422 commits

Author SHA1 Message Date
Janus C. H. Knudsen
75d03fe577 Improves drag and drop position calculation
Refines drag and drop functionality by calculating position relative to the column during drag and snapping to the grid on mouse up, resulting in more precise placement.

Addresses an issue where the dragged element's position was not correctly calculated relative to the target column.
2025-10-08 19:01:35 +02:00
Janus C. H. Knudsen
a8b9767524 Implements smooth drag animation
Implements a smooth drag animation for a more fluid user experience.

Instead of directly snapping to the mouse position, it interpolates
the position over time using `requestAnimationFrame`. This provides
a visually smoother movement during drag operations.
2025-10-08 18:30:03 +02:00
Janus C. H. Knudsen
3145752591 Improves event hover highlighting
Uses CSS classes for event hover highlighting,
instead of directly manipulating the background color.
This allows for more flexible and maintainable styling.

Re-enables resize handle manager.
Removes console logs.
2025-10-08 18:15:00 +02:00
Janus C. H. Knudsen
8b8a1e3127 wip, resize, debugging 2025-10-08 00:58:38 +02:00
Janus C. H. Knudsen
e2cf4d1e04 Improves click handling on calendar elements
Removes `pointer-events: none` from various calendar elements.
This ensures that the elements are correctly interactive,
allowing the user to click on them as intended.
2025-10-07 17:36:03 +02:00
Janus C. H. Knudsen
3982e2f25f Improves resize handle appearance
Enhances the visual design of the resize handle for calendar events, making it more prominent and user-friendly.

- Updates the handle's styling with a darker background, increased size, and refined shadow.
- Replaces grip dots with grip lines for a cleaner look.
2025-10-07 17:21:23 +02:00
Janus C. H. Knudsen
70dce9fd59 Improves event resize handle interaction
Enhances the resize handle indicator for calendar events by using cached event elements for efficiency.

This eliminates the need to constantly query the DOM, and only refreshes the cache on relevant event changes.

Additionally updates the resize indicator style for improved visual clarity and user experience.
2025-10-07 17:16:00 +02:00
Janus C. H. Knudsen
a9819a8bf1 Enables event resizing via drag handles
Adds a resize handle manager to handle mouse hover
effects on calendar events and display a resize indicator.

This allows users to visually identify and initiate
event resizing by hovering near the bottom edge of an event.
2025-10-06 23:38:01 +02:00
Janus C. H. Knudsen
7d7a8d9208 wip 2025-10-06 22:29:31 +02:00
Janus C. H. Knudsen
9981a5a5af Trying to adjust top for clear time lines 2025-10-06 22:06:00 +02:00
Janus C. H. Knudsen
e838719d46 Cleanup 2025-10-06 21:55:52 +02:00
Janus C. H. Knudsen
69495ce00f cleanup 2025-10-06 21:39:57 +02:00
Janus C. H. Knudsen
faa59f6a3c Improves event layout and stacking logic
Refactors the event layout and stacking logic based on review feedback.

This includes:
- Merging conflicting event groups to prevent inconsistencies.
- Implementing minimal stack level assignment using a min-heap.
- Consolidating styling and using DateService for drag operations.
- Adding reflow after drag and drop.
- Improving the column event filtering to include events overlapping midnight.
- Ensuring explicit sorting of events for grid layout.
2025-10-06 21:16:29 +02:00
Janus C. H. Knudsen
b590467f60 Improves event grid layout logic
Refines the event grid layout algorithm to more accurately
identify conflicting events for stacking within the grid.

Now uses an expanding search to find chains of conflicting events,
ensuring that all events that should be grouped together are
correctly identified.
2025-10-06 18:46:07 +02:00
Janus C. H. Knudsen
06356df2a3 Implements event layout coordinator
Introduces a coordinator to manage event layout calculations,
separating this logic from rendering.
It calculates stack levels and allocates event columns for
improved visual organization of calendar events.
2025-10-06 17:53:25 +02:00
Janus C. H. Knudsen
6b8c5d4673 Stacking and Sharecolumn WIP 2025-10-06 17:05:18 +02:00
Janus C. H. Knudsen
c788a1695e Extracts event layout calculations
Moves complex layout determination logic (grid grouping, stack levels, positioning) from `EventRenderer` to a new `EventLayoutCoordinator` class.

Delegates layout responsibilities to the coordinator, significantly simplifying the `EventRenderer`'s `renderColumnEvents` method. Refines `EventStackManager` by removing deprecated layout methods, consolidating its role to event grouping and core stack level management.

Improves modularity and separation of concerns within the rendering pipeline.
2025-10-06 00:24:13 +02:00
Janus C. H. Knudsen
2f58ceccd4 Implements advanced event stacking and grid layout
Introduces a 3-phase algorithm in `EventStackManager` for dynamic event positioning. Groups events by start time proximity to determine optimal layout.

Optimizes horizontal space by using side-by-side grid columns for simultaneous events and allowing non-overlapping events to share stack levels. Supports nested stacking for late-arriving events within grid columns.

Includes comprehensive documentation (`STACKING_CONCEPT.md`) and a visual demonstration (`stacking-visualization.html`) to explain the new layout logic. Updates event rendering to utilize the new manager and adds extensive test coverage.
2025-10-05 23:54:50 +02:00
Janus C. H. Knudsen
57bf122675 Moves event positioning to renderer
Relocates event CSS positioning logic from the `SwpEventElement` to the `DateEventRenderer`. This improves separation of concerns, making the renderer responsible for event layout.
2025-10-05 21:53:25 +02:00
Janus C. H. Knudsen
5fae433afb Allows dynamic drag clone replacement
Introduces a polymorphic `createClone` method on base event elements to customize clone generation.
Adds a `replaceClone` delegate to drag event payloads, enabling subscribers to dynamically swap the active dragged clone.
This supports scenarios like converting a standard event clone to an all-day event clone when dragging to the all-day header.
2025-10-04 23:10:09 +02:00
Janus C. H. Knudsen
125cd678a3 Refactors drag header interaction logic
Improves efficiency and reliability of drag-and-drop operations involving calendar headers.

Transitions from continuous polling within `handleMouseMove` to using native `mouseenter` and `mouseleave` events with delegation on `swp-calendar-header` elements. This change ensures more precise and performant detection of header interactions during a drag.

Also enhances the initial event detection logic to correctly identify `SWP-ALLDAY-EVENT` elements when starting a drag.
2025-10-04 21:12:52 +02:00
Janus C. H. Knudsen
420036d939 wwip 2025-10-04 16:20:09 +02:00
Janus C. H. Knudsen
a9d6d14c93 Refactors event element handling with web components
Introduces web components for event elements, separating timed and all-day events into distinct components for better organization and reusability.

This change also simplifies event rendering and drag-and-drop operations by leveraging the properties and lifecycle methods of web components.
2025-10-04 15:35:09 +02:00
Janus C. H. Knudsen
1a47214831 Remove this stupid stacking logic 2025-10-04 14:50:25 +02:00
Janus C. H. Knudsen
fc884efa71 Improves event overlap handling
Refactors event rendering to handle transitive overlaps, ensuring that entire chains of overlapping events are correctly processed.

Fixes an issue where only direct overlaps were re-rendered after a drag and drop, leading to inconsistent stacking.
Now collects and re-renders all events in the stack.
2025-10-04 00:51:21 +02:00
Janus C. H. Knudsen
9bc082eed4 Improves date handling and event stacking
Enhances date validation and timezone handling using DateService, ensuring data integrity and consistency.

Refactors event rendering and dragging to correctly handle date transformations.

Adds a test plan for event stacking and z-index management.

Fixes edge cases in navigation and date calculations for week/year boundaries and DST transitions.
2025-10-04 00:32:26 +02:00
Janus C. H. Knudsen
a86a736340 Refactors date handling to use DateService
Standardizes date manipulation across the application by leveraging the DateService.
This change improves consistency and reduces code duplication by removing redundant date calculations.
2025-10-03 20:59:52 +02:00
Janus C. H. Knudsen
6bbf2d8adb Refactors date handling with DateService
Replaces DateCalculator with DateService for improved date and time operations, including timezone handling.

This change enhances the calendar's accuracy and flexibility in managing dates, especially concerning timezone configurations.
It also corrects a typo in the `allDay` dataset attribute.
2025-10-03 20:50:40 +02:00
Janus C. H. Knudsen
4859f42450 Enhances date handling and formatting
Improves date validation and adds flexible date/time formatting capabilities.

The date validation is updated to return a boolean and is incorporated directly into calling functions to throw errors, improving code readability and maintainability. DateService is extended with functions for formatting time in 12-hour format, getting day names, and formatting date ranges with customizable options.
2025-10-03 19:48:04 +02:00
Janus C. H. Knudsen
4fea01c76b Improves all-day event drag and drop
Addresses issues with all-day event duration calculation and positioning during drag and drop.

- Uses `differenceInCalendarDays` to correctly calculate event duration across timezone and DST boundaries.
- Preserves the original event time when moving events to a different day.
- Snaps dragged event to the top of the target time slot.
2025-10-03 19:09:44 +02:00
Janus C. H. Knudsen
53cf097a47 Introduces DateService for time zone handling
Adds DateService using date-fns-tz for robust time zone
conversions and date manipulations.

Refactors DateCalculator and TimeFormatter to utilize the
DateService, centralizing date logic and ensuring consistent
time zone handling throughout the application.

Improves event dragging by updating time displays and data
attributes, handling cross-midnight events correctly.
2025-10-03 16:47:42 +02:00
Janus C. H. Knudsen
1821d805d1 Comments out timestamp update in dragged clone
Comments out the timestamp update logic within the dragged clone functionality.

This change is a preliminary step towards refactoring the scroll logic, which will be managed by a dedicated scroll manager, decoupling it from the event renderer.
2025-10-03 16:33:26 +02:00
Janus C. H. Knudsen
38737762c5 Adds technical date and time formatting
Adds options for technical date and time formatting and includes the option to show seconds.

Updates time formatting to use UTC-to-local conversion and ensures consistent colon separators for time values.

Adjusts all-day event handling to preserve original start/end times.
2025-10-03 16:05:22 +02:00
Janus C. H. Knudsen
c8d78f472d Adds mock events data
Initializes a mock JSON file to provide sample data for events.
This data includes various event types with metadata.
2025-10-03 15:00:16 +02:00
Janus C. H. Knudsen
98ad46efab Preserves event duration during drag and drop
Ensures all-day events maintain their original duration
when dragged and dropped to a new date.

Calculates and applies the correct end date based on the
original event's span.
2025-10-03 00:37:37 +02:00
Janus C. H. Knudsen
576367974b Fixes all-day event dragging issues
Addresses issues with dragging all-day events, ensuring correct event placement and layout calculations after a drag and drop operation.
Specifically, ensures the correct event ID is used and updates the event layout when dragging all day events.
2025-10-02 23:58:03 +02:00
Janus C. H. Knudsen
89e8a3f7b2 wip 2025-10-02 23:11:26 +02:00
Janus C. H. Knudsen
88702e574a Improves drag and drop all-day event handling
Refines drag and drop behavior for all-day events.

Removes unnecessary logging and conditional logic in the
AllDayManager.

Simplifies column change handling in the EventRendererManager.
2025-10-02 17:40:58 +02:00
Janus C. H. Knudsen
5cdcd12e0a Updates all-day event overflow indicator
Ensures that the all-day event overflow indicator updates
correctly when the number of events changes, instead of
creating duplicate indicators.
Removes unused event click handling logic.
2025-10-02 17:30:48 +02:00
Janus C. H. Knudsen
496be2f7ce Improves all-day event overflow handling
Ensures correct display of all-day events when collapsed or expanded.

Improves the transition between collapsed and expanded states by
adjusting the overflow event visibility.
2025-10-02 16:57:43 +02:00
Janus C. H. Knudsen
0bf369907b Refactors all-day event overflow toggle.
Simplifies the all-day event overflow toggle logic by using distinct class names and avoiding direct class switching, improving code readability and maintainability.
2025-10-02 16:05:11 +02:00
Janus C. H. Knudsen
13b72b55b2 wip 2025-10-02 16:01:36 +02:00
Janus C. H. Knudsen
54acdb9b41 WIP 2025-10-02 15:57:11 +02:00
Janus C. H. Knudsen
0f2d96f76f Consolidates all-day event row limit
Centralizes the maximum number of displayed all-day event rows into a single constant.

This change ensures consistency and simplifies management of the all-day event row limit across the application.

Corrects off-by-one error in overflow count.
2025-10-02 15:37:01 +02:00
Janus C. H. Knudsen
135787146c Refines all-day event display
Improves the visual appearance of all-day events
by adjusting padding and margins.

Reduces padding in the all-day container and adds
margins to individual events for better spacing.
2025-10-02 01:11:32 +02:00
Janus C. H. Knudsen
f2ad13776f Improves all-day event row height calculation
Ensures consistent all-day event row height calculation across CSS and TypeScript.

The all-day event row height calculation is adjusted by removing redundant container padding from the TypeScript constant and synchronizing the CSS variable with the event height.

Additionally, the layout engine is directly tested in the test file for better coverage.
2025-10-02 01:03:35 +02:00
Janus C. H. Knudsen
a1e1c5d185 Removes unnecessary destroy methods 2025-10-01 22:38:15 +02:00
Janus C. H. Knudsen
4e5077364e Improves all-day event layout calculation
Refactors all-day event layout calculation to use the header elements directly.

This change improves the accuracy of event positioning
and fixes potential issues with date handling.
2025-10-01 21:47:05 +02:00
Janus C. H. Knudsen
d7867d4a9f Renders all-day events based on header data
Refactors all-day event rendering to use header column data.
This ensures events are rendered based on the actual visible
dates in the header, improving accuracy and responsiveness to view changes.

Removes direct dependency on week dates in `AllDayManager` and
`EventRenderingService`, instead, the all-day manager is instantiated
with event manager.

Updates `HeaderManager` to emit header bounds.
2025-10-01 21:27:13 +02:00
Janus C. H. Knudsen
ae3aab5dd0 Improves all-day event layout and drag behavior
Refactors all-day event layout calculation and rendering for improved accuracy and performance.

Improves drag-and-drop behavior for all-day events, ensuring correct event placement and column detection.

Addresses issues with event overflow display and provides a more responsive user experience.
2025-10-01 18:41:28 +02:00