# baogeist/mcmaster-calendar-exporter architecture

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

- Interactive diagram: https://gitdiagram.com/baogeist/mcmaster-calendar-exporter
- Repository: https://github.com/baogeist/mcmaster-calendar-exporter

## Overview

##### Main Components

A. Client-Side Layer
- Next.js App Router (App Directory Structure)
- React Components
- Context Management
- UI Components Library
- Client-Side Services

B. External Services Integration
- Calendar Service Integration
- Authentication System

##### Detailed Component Breakdown

a) Core Application Layer:
- Inside this container, create separate sections for:
- Pages (src/app)
- Components (src/components)
- Context (src/app/context)
- Services (src/app/service)

b) UI Component Layer:
- Relationship to the shadcn/ui integration (based on components.json presence)

c) Feature Components:
- Calendar Integration
- Authentication Flow
- Course Management

##### Relationships and Data Flow

- User interaction flow
- Data flow between components
- Integration with external services

##### Specific Implementation Details

- HomePage (src/app/HomePage.tsx)
- ↓
- CourseContext (src/app/context/CourseContext.tsx)
- ↓
- CoursesTable (src/app/CoursesTable.tsx)
- ↓
- Calendar Integration (src/app/service/addToCalendar.ts)

##### Authentication Flow
**LoginButton ⟷ Authentication Service**
**LogoutButton ⟷ Authentication Service**

##### Important Architectural Notes

- Use the App Router pattern (new Next.js 13+ structure)
- Client-side component architecture
- State management through Context API
- Demonstrate UI component composition

**┌─ Next.js Application ──────────────────────┐**

- ┌─ Pages ─────┐    ┌─ Components ───┐    │
- HomePage    │    │ UI Library     │    │
- Privacy     │    │ Theme Provider │    │
- ┘    └───────────────┘    │

- ┌─ Features ───────────────────────┐     │
- Calendar Integration             │     │
- Course Management               │     │
- Authentication                  │     │
- ┘     │

- ┌─ Services ──┐    ┌─ Context ────┐     │
- Calendar    │    │ Courses      │     │
- ┘    └─────────────┘     │
- ┘

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph NextApp["Next.js Application"]
        direction TB
        
        subgraph Pages["Pages Layer"]
            direction TB
            Home["Home Page"]:::page
            Privacy["Privacy Page"]:::page
            Layout["Layout System"]:::page
        end

        subgraph Components["Components Layer"]
            direction TB
            
            subgraph UILib["UI Components Library"]
                direction TB
                Button["Button"]:::ui
                Table["Table"]:::ui
                Dialog["Dialog"]:::ui
                Toast["Toast"]:::ui
                Modal["Modal"]:::ui
                Theme["Theme Provider"]:::ui
            end

            subgraph Features["Feature Components"]
                direction TB
                CalButton["Calendar Button"]:::feature
                CoursesTable["Courses Table"]:::feature
                LoginBtn["Login Button"]:::auth
                LogoutBtn["Logout Button"]:::auth
            end
        end

        subgraph Context["Context Layer"]
            CourseCtx["Course Context"]:::context
        end

        subgraph Services["Services Layer"]
            direction TB
            Calendar["Calendar Service"]:::service
            
            subgraph Utils["Utility Services"]
                Browser["Browser Utils"]:::util
                BatchGen["Batch Generator"]:::util
                TimeSet["Course Times"]:::util
            end
        end
    end

    %% External Services
    Auth["Authentication System"]:::external
    CalendarExt["External Calendar Service"]:::external

    %% Relationships
    Home --> CoursesTable
    CoursesTable --> CourseCtx
    CalButton --> Calendar
    Calendar --> CalendarExt
    LoginBtn --> Auth
    LogoutBtn --> Auth
    Features --> UILib

    %% Click Events
    click Home "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/HomePage.tsx"
    click Privacy "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/privacy/page.tsx"
    click Layout "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/layout.tsx"
    click UILib "https://github.com/BaoGeist/McMaster-Calendar-Exporter/tree/main/src/components/ui"
    click Button "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/ui/button.tsx"
    click Table "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/ui/table.tsx"
    click Dialog "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/ui/dialog.tsx"
    click Toast "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/ui/toast.tsx"
    click Modal "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/ui/modal.tsx"
    click Theme "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/components/theme-provider.tsx"
    click CalButton "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/CalendarButton.tsx"
    click CoursesTable "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/CoursesTable.tsx"
    click LoginBtn "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/LoginButton.tsx"
    click LogoutBtn "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/LogoutButton.tsx"
    click CourseCtx "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/context/CourseContext.tsx"
    click Calendar "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/service/addToCalendar.ts"
    click Browser "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/lib/browser.ts"
    click BatchGen "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/lib/generateBatchString.ts"
    click TimeSet "https://github.com/BaoGeist/McMaster-Calendar-Exporter/blob/main/src/app/lib/setCourseTimes.ts"

    %% Styling
    classDef page fill:#2563eb,color:white
    classDef ui fill:#9333ea,color:white
    classDef feature fill:#16a34a,color:white
    classDef auth fill:#dc2626,color:white
    classDef context fill:#0891b2,color:white
    classDef service fill:#ca8a04,color:white
    classDef util fill:#525252,color:white
    classDef external fill:#f97316,color:white

    %% Legend
    subgraph Legend
        direction TB
        L1["Page Component"]:::page
        L2["UI Component"]:::ui
        L3["Feature Component"]:::feature
        L4["Auth Component"]:::auth
        L5["Context"]:::context
        L6["Service"]:::service
        L7["Utility"]:::util
        L8["External Service"]:::external
    end
```
