# wizzzstark/wattcheck-dasboard architecture

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

- Interactive diagram: https://gitdiagram.com/wizzzstark/wattcheck-dasboard
- Repository: https://github.com/wizzzstark/wattcheck-dasboard

## Overview

##### Main Components
a. User Interface Layer:
- Browser/Client: Your end-user’s device that loads index.html.
- HTML Shell: index.html that boots up the React application.
b. Application Core:
- Main Entry Point: src/main.jsx (initializes and renders the React app).
- App Component: src/App.jsx which likely sets up routing and global layouts.
c. Page Routing & Views:
- Pages: Located in src/pages (AuthScreen.jsx, Dashboard.jsx, Home.jsx, ProtectedRoute.jsx) that represent different routes and screens.
d. UI Components:
- General components segment: src/components (e.g., CustomToolTip, DownloadCSVButton, DragAndDrop, FeaturedPrices, PersonalConsumption, SideBar).
- Chart Components: Inside src/components/charts, including AreaChart, BarChart, DateAreaChart, LineChart, PieChart.
e. Assets & Styling:
- Assets: src/assets for images or media assets.
- Styling & Config: Tailwind configuration (tailwind.config.js), PostCSS (postcss.config.js), and CSS files (src/index.css).
f. External Integrations & Configurations:
- Firebase Integration: firebase-config.js for connecting to Firebase services.
- Data Files: public/consumptions.csv as a static data source.
- Miscellaneous: cors.json and various configuration files (.eslintrc.cjs, vite.config.js, package.json) that, while not directly part of the runtime architecture, affect the development and deployment pipeline.

##### Relationships and Interactions
- Data flows from the client (browser) to the React app loaded from index.html.
- The app, initialized via main.jsx, uses App.jsx to coordinate routing and global layouts.
- Page components (in src/pages) represent different views. For example, Dashboard.jsx displays the main dashboard with charts, while AuthScreen.jsx handles user authentication logic potentially involving Firebase.
- The UI components within src/components, including the Sidebar and interactive elements (like drag & drop or CSV download), are composed within these pages.
- The chart components interact with data (possibly loaded from public/consumptions.csv or fetched via Firebase) to render dynamic visualizations.
- External service like Firebase (configured in firebase-config.js) is used for authentication or real-time data updates, connecting securely via the web client.

##### Architectural Patterns and Principles
- Component-based Architecture: Modular structure where each directory (pages, components, charts) represents a cohesive unit.
- Separation of Concerns: Clear distinction between routing/views (pages) vs. reusable UI components and specialized chart components.
- Configuration-Driven Build & Deployment: Use of Vite for bundling, Tailwind CSS for styling, and centralized configuration files to streamline development.
- External Integration: The inclusion of a Firebase configuration and CORS settings suggests attention to security and third-party integration.

##### Final Checklist
- Major component (Browser, React Entry, Pages, UI Components, Chart Components, External Services) is labeled clearly.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        A["Browser (index.html)"]:::client
    end

    %% Application Core
    subgraph "Application Core"
        B["Main Entry (src/main.jsx)"]:::core
        C["App Component (src/App.jsx)"]:::core
    end

    %% Page Routing & Views
    subgraph "Page Routing & Views"
        D["AuthScreen (src/pages/AuthScreen.jsx)"]:::pages
        E["Dashboard (src/pages/Dashboard.jsx)"]:::pages
        F["Home (src/pages/Home.jsx)"]:::pages
        G["ProtectedRoute (src/pages/ProtectedRoute.jsx)"]:::pages
    end

    %% UI Components
    subgraph "UI Components"
        H["Custom ToolTip (src/components/CustomToolTip.jsx)"]:::ui
        I["Download CSV Button (src/components/DownloadCSVButton.jsx)"]:::ui
        J["Drag and Drop (src/components/DragAndDrop.jsx)"]:::ui
        K["Featured Prices (src/components/FeaturedPrices.jsx)"]:::ui
        L["Personal Consumption (src/components/PersonalConsumption.jsx)"]:::ui
        M["Sidebar (src/components/SideBar.jsx)"]:::ui
    end

    %% Chart Components
    subgraph "Chart Components"
        N["Area Chart (src/components/charts/AreaChart.jsx)"]:::charts
        O["Bar Chart (src/components/charts/BarChart.jsx)"]:::charts
        P["Date Area Chart (src/components/charts/DateAreaChart.jsx)"]:::charts
        Q["Line Chart (src/components/charts/LineChart.jsx)"]:::charts
        R["Pie Chart (src/components/charts/PieChart.jsx)"]:::charts
    end

    %% Assets & Styling
    subgraph "Assets & Styling"
        S["Assets Directory (src/assets)"]:::assets
        T["Global Styles (src/index.css)"]:::assets
        U["Tailwind Config (tailwind.config.js)"]:::assets
        V["PostCSS Config (postcss.config.js)"]:::assets
    end

    %% External Integrations & Data
    subgraph "External Integrations & Data"
        W["Firebase Integration (firebase-config.js)"]:::external
        X["Static Data (public/consumptions.csv)"]:::external
    end

    %% Connections
    A -->|"loads"| B
    B -->|"initializes"| C
    C -->|"routesTo"| D
    C -->|"routesTo"| E
    C -->|"routesTo"| F
    C -->|"routesTo"| G

    %% Dashboard interactions
    E -->|"renders"| K
    E -->|"renders"| L
    E -->|"includes"| M
    E -->|"displays"| N
    E -->|"displays"| O
    E -->|"displays"| P
    E -->|"displays"| Q
    E -->|"displays"| R
    E -->|"fetches"| X

    %% Authentication flows
    D -->|"authCall"| W
    G -->|"securesVia"| W

    %% Home page utilizes additional UI components
    F -->|"utilizes"| H
    F -->|"utilizes"| I
    F -->|"utilizes"| J

    %% Assets & Styling integrate with the application
    S --> C
    T --> C
    U --> C
    V --> C

    %% Click Events
    click A "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/index.html"
    click B "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/main.jsx"
    click C "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/App.jsx"
    click D "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/pages/AuthScreen.jsx"
    click E "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/pages/Dashboard.jsx"
    click F "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/pages/Home.jsx"
    click G "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/pages/ProtectedRoute.jsx"
    click H "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/CustomToolTip.jsx"
    click I "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/DownloadCSVButton.jsx"
    click J "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/DragAndDrop.jsx"
    click K "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/FeaturedPrices.jsx"
    click L "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/PersonalConsumption.jsx"
    click M "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/SideBar.jsx"
    click N "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/charts/AreaChart.jsx"
    click O "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/charts/BarChart.jsx"
    click P "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/charts/DateAreaChart.jsx"
    click Q "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/charts/LineChart.jsx"
    click R "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/components/charts/PieChart.jsx"
    click S "https://github.com/wizzzstark/wattcheck-dasboard/tree/master/src/assets"
    click T "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/src/index.css"
    click U "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/tailwind.config.js"
    click V "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/postcss.config.js"
    click W "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/firebase-config.js"
    click X "https://github.com/wizzzstark/wattcheck-dasboard/blob/master/public/consumptions.csv"

    %% Styling Classes
    classDef client fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef core fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef pages fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef ui fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef charts fill:#fde2e2,stroke:#e55353,stroke-width:2px;
    classDef assets fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
