Major refactor into type safe TS

With a risk oof rolling it all back
This commit is contained in:
Janus C. H. Knudsen 2025-09-23 20:44:15 +02:00
parent c08fa02c29
commit 48d1fd681c
19 changed files with 449 additions and 81 deletions

View file

@ -10,6 +10,7 @@ import {
DragMoveEventPayload,
DragEndEventPayload
} from '../types/EventTypes';
import { DragOffset, MousePosition } from '../types/DragDropTypes';
/**
* AllDayManager - Handles all-day row height animations and management
@ -102,7 +103,7 @@ export class AllDayManager {
console.log('🎯 AllDayManager: Ending drag for all-day event', { eventId });
this.handleDragEnd(draggedElement, dragClone as HTMLElement, finalPosition.column);
this.handleDragEnd(draggedElement, dragClone as HTMLElement, { column: finalPosition.column || '', y: 0 });
});
// Listen for drag cancellation to recalculate height
@ -374,7 +375,7 @@ export class AllDayManager {
/**
* Handle drag start for all-day events
*/
private handleDragStart(originalElement: HTMLElement, eventId: string, mouseOffset: any): void {
private handleDragStart(originalElement: HTMLElement, eventId: string, mouseOffset: DragOffset): void {
// Create clone
const clone = originalElement.cloneNode(true) as HTMLElement;
clone.dataset.eventId = `clone-${eventId}`;
@ -409,7 +410,7 @@ export class AllDayManager {
/**
* Handle drag move for all-day events
*/
private handleDragMove(dragClone: HTMLElement, mousePosition: any): void {
private handleDragMove(dragClone: HTMLElement, mousePosition: MousePosition): void {
// Calculate grid column based on mouse position
const dayHeaders = document.querySelectorAll('swp-day-header');
let targetColumn = 1;
@ -434,7 +435,7 @@ export class AllDayManager {
/**
* Handle drag end for all-day events
*/
private handleDragEnd(originalElement: HTMLElement, dragClone: HTMLElement, finalPosition: any): void {
private handleDragEnd(originalElement: HTMLElement, dragClone: HTMLElement, finalPosition: { column: string; y: number }): void {
// Normalize clone
const cloneId = dragClone.dataset.eventId;