Commit graph

38 commits

Author SHA1 Message Date
69f4a71062 Adjusts event clone styling for drag operation
Ensures dragged event clones maintain correct positioning
by setting `marginLeft` to `0px`. This fixes a potential
visual issue where the clone might not fill the full
column width during dragging.
2025-09-09 17:46:48 +02:00
6402cd4565 Updates drag-and-drop overlap handling
Replaces the old overlap handling system with a new approach.

The new system recalculates overlaps after a drag-and-drop action and re-renders the affected events, avoiding manual group management. This simplifies the overlap resolution logic and improves performance.
2025-09-09 17:30:44 +02:00
80ef35c42c Refactors project structure and event rendering
Restructures the project for better maintainability and clarity.  Adds a ManagerFactory for dependency injection and reorganizes files.

Updates event rendering logic to correctly handle overlapping events using a stack link system. The EventRendererStrategy now correctly processes and renders event overlaps, ensuring proper display. Introduces processing tracking to avoid double rendering.

Updates documentation to reflect the new structure and build process. Also implements changes to build output and event system for improved clarity.

Fixes #123
2025-09-09 17:15:06 +02:00
Janus Knudsen
72019a3d9a wip 2025-09-09 14:35:21 +02:00
Janus Knudsen
727a6ec53a Fixes event stacking order during drag and drop
Ensures existing events maintain their base positions when a new event is dragged and dropped into an overlapping time slot.

The fix prioritizes existing events in the stack, placing the newly dropped event on top. This ensures correct visual representation and expected behavior during event manipulation.
2025-09-04 23:56:22 +02:00
Janus Knudsen
5bdb2f578d Simplifies event overlap management
Refactors event overlap handling to use a DOM-centric approach with data attributes for stack tracking. This eliminates complex state management, reduces code complexity, and improves maintainability. Removes the previous Map-based linked list implementation.

The new approach offers better debugging, automatic memory management, and eliminates state synchronization bugs.

The solution maintains identical functionality with a significantly simpler implementation, focusing on DOM manipulation for visual stacking and column sharing.

Addresses potential performance concerns of DOM queries by scoping them to specific containers.
2025-09-04 23:35:19 +02:00
Janus Knudsen
f5a6b80549 Improves event overlap detection
Refactors event overlap detection to use pixel-based comparison.
This improves accuracy and addresses issues with incorrect overlap
calculations when events have slight time differences but visually overlap.
It removes dependency on the event manager and the need to convert elements
to calendar events for overlap detection.
2025-09-04 20:32:25 +02:00
Janus Knudsen
1aef54bffb Improves event overlap detection logic
Refactors event dropping logic to first check for existing
event groups. If a group exists and the dropped event overlaps
with it, the dropped event is added to the group. Otherwise,
it proceeds with full overlap detection against individual events.

This change prevents unnecessary group creation and optimizes
event arrangement within columns. It also ensures the dragged
event is placed on the rightmost side by adding it to the
overlapping events array last.
2025-09-04 20:06:09 +02:00
Janus Knudsen
6afea2571b Fixes event overlap detection and stacking logic
Updates the event overlap detection to accurately determine when events overlap in time, fixing incorrect stacking behavior.

Implements column sharing for events starting within 30 minutes of each other.

Applies stacking only when events truly overlap in time but start times differ by more than 30 minutes.

Removes unnecessary data attributes and simplifies styling for stacked events, improving code cleanliness and performance.
2025-09-04 19:22:26 +02:00
Janus Knudsen
ff067cfac3 Implements event overlap rendering
Adds logic to handle event overlaps in the calendar view. It introduces two patterns: column sharing for events with the same start time (rendered using flexbox) and stacking for events with a >30 min difference (rendered with reduced width and z-index).

It also introduces deep linking to specific events via URL parameters.
2025-09-04 00:16:35 +02:00
Janus Knudsen
7a1c776bc1 Improves drag and drop functionality
Enhances drag and drop behavior by introducing free positioning during auto-scroll and snapping to grid intervals.

- Introduces a `calculateFreePosition` method to allow events to follow the mouse exactly during auto-scroll.
- Modifies the drag move event to emit the snapped position during normal drag behavior.
- Updates event rendering to use grid settings for snap intervals.
- Updates grid styles to configure CSS variables dynamically.
2025-09-03 20:48:23 +02:00
Janus Knudsen
b4d758b6d9 Improves drag and drop autoscroll behavior.
Refines the drag and drop autoscroll functionality to correctly update the position of the dragged element relative to the scrolling container.

Calculates the snapped position based on the column's bounding rectangle and scroll movement, ensuring accurate placement during autoscroll. This provides a smoother and more responsive user experience when dragging elements near the edges of the scrollable area.
2025-09-03 20:13:56 +02:00
Janus Knudsen
2083c6921e Refactors calendar configuration and event handling
Streamlines calendar configuration by adopting a singleton pattern for consistent access and simplifies event handling.

- Removes direct `CalendarConfig` dependency injection in favor of the `calendarConfig` singleton, reducing code complexity.
- Replaces specific event emissions for grid, date, and resource settings updates with a general `REFRESH_REQUESTED` event.
- Updates event names to be more descriptive and consistent ("NAVIGATION_COMPLETED", "PERIOD_INFO_UPDATE").
- Removes the need to pass the calendar config to renderers since it is now a singleton.

This improves code maintainability and simplifies the event emission process.
2025-09-03 20:04:47 +02:00
Janus Knudsen
b8b44ddae8 Refactors DateCalculator to be a static class
This change refactors the DateCalculator class to be a static class.
This removes the need to instantiate DateCalculator in multiple
managers and renderers, simplifying dependency management and
ensuring consistent date calculations across the application.
The configuration is now initialized once at the application start.
2025-09-03 18:38:52 +02:00
Janus Knudsen
0da875a224 Improves performance by caching DOM elements
Caches frequently accessed DOM elements in NavigationManager and
EventRenderer to reduce redundant queries, improving performance.

Updates the event renderer to trigger all-day height animations and
introduces a destroy method for resource management.

Refactors time formatting in EventRenderer to handle both total
minutes and Date objects using a unified method.
2025-09-03 18:15:33 +02:00
Janus Knudsen
542a6874d0 Improves all-day event rendering and animation
Refactors all-day event handling to enhance user experience.

Introduces dynamic height animation for all-day event rows, adapting to the number of overlapping events. This ensures efficient use of screen space and prevents unnecessary scrolling.

Additionally, events now store all relevant data, and the header height is checked and animated after navigation.

The previous HeaderRenderer.ts file has been refactored.
2025-09-01 23:37:47 +02:00
Janus Knudsen
ae42de1f3b Improves all-day event rendering and placement
Simplifies and improves the all-day event rendering process, ensuring
consistent container creation and proper placement of events.

- Ensures all-day containers are consistently created during header
  rendering, preventing potential issues with event placement.
- Removes the complex and unreliable mouseover detection for all-day
  conversion, simplifying the event dragging logic.
- Eliminates the dynamic all-day row height calculation, relying on
  CSS for layout control.
- Prevents errors when the all-day container is missing.
2025-08-31 23:48:34 +02:00
Janus Knudsen
fafad16926 Removes excessive logging statements
Cleans up the codebase by removing unnecessary console log statements.

These logs were primarily used for debugging and are no longer needed in the production code.
This reduces noise in the console and improves overall performance.
2025-08-31 22:39:09 +02:00
Janus Knudsen
383eab7524 Enables all-day event conversion via drag and drop
Allows users to drag timed events to the header area to convert them to all-day events.

This also enables dragging all-day events to different days
by updating the grid column position.

A header mouseover detection is set up to emit the 'header:mouseover' event,
handling both the timed event to all-day conversion and the
all-day event movement to different days.
2025-08-29 22:49:53 +02:00
Janus Knudsen
daa332e8db Improves drag and drop event handling
Refines the drag and drop functionality in the event renderer.

Ensures proper cleanup and normalization of event clones after a drag operation.
Adds logging for debugging purposes.
Initializes drag event listeners within the DateEventRenderer class to ensure listeners are set up.
2025-08-27 23:56:38 +02:00
Janus Knudsen
f697944d75 Implements drag and drop functionality
Introduces a DragDropManager to handle event dragging and dropping, replacing the ColumnDetector.

This change centralizes drag and drop logic, improving code organization and maintainability.

The EventRenderer now uses the DragDropManager's events to visually update the calendar during drag operations.

Removes ColumnDetector which is now replaced by the drag and drop manager.
2025-08-27 22:50:13 +02:00
Janus Knudsen
be4a8af7c4 Updates all-day event grid row layout
Ensures the all-day event container's grid layout is correctly updated to reflect the number of rows needed, even when the overall height doesn't change.
This prevents layout issues when events are rearranged without triggering a height recalculation.
Also updates the grid template when the height is updated in the BaseEventRenderer.
2025-08-27 20:54:06 +02:00
Janus Knudsen
f9b7686b22 Back to a single swp-allday-container 2025-08-26 00:05:42 +02:00
Janus Knudsen
07402a07d9 Improves all-day event rendering and handling
Refactors all-day event container handling to improve rendering and event delegation.

Ensures all-day containers are consistently created and managed,
preventing issues with event display and drag-and-drop functionality.

Moves event listener setup into dedicated methods for better
organization and reusability.
2025-08-25 22:05:57 +02:00
Janus Knudsen
f2763ad826 Improves all-day event drag and drop
Handles dragging of both timed events (converting to all-day) and existing all-day events to different days.

Refactors all-day height recalculation to support animated transitions for a smoother user experience when all-day event counts change.

Uses event delegation for header mouseover detection.

Updates ScrollManager to listen for header height changes.
2025-08-25 21:20:51 +02:00
Janus Knudsen
eb08a28495 Improves all-day event drag and drop
Enhances the drag and drop experience for all-day events by expanding the header to display the all-day row when dragging an event over it.

Introduces constants for all-day event layout.
2025-08-24 23:31:11 +02:00
Janus Knudsen
9c65143df2 Refactors event rendering and display
Improves event rendering by introducing dedicated event
renderers and streamlining event display logic.

- Adds a base event renderer and specialized date and
  resource-based renderers to handle event display logic.
- Renders all-day events within a dedicated container in the
  calendar header.
- Removes the direct filtering of all-day events from the
  `GridManager`.
- Fixes an issue where the 'Summer Festival' event started on the
  wrong date.

The changes enhance the flexibility and maintainability of the
calendar, provide dedicated containers and styling for allday events and fix date issues related to certain events
2025-08-24 00:13:07 +02:00
Janus Knudsen
a3ed03ff44 Adds work hours management with day-specific overrides
Introduces work hours management with weekly default and date-specific overrides to support per-column scheduling.

Calculates and applies non-work hour overlays to columns.
This allows users to visualize working and non-working times.

Adjusts event rendering to prevent overlap with horizontal timelines.
2025-08-22 22:57:35 +02:00
Janus Knudsen
18c12cd3e6 Adds month view design and styling
Introduces basic month view structure and styling with week numbers.

Creates expanded month view with event details and duration-based sizing.

Moves event color handling to CSS classes for better flexibility and theming.
2025-08-21 22:09:15 +02:00
Janus Knudsen
83c0ce801c Refactors event handling and grid rendering
Improves calendar performance and data flow by streamlining event emissions and grid rendering logic.

- Replaces generic CONFIG_UPDATE events with REFRESH_REQUESTED
  for more specific refresh triggers.
- Removes redundant grid re-renders on DATE_CHANGED and
  WEEK_CHANGED events, delegating navigation to NavigationManager.
- Introduces VIEW_CHANGED and DATE_CHANGED events for calendar
  mode and date selection, respectively.
- NavigationManager now handles date validation.
- Moves rendering logic from NavigationManager to NavigationRenderer.
- Syncs scroll position based on PERIOD_CHANGED instead of
  NAVIGATION_ANIMATION_COMPLETE.

This change optimizes the calendar's responsiveness and reduces
unnecessary re-renders, leading to a smoother user experience.
2025-08-20 21:38:54 +02:00
Janus Knudsen
7d513600d8 Refactors date handling for ISO week compatibility
Centralizes all date calculations into a new `DateCalculator` class for better maintainability and consistency.

Ensures correct ISO week handling (Monday as the first day) throughout the calendar.

Updates `CalendarConfig` to use ISO day numbering (1-7 for Mon-Sun) for work week definitions.

Fixes issue where date calculations were inconsistent.
Enhances event rendering and navigation.
Updates navigation logic to use pre-rendered events.
Removes the need for `CONTAINER_READY_FOR_EVENTS` event.
2025-08-20 00:39:31 +02:00
Janus Knudsen
32ee35eb02 Refactors grid and navigation rendering
Attempt 1
2025-08-17 22:54:00 +02:00
Janus Knudsen
a03f314c4a Refactors event rendering to be event-driven
Moves event rendering logic into a dedicated EventRenderer class that uses a strategy pattern for different calendar types.

The rendering is now triggered by `GRID_RENDERED` and `CONTAINER_READY_FOR_EVENTS` events, emitted by the GridManager and NavigationManager respectively.

This change decouples the CalendarManager from direct event rendering and allows for more flexible and efficient event updates. The EventManager now has a method to fetch events for a given time period.

Removes direct calls to event rendering from CalendarManager. Improves animation transitions by using pre-rendered containers in the NavigationManager.
2025-08-16 00:51:12 +02:00
Janus Knudsen
b03707853a Just some cleanup 2025-08-13 23:05:58 +02:00
Janus Knudsen
cdc7e55a92 Improves grid navigation animation
Refactors grid navigation to improve the animation flow.

Removes the immediate clearing of events to prevent visual glitches during the slide animation.  Instead, events are now rendered directly into the new container without clearing.  This change ensures a smoother transition between grids.

Also, cleans up old grid elements after the animation completes, reducing DOM clutter.
2025-08-12 00:31:02 +02:00
Janus Knudsen
f50f5ad53b Steps in the right direction for animated date change 2025-08-12 00:07:39 +02:00
Janus Knudsen
b111f121ba wip 2025-08-09 01:16:04 +02:00
Janus Knudsen
29811fd4b5 Renaming part 1 2025-08-07 00:15:44 +02:00