# maximusdionyssopoulos/planmytimetable architecture

> Architecture diagram of the GitHub repository maximusdionyssopoulos/planmytimetable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maximusdionyssopoulos/planmytimetable
- Repository: https://github.com/maximusdionyssopoulos/planmytimetable

## Overview

##### Main Components

a) Frontend Architecture (Primary Focus):
- Next.js Application (Core)
- Client-side Components
- Server Components
- Context Providers
- Browser Extensions Integration

b) Data Flow Components:
- Local Storage Management
- URL State Management
- Friend Data Sharing System
- Timetable Generator Algorithm

##### Core Application Layer
- Divide into main route groups: (Home), (Navbar), and classes
- Relationship between layouts and pages

##### Component Architecture
- Related components:
- Calendar Components
- Class Management
- UI Components (Button, Dialog, Tooltip)
- DragAndDrop System

##### State Management & Context
- Four main contexts:
- DndProvider
- FriendContext
- PreviewContext
- ThemeProvider
- How they interact with components

##### External Integrations
- Browser Extension System
- Firefox Extension
- Chrome Extension
- Bookmarklet Alternative
- University Systems Integration (Allocate+)

##### Data Flow
- Local storage operations
- URL state management
- Friend data sharing
- Timetable generation flow

##### Technical Details
- Server components vs client components
- Local storage interaction points
- Where browser extensions interface
- Algorithm processing paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        NextApp["Next.js Application"]:::core
        click NextApp "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/app/layout.tsx"
        Layout["Layout System"]:::core
        Pages["Pages Router"]:::core
    end

    subgraph Components
        Calendar["Calendar System"]:::component
        click Calendar "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Calendar/CalendarLayout.tsx"
        ClassMgmt["Class Management"]:::component
        click ClassMgmt "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/app/classes/layout.tsx"
        DragDrop["Drag & Drop System"]:::component
        click DragDrop "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/contexts/DndProvider.tsx"
        
        subgraph UI
            Dialog["Dialog"]:::ui
            click Dialog "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Dialog/DialogLayout.tsx"
            Button["Button"]:::ui
            click Button "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Button/Button.tsx"
            Tooltip["Tooltip"]:::ui
            click Tooltip "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Tooltip/Tooltip.tsx"
        end

        subgraph ClassComponents
            ClassCard["Class Card"]:::component
            click ClassCard "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/ClassCard/ClassCard.tsx"
            ClassForm["Class Form"]:::component
            click ClassForm "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/app/classes/(ClassesComponents)/ClassForm.tsx"
        end

        subgraph DragDropComponents
            DragOverlay["Drag Overlay"]:::component
            click DragOverlay "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/DragOverlay/DragOverlay.tsx"
            DraggableList["Draggable Class List"]:::component
            click DraggableList "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/app/(Home)/DraggableClassList.tsx"
        end
    end

    subgraph StateManagement
        UrlState["URL State"]:::state
        click UrlState "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/hooks/useUrlState.tsx"
        LocalStorage["Local Storage"]:::state
        click LocalStorage "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/lib/functions.ts"
        
        subgraph Contexts
            DndContext["DND Context"]:::context
            click DndContext "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/contexts/DndProvider.tsx"
            FriendContext["Friend Context"]:::context
            click FriendContext "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/contexts/FriendContext.tsx"
            PreviewContext["Preview Context"]:::context
            click PreviewContext "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/contexts/PreviewContext.tsx"
            ThemeContext["Theme Context"]:::context
            click ThemeContext "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/contexts/ThemeProvider.tsx"
        end
    end

    subgraph Features
        TimetableGen["Timetable Generator"]:::feature
        click TimetableGen "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Calendar/generated/generate.ts"
        
        subgraph FriendSystem
            AddFriend["Add Friend Modal"]:::feature
            click AddFriend "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Calendar/AddFriendModal.tsx"
            FriendEvents["Friend Event List"]:::feature
            click FriendEvents "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Event/FriendEventList.tsx"
            FriendPopover["Friend Popover"]:::feature
            click FriendPopover "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/src/components/Popovers/FriendPopover.tsx"
        end

        subgraph Extensions
            Bookmarklet["Bookmarklet"]:::extension
            click Bookmarklet "https://github.com/maximusdionyssopoulos/PlanMyTimetable/blob/main/public/bookmarklet.js"
            ChromeExt["Chrome Extension"]:::extension
            FirefoxExt["Firefox Extension"]:::extension
        end
    end

    %% Relationships
    NextApp --> Layout
    Layout --> Pages
    Pages --> Calendar
    Pages --> ClassMgmt
    
    ClassMgmt --> ClassComponents
    DragDrop --> DragDropComponents
    
    Calendar --> TimetableGen
    Calendar --> FriendSystem
    
    DndContext --> DragDrop
    FriendContext --> FriendSystem
    PreviewContext --> Calendar
    ThemeContext --> NextApp

    %% Styles
    classDef core fill:#2b6cb0,stroke:#1a365d,color:#fff
    classDef component fill:#48bb78,stroke:#22543d,color:#fff
    classDef ui fill:#ed8936,stroke:#7b341e,color:#fff
    classDef state fill:#805ad5,stroke:#44337a,color:#fff
    classDef context fill:#d53f8c,stroke:#702459,color:#fff
    classDef feature fill:#4299e1,stroke:#2c5282,color:#fff
    classDef extension fill:#ecc94b,stroke:#744210,color:#fff
```
