# adrianojlt/salarydiffwithjs architecture

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

- Interactive diagram: https://gitdiagram.com/adrianojlt/salarydiffwithjs
- Repository: https://github.com/adrianojlt/salarydiffwithjs

## Overview

##### Project Type Analysis
This is a client-side web application built with vanilla JavaScript, focusing on salary comparison calculations for Portuguese salaries. It's a single-page application (SPA) with no backend dependencies.

##### Frontend Layer
- HTML Interface (index.html)
- CSS Styling (salaryStyles.css)
- JavaScript Logic (script.js)

##### Data Layer
- CSV Data Files (taxas_continente_*.csv)
- In-memory Data Processing

##### User Interaction Flow
- Input Forms (Left/Right)
- Calculation Engine
- Components

**[User Interface Layer]**

- Web Browser    |

- ↓
**[Presentation Layer]**

- index.html     |
- ↕         |
- salaryStyles.css  |

- ↓
**[Application Logic]**

- script.js      |
- ↙          ↘    |
- Form 1      Form 2|
- (Blue)      (Red) |
- ↓          ↓    |
- Calculation      |
- Engine        |

- ↓
**[Data Layer]**

- CSV Files       |
- (Tax Rate Tables) |

- Use blue for left form components
- Use red for right form components
- Use green for calculation results
- Use grey for intermediate calculations

D. Key Elements to Highlight:

##### User Interface Components
- Dual form layout
- Double-click copy functionality

##### Data Processing
- Tax calculation logic
- CSV data parsing
- Real-time comparison calculations

##### Interaction Patterns
- Form input handling
- Bi-directional data copying
- Result display updates

E. Additional Considerations:

##### Document data flow
- User input → Calculation → Display
- Cross-form data copying
- Tax rate application

Remember to emphasize the stateless nature of the application and how it processes all calculations client-side using the embedded CSV data for tax rates.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Browser
        UI[Web Browser Interface]
    end

    subgraph Presentation
        HTML[index.html]
        CSS[salaryStyles.css]
        UI --> HTML
        HTML <--> CSS
    end

    subgraph Logic
        JS[script.js]
        HTML --> JS

        subgraph Forms
            BF[Blue Form]:::blue
            RF[Red Form]:::red
            JS --> BF
            JS --> RF
        end

        subgraph Calculator
            CE[Calculation Engine]:::calc
            BF --> CE
            RF --> CE
        end
    end

    subgraph Data
        CSV1["2021 Tax Rates"]:::data
        CSV2["2022 Tax Rates"]:::data
        CSV3["2023 Tax Rates"]:::data
        CSV4["2024 Tax Rates"]:::data
        CSV5["2024-02 Tax Rates"]:::data
        CSV6["2024-03 Tax Rates"]:::data
        
        CE --> CSV1
        CE --> CSV2
        CE --> CSV3
        CE --> CSV4
        CE --> CSV5
        CE --> CSV6
    end

    subgraph Results
        RD[Results Display]:::results
        CE --> RD
        RD --> HTML
    end

    %% Styling
    classDef blue fill:#add8e6
    classDef red fill:#ffcccb
    classDef calc fill:#f0f0f0
    classDef data fill:#e6ffe6
    classDef results fill:#98FB98

    %% Click events
    click HTML "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/index.html"
    click CSS "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/salaryStyles.css"
    click JS "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/script.js"
    click CSV1 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2021.csv"
    click CSV2 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2022.csv"
    click CSV3 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2023.csv"
    click CSV4 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2024.csv"
    click CSV5 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2024_02.csv"
    click CSV6 "https://github.com/adrianojlt/salaryDiffWithJs/blob/master/taxas_continente_2024_03.csv"

    %% Legend
    subgraph Legend
        L1[Left Form]:::blue
        L2[Right Form]:::red
        L3[Calculations]:::calc
        L4[Data Sources]:::data
        L5[Results]:::results
    end
```
