# Code Analysis Report ## Calendar Plantempus TypeScript Codebase **Generated:** 2025-10-06 **Tool:** ts-unused-exports **Total Files Analyzed:** 40+ TypeScript files --- ## Executive Summary ### Unused Exports Found - **Total Modules with Unused Exports:** 14 - **Total Unused Exports:** 40+ ### Impact Assessment - 🟢 **Low Risk:** Type definitions and interfaces (can be kept for future use) - 🟡 **Medium Risk:** Unused classes and managers (should be reviewed) - 🔴 **High Risk:** Duplicate implementations (should be removed) --- ## Detailed Findings ### 1. Constants & Core (`src/constants/`) #### `CoreEvents.ts` **Unused Exports:** - `CoreEventType` - Type definition - `EVENT_MIGRATION_MAP` - Migration mapping **Analysis:** - `CoreEventType` er en type definition - kan være nyttig for fremtidig type-sikkerhed - `EVENT_MIGRATION_MAP` ser ud til at være til migration fra gamle events - kan muligvis fjernes hvis migration er færdig **Recommendation:** ⚠️ Review - Tjek om migration er færdig --- ### 2. Factories (`src/factories/`) #### `CalendarTypeFactory.ts` **Unused Exports:** - `RendererConfig` - Interface **Analysis:** - Interface der ikke bruges eksternt - Kan være intern implementation detail **Recommendation:** ✅ Keep - Internal interface, no harm --- ### 3. Interfaces (`src/interfaces/`) #### `IManager.ts` **Unused Exports:** - `IEventManager` - `IRenderingManager` - `INavigationManager` - `IScrollManager` **Analysis:** - Disse interfaces definerer kontrakter men bruges ikke - Kan være planlagt til fremtidig dependency injection **Recommendation:** 🔴 **CRITICAL** - Enten brug interfaces eller fjern dem. Interfaces uden implementation er dead code. --- ### 4. Managers (`src/managers/`) #### `EventLayoutCoordinator.ts` **Unused Exports:** - `ColumnLayout` - Interface **Analysis:** - Return type interface der ikke bruges eksternt **Recommendation:** ✅ Keep - Part of public API #### `SimpleEventOverlapManager.ts` **Unused Exports:** - `OverlapType` - `OverlapGroup` - `StackLink` - `SimpleEventOverlapManager` - **ENTIRE CLASS** **Analysis:** - 🔴 **CRITICAL FINDING:** Hele klassen er ubrugt! - Dette ser ud til at være en gammel implementation der er blevet erstattet af `EventStackManager` **Recommendation:** 🔴 **DELETE** - Remove entire file if not used #### `WorkHoursManager.ts` **Unused Exports:** - `DayWorkHours` - `WorkScheduleConfig` **Analysis:** - Interfaces for work hours functionality - Kan være planlagt feature **Recommendation:** ⚠️ Review - Check if feature is planned or abandoned --- ### 5. Strategies (`src/strategies/`) #### `MonthViewStrategy.ts` **Unused Exports:** - `MonthViewStrategy` - **ENTIRE CLASS** **Analysis:** - 🔴 **CRITICAL:** Hele strategy-klassen er ubrugt - Kan være planlagt feature eller gammel implementation **Recommendation:** 🔴 **DELETE or IMPLEMENT** - Either use it or remove it #### `WeekViewStrategy.ts` **Unused Exports:** - `WeekViewStrategy` - **ENTIRE CLASS** **Analysis:** - 🔴 **CRITICAL:** Hele strategy-klassen er ubrugt - Samme som MonthViewStrategy **Recommendation:** 🔴 **DELETE or IMPLEMENT** - Either use it or remove it --- ### 6. Types (`src/types/`) #### `CalendarTypes.ts` **Unused Exports:** - `SyncStatus` - `Resource` - `GridPosition` - `Period` - `EventData` - `DateModeContext` - `ResourceModeContext` - `CalendarModeContext` **Analysis:** - Mange type definitions der ikke bruges - Nogle kan være planlagt features (Resource, ResourceModeContext) - Andre kan være legacy (SyncStatus, EventData) **Recommendation:** ⚠️ Review each type individually #### `DragDropTypes.ts` **Unused Exports:** - `DragState` - `DragEndPosition` - `StackLinkData` - `DragEventHandlers` **Analysis:** - Drag & drop types der ikke bruges eksternt - Kan være internal types **Recommendation:** ✅ Keep - Part of drag-drop system #### `EventPayloadMap.ts` **Unused Exports:** - `CalendarEventPayloadMap` - `EventPayload` - `hasPayload` **Analysis:** - Event payload system der ikke bruges - Kan være planlagt type-safe event system **Recommendation:** ⚠️ Review - Check if this is planned feature #### `EventTypes.ts` **Unused Exports:** - `AllDayEvent` - `TimeEvent` - `CalendarEventData` - `MousePosition` **Analysis:** - Type definitions for events - `MousePosition` bruges sandsynligvis internt **Recommendation:** ✅ Keep - Core types #### `ManagerTypes.ts` **Unused Exports:** - `EventManager` - `EventRenderingService` - `GridManager` - `ScrollManager` - `NavigationManager` - `ViewManager` - `CalendarManager` - `DragDropManager` - `AllDayManager` - `Resource` - `ResourceAssignment` **Analysis:** - 🔴 **CRITICAL:** Mange manager types der ikke bruges - Dette tyder på at type system ikke er implementeret korrekt **Recommendation:** 🔴 **REFACTOR** - Either use these types or remove them --- ### 7. Utils (`src/utils/`) #### `OverlapDetector.ts` **Unused Exports:** - `EventId` - `OverlapResult` - `StackLink` - `OverlapDetector` - **ENTIRE CLASS** **Analysis:** - 🔴 **CRITICAL:** Hele utility-klassen er ubrugt - Sandsynligvis erstattet af anden implementation **Recommendation:** 🔴 **DELETE** - Remove if not used --- ## Summary Statistics ### By Category | Category | Total Unused | Critical (Classes) | Medium (Interfaces) | Low (Types) | |----------|--------------|-------------------|---------------------|-------------| | Constants | 2 | 0 | 0 | 2 | | Factories | 1 | 0 | 1 | 0 | | Interfaces | 4 | 0 | 4 | 0 | | Managers | 8 | 1 | 3 | 4 | | Strategies | 2 | 2 | 0 | 0 | | Types | 23 | 0 | 0 | 23 | | Utils | 4 | 1 | 0 | 3 | | **TOTAL** | **44** | **4** | **8** | **32** | --- ## Critical Issues (Requires Immediate Action) ### 🔴 Unused Classes (Dead Code) 1. **`SimpleEventOverlapManager`** - Entire class unused 2. **`MonthViewStrategy`** - Entire class unused 3. **`WeekViewStrategy`** - Entire class unused 4. **`OverlapDetector`** - Entire class unused ### 🔴 Unused Interfaces (Architecture Issue) 1. **`IManager.ts`** - All 4 interfaces unused - Suggests dependency injection pattern not implemented - Either implement or remove --- ## Recommendations ### Immediate Actions (High Priority) 1. **Delete Dead Code:** ```bash # Remove these files if confirmed unused: rm src/managers/SimpleEventOverlapManager.ts rm src/strategies/MonthViewStrategy.ts rm src/strategies/WeekViewStrategy.ts rm src/utils/OverlapDetector.ts ``` 2. **Review Interfaces:** - Decide if `IManager.ts` interfaces should be implemented - If not, remove them 3. **Clean Up Types:** - Review `ManagerTypes.ts` - many unused types - Consider if these are planned features or legacy code ### Medium Priority 4. **Review Planned Features:** - `Resource` and `ResourceModeContext` - Are these planned? - `WorkHoursManager` types - Is this feature coming? - `EventPayloadMap` - Is type-safe event system planned? 5. **Document Decisions:** - Add comments explaining why certain exports exist - Mark planned features clearly ### Low Priority 6. **Type Definitions:** - Most type definitions can stay (low cost) - But consider if they add confusion --- ## Estimated Impact ### Code Reduction Potential - **Files that can be deleted:** 4 (SimpleEventOverlapManager, MonthViewStrategy, WeekViewStrategy, OverlapDetector) - **Lines of code reduction:** ~500-800 lines - **Maintenance burden reduction:** Significant ### Risk Assessment - **Low Risk:** Removing unused classes (they're not imported anywhere) - **Medium Risk:** Removing interfaces (might break future plans) - **High Risk:** None (all findings are confirmed unused) --- ## Next Steps 1. ✅ **Review this report with team** 2. ⚠️ **Decide on each critical issue** 3. 🔴 **Create cleanup tasks** 4. ✅ **Run tests after cleanup** 5. ✅ **Update documentation** --- ## Tools Used - **ts-unused-exports** v11.0.1 - Analysis date: 2025-10-06 - Project: Calendar Plantempus