Commit graph

22 commits

Author SHA1 Message Date
Janus C. H. Knudsen
83e01f9cb7 Improves all-day event drag and drop
Refactors all-day event conversion during drag and drop to
use the event payload, improving code clarity and reducing
redundancy.

Removes unnecessary style settings and fixes column detection
logic. Addresses an issue where event removal occurred before
successful placement.
2025-09-29 20:50:52 +02:00
Janus C. H. Knudsen
6ccc071587 Refactors drag and drop column detection
Improves drag and drop functionality by refactoring column detection to use column bounds instead of dates.
This change enhances the accuracy and efficiency of determining the target column during drag operations.
It also removes redundant code and simplifies the logic in both the DragDropManager and AllDayManager.
2025-09-28 13:25:09 +02:00
Janus C. H. Knudsen
4141bffca4 Refactors all-day event layout calculation
Simplifies all-day event rendering by streamlining the layout
calculation and event placement process, using the AllDayLayoutEngine
to determine the grid positions. This removes deprecated methods
and improves overall code clarity.
2025-09-27 15:01:22 +02:00
Janus C. H. Knudsen
0553089085 Improves all-day event drag and drop
Refactors all-day event drag and drop handling for improved accuracy and performance.

Introduces a shared `ColumnDetectionUtils` for consistent column detection.

Simplifies all-day conversion during drag, placing events in row 1 and calculating the column from the target date.

Implements differential updates during drag end, updating only changed events for smoother transitions.
2025-09-26 22:11:57 +02:00
Janus C. H. Knudsen
41d078e2e8 Improves all-day event layout calculation
Updates the all-day event layout engine for better event
rendering, especially when dealing with partial week views.

The layout engine now correctly clips events that start
before or end after the visible date range, ensuring that
only relevant portions of events are displayed.

It also fixes event ordering.

Includes new unit tests to validate date range filtering and
clipping logic.
2025-09-26 17:47:02 +02:00
Janus C. H. Knudsen
a624394ffb Improves all-day event layout calculation
Refactors all-day event rendering to use a layout engine
for overlap detection and positioning, ensuring events
are placed in available rows and columns.

Removes deprecated method and adds unit tests.
2025-09-25 23:38:17 +02:00
Janus C. H. Knudsen
48d1fd681c Major refactor into type safe TS
With a risk oof rolling it all back
2025-09-23 20:44:15 +02:00
Janus Knudsen
8b96376d1f Centralizes time formatting with timezone support
Addresses inconsistent time formatting and lack of timezone
handling throughout the application by introducing a
`TimeFormatter` utility.

This class centralizes time formatting logic, providing
timezone conversion (defaults to Europe/Copenhagen) and
support for both 12-hour and 24-hour formats, configurable
via `CalendarConfig`.

It also updates event rendering to utilize the new
`TimeFormatter` for consistent time displays.
2025-09-12 22:21:56 +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
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
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
d0936d1838 Refactors drag and drop manager for performance
Improves drag and drop performance by caching DOM elements and consolidating position calculations.

This reduces redundant DOM queries and optimizes event handling for smoother user interaction.
Also leverages `DateCalculator` for date/time conversions.
2025-09-03 19:05:03 +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
3ddc6352f2 Refactors calendar architecture for month view
Prepares the calendar component for month view implementation
by introducing a strategy pattern for view management,
splitting configuration settings, and consolidating events
into a core set. It also removes dead code and enforces type safety,
improving overall code quality and maintainability.

Addresses critical issues identified in the code review,
laying the groundwork for efficient feature addition.
2025-08-20 19:42:13 +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
efc1742dad Refactors date calculations to use ISO week
Adopts ISO week date calculation (Monday-based) for consistency
and accuracy across calendar components. This change ensures
standardized week determination, resolving potential discrepancies
in week-based operations.
2025-08-19 23:04:56 +02:00
Janus Knudsen
18f7953db4 Refactors date calculations into DateCalculator
Centralizes date calculation logic into a dedicated DateCalculator
class for improved maintainability and testability.

Removes redundant date calculation methods from CalendarManager,
ColumnRenderer, HeaderRenderer and NavigationRenderer, and utilizes
the DateCalculator for these calculations.

Updates components to use DateCalculator for consistent date
handling, including week start determination, date formatting,
and "is today" checks.
2025-08-18 23:42:03 +02:00
Janus Knudsen
59b3c64c55 Major refactorering to get a hold on all these events 2025-08-09 00:31:44 +02:00
Janus Knudsen
2a766cf685 Refactors week header to calendar header
Renames 'week header' to 'calendar header' for better representation
of the component's purpose, which includes more than just week-based
calendar views.

Updates related methods and references in GridManager and
ScrollManager to reflect the change.

Fixes incorrect calculation of the column width.
2025-08-07 00:26:33 +02:00
Janus Knudsen
b443649ced Improves grid layout and navigation
Refactors the calendar grid to support smoother navigation transitions by using separate week containers.

This change introduces a GridManager to handle grid rendering and interactions within these containers, enabling scroll synchronization and click event handling for each week view.

Also, configures the calendar to start at midnight and span a full 24-hour day, providing a more comprehensive view.
2025-07-25 00:24:15 +02:00
Janus Knudsen
f06c02121c Initial commit: Calendar Plantempus project setup with TypeScript, ASP.NET Core, and event-driven architecture 2025-07-24 22:17:38 +02:00