# atefkbenothman/strava-recap architecture

> Architecture diagram of the GitHub repository atefkbenothman/strava-recap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atefkbenothman/strava-recap
- Repository: https://github.com/atefkbenothman/strava-recap

## Overview

##### Main Components

A. Frontend Architecture (Primary Focus)
- Client Application (React)
- UI Component Layer
- Data Visualization Layer (Recharts)
- State Management (Context API)
- External API Integration (Strava)

**[Client Browser] → [React Application] ↔ [Strava API]**

##### Detailed Component Breakdown

**[Dashboard Component]**
- ↓
**[Chart Components]**
- ActivityCount
- BiggestActivity
- Distance
- Elevation
- HeartRateZones
- etc.

##### Important Elements to Highlight

- Authentication flow with Strava
- Context providers and their consumers
- Chart data flow from API to visualization
- Component reuse patterns
- UI component library integration (Shadcn)

##### Implementation Notes

- Annotations for key architectural decisions
- Relationship between contexts and their consumers
- Data transformation flow from API to charts

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph ReactApp["React Application"]
        App["App Component"]:::app
        Main["Main Entry"]:::app

        subgraph PresentationLayer["Presentation Layer"]
            Dashboard["Dashboard"]:::ui
            
            subgraph UIComponents["UI Components"]
                Button["Button"]:::ui
                Dialog["Dialog"]:::ui
                Carousel["Carousel"]:::ui
            end

            subgraph ChartComponents["Chart Components"]
                ActivityCount["Activity Count"]:::chart
                Distance["Distance"]:::chart
                Elevation["Elevation"]:::chart
                HeartRate["Heart Rate Zones"]:::chart
            end

            subgraph DisplayComponents["Display Components"]
                Loading["Loading"]:::display
                Error["Error"]:::display
                Unauth["Unauthenticated"]:::display
            end

            subgraph NavComponents["Navigation"]
                Menu["Menu"]:::nav
                YearPicker["Year Picker"]:::nav
            end

            subgraph CommonComponents["Common Components"]
                Card["Card"]:::common
                AboutDialog["About Dialog"]:::common
                Stat["Stat"]:::common
            end
        end

        subgraph StateLayer["State Management"]
            StravaAuthCtx["Strava Auth Context"]:::context
            StravaActivityCtx["Strava Activity Context"]:::context
            CurrentYearCtx["Current Year Context"]:::context
            ThemeCtx["Theme Context"]:::context
        end

        subgraph ServiceLayer["Service Layer"]
            APIService["API Service"]:::service
            Utils["Utilities"]:::service
            Types["Types"]:::service
        end
    end

    subgraph External
        StravaAPI["Strava API"]:::external
    end

    %% Relationships
    Browser --> App
    App --> Main
    Main --> Dashboard
    Dashboard --> ChartComponents
    Dashboard --> CommonComponents
    APIService <--> StravaAPI
    StateLayer --> ServiceLayer
    PresentationLayer --> StateLayer

    %% Click Events
    click App "https://github.com/atefkbenothman/strava-recap/blob/main/src/App.tsx"
    click Main "https://github.com/atefkbenothman/strava-recap/blob/main/src/main.tsx"
    click Dashboard "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/dashboard.tsx"
    click ActivityCount "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/charts/activityCount.tsx"
    click Distance "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/charts/distance.tsx"
    click Elevation "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/charts/elevation.tsx"
    click HeartRate "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/charts/heartrateZones.tsx"
    click Button "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/ui/button.tsx"
    click Dialog "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/ui/dialog.tsx"
    click Carousel "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/ui/carousel.tsx"
    click Loading "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/displays/loading.tsx"
    click Error "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/displays/error.tsx"
    click Unauth "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/displays/unauthenticated.tsx"
    click Menu "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/nav/menu.tsx"
    click YearPicker "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/nav/yearPicker.tsx"
    click StravaAuthCtx "https://github.com/atefkbenothman/strava-recap/blob/main/src/contexts/stravaAuthContext.tsx"
    click StravaActivityCtx "https://github.com/atefkbenothman/strava-recap/blob/main/src/contexts/stravaActivityContext.tsx"
    click CurrentYearCtx "https://github.com/atefkbenothman/strava-recap/blob/main/src/contexts/currentYearContext.tsx"
    click ThemeCtx "https://github.com/atefkbenothman/strava-recap/blob/main/src/contexts/themeContext.tsx"
    click APIService "https://github.com/atefkbenothman/strava-recap/blob/main/src/services/api.ts"
    click Types "https://github.com/atefkbenothman/strava-recap/tree/main/src/types"
    click Utils "https://github.com/atefkbenothman/strava-recap/blob/main/src/utils/utils.ts"
    click Card "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/common/card.tsx"
    click AboutDialog "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/common/aboutDialog.tsx"
    click Stat "https://github.com/atefkbenothman/strava-recap/blob/main/src/components/common/stat.tsx"

    %% Styles
    classDef client fill:#e1e1e1,stroke:#333,stroke-width:2px
    classDef app fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef ui fill:#d4b3ff,stroke:#333,stroke-width:2px
    classDef chart fill:#ffb3d9,stroke:#333,stroke-width:2px
    classDef display fill:#b3ffb3,stroke:#333,stroke-width:2px
    classDef nav fill:#ffd9b3,stroke:#333,stroke-width:2px
    classDef common fill:#ffccff,stroke:#333,stroke-width:2px
    classDef context fill:#ffff99,stroke:#333,stroke-width:2px
    classDef service fill:#99ccff,stroke:#333,stroke-width:2px
    classDef external fill:#ff9999,stroke:#333,stroke-width:2px
```
