# brocktimetable/brockvisualtimetable architecture

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

- Interactive diagram: https://gitdiagram.com/brocktimetable/brockvisualtimetable
- Repository: https://github.com/brocktimetable/brockvisualtimetable

## Overview

##### Main Components Overview

A. Frontend Architecture (Primary Focus)
- Client-Side Application Layer
- Component Layer
- Business Logic Layer
- Data Management Layer

##### Detailed Component Breakdown

a) User Interface Layer:
- Generator Page Components
- Guide Page Components
- Site-Wide Components

b) Business Logic Layer:
- Timetable Generation Engine
- Course Data Management
- Export Services
- Time Slot Management

c) State Management:
- A "Context Providers" section showing:
- CourseColors Context
- CourseDetails Context
- ColorMode Context

d) External Interactions:
- An "External Services" section for:
- Data Fetching Services
- Export Services (PDF, Excel, PNG)

##### Specific Implementation Details

**┌─────────────────────────────────────────────┐**
- React Application              │
- ┤
- ┌─────────────┐ ┌─────────────┐ ┌─────────┐│
- Generator Page│ │ Guide Page  │ │Site-Wide││
- ┘ └─────────────┘ └─────────┘│
- ┤
- ┌─────────────────────────────────────────┐ │
- Context Providers             │ │
- ┘ │
- ┤
- ┌─────────────────────────────────────────┐ │
- Business Logic Layer          │ │
- (Timetable Generation, Course Data)     │ │
- ┘ │
- ┘

##### Important Elements

- Component Hierarchy:
- Relationship between GeneratorPage and its sub-components
- Shared SiteWide components
- Connection between contexts and their consumers

- Data Flow:
- How course data flows from input to timetable generation
- Export functionality paths
- Demonstrate state management flow through contexts

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "React Application"
        subgraph "UI Layer"
            GP["Generator Page"]:::ui
            GUP["Guide Page"]:::ui
            
            subgraph "Generator Page Components"
                CAL["Calendar UI"]:::ui
                IFC["Input Form Components"]:::ui
                IEC["Import/Export UI"]:::ui
            end
            
            subgraph "Site-Wide Components"
                NAV["Navigation Component"]:::ui
            end
            
            GP --> CAL
            GP --> IFC
            GP --> IEC
        end
        
        subgraph "Context Layer"
            CC["Course Colors Context"]:::context
            CDC["Course Details Context"]:::context
            CMC["Color Mode Context"]:::context
        end
        
        subgraph "Business Logic Layer"
            TGE["Timetable Generation Engine"]:::logic
            CDM["Course Data Management"]:::logic
            TSM["Time Slot Management"]:::logic
            EBS["Event Bus System"]:::logic
        end
        
        subgraph "External Services Layer"
            DFS["Data Fetching Service"]:::external
            EXS["Export Services"]:::external
        end
    end
    
    %% Component Relationships
    IFC --> TGE
    TGE --> CDM
    CDM --> TSM
    IEC --> EXS
    DFS --> CDM
    EBS --> GP
    EBS --> GUP
    
    %% Context Consumption
    CC -.-> CAL
    CDC -.-> CAL
    CMC -.-> NAV
    
    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:#fff
    classDef context fill:#9b59b6,stroke:#8e44ad,color:#fff
    classDef logic fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef external fill:#e67e22,stroke:#d35400,color:#fff
    
    %% Click Events
    click GP "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage.jsx"
    click GUP "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GuidePage.jsx"
    click CAL "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/components/CalendarComponent.jsx"
    click IFC "https://github.com/BrockTimetable/BrockVisualTimetable/tree/master/src/GeneratorPage/components/InputFormComponents/"
    click IEC "https://github.com/BrockTimetable/BrockVisualTimetable/tree/master/src/GeneratorPage/components/ImportExportComponents/"
    click NAV "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/SiteWide/components/NavbarComponent.jsx"
    click CC "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/contexts/CourseColorsContext.jsx"
    click CDC "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/contexts/CourseDetailsContext.jsx"
    click CMC "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/SiteWide/contexts/ColorModeContext.jsx"
    click TGE "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/scripts/generateTimetables.js"
    click CDM "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/scripts/courseData.js"
    click TSM "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/scripts/timeSlots.js"
    click EBS "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/SiteWide/Buses/eventBus.js"
    click DFS "https://github.com/BrockTimetable/BrockVisualTimetable/blob/master/src/GeneratorPage/scripts/fetchData.js"
    click EXS "https://github.com/BrockTimetable/BrockVisualTimetable/tree/master/src/GeneratorPage/scripts/Export/"
```
