# esti-martin/front-act05-escaparate architecture

> Architecture diagram of the GitHub repository esti-martin/front-act05-escaparate, 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/esti-martin/front-act05-escaparate
- Repository: https://github.com/esti-martin/front-act05-escaparate

## Overview

##### Main Components
- User Interface Pages:
- index.html – The main dashboard that shows a listing of product cards.
- carrito.html – The shopping cart page where users can view and modify their chosen products.
- presupuesto.html – The budget/print page, which allows for a formatted print view.

- Assets:
- assets/data.json – Contains product data (name, description, price, stock, image links).
- Other images and resources possibly referenced by HTML or CSS.

- Presentation Layer:
- CSS Directory – Contains various CSS files (cards.css, carrito.css, formulario.css, menu.css, presupuesto.css, print.css, styles.css) that are each responsible for styling different sections/components (product cards, shopping cart, navigation menu, responsive layouts, etc.).

- Behavior/Logic Layer:
- JS Directory – Contains multiple JavaScript files (cards.js, carrito.js, icono-carrito.js, menu.js, presupuesto.js, scripts.js, stock.js) that add interactivity. For instance:
- cards.js and stock.js handle the product display and stock management.
- carrito.js and icono-carrito.js manage shopping cart functionalities.
- menu.js controls the responsive/hamburger menu behavior.
- presupuesto.js handles the budget printing functionality.
- scripts.js likely ties together general initialization and inter-component interaction.

##### Relationships and Interactions
- The HTML pages are the starting points for user interaction. They reference the CSS files to style the content and the JS files to enable dynamic behavior.
- JavaScript files interact with the DOM of each respective HTML page and pull in the product information from assets/data.json.
- CSS creates a cohesive, responsive design. For example, media queries in menu.css (and possibly in styles.css) support the transition from a multi-column dashboard to a mobile-friendly layout (with a hamburger/flyout filter menu).
- The structure implies a separation of concerns: layout (HTML), styling (CSS), and behavior/data manipulation (JS, JSON).

##### Architectural Patterns and Design Principles
- Componentization: The project is divided into logical components (UI pages, CSS styling modules, and JS behavior modules) that can be developed and maintained independently.
- Responsiveness: The responsive design principles (e.g., converting a vertical menu into a hamburger-style button on mobile) are central to the UI structure.
- Separation of Concerns: Different directories are dedicated to assets, styling, and scripts, emphasizing modularity.
- Data-driven UI: Utilizes an external JSON file for products, ensuring that the UI dynamically reflects the product data.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Interface Pages Subgraph
    subgraph "User Interface Pages"
        UI1["Dashboard (index.html)"]:::ui
        UI2["Shopping Cart (carrito.html)"]:::ui
        UI3["Budget/Print Page (presupuesto.html)"]:::ui
    end

    %% Aggregator Nodes for Resources
    CSSLoader["CSS Loader"]:::css
    JSLoader["JS Loader"]:::js

    %% Connect UI Pages to Resource Loaders
    UI1 -->|"loads"| CSSLoader
    UI2 -->|"loads"| CSSLoader
    UI3 -->|"loads"| CSSLoader

    UI1 -->|"loads"| JSLoader
    UI2 -->|"loads"| JSLoader
    UI3 -->|"loads"| JSLoader

    %% CSS Resources Subgraph
    subgraph "CSS Resources"
        CSS1["Overall Styles (styles.css)"]:::css
        CSS2["Product Cards Styling (cards.css)"]:::css
        CSS3["Shopping Cart Styling (carrito.css)"]:::css
        CSS4["Form Styling (formulario.css)"]:::css
        CSS5["Menu/Navigation Styling (menu.css)"]:::css
        CSS6["Budget/Print Styling (presupuesto.css)"]:::css
        CSS7["Print-specific Styling (print.css)"]:::css
    end

    %% Connect CSS Loader to Individual CSS Files
    CSSLoader -->|"applies"| CSS1
    CSSLoader -->|"applies"| CSS2
    CSSLoader -->|"applies"| CSS3
    CSSLoader -->|"applies"| CSS4
    CSSLoader -->|"applies"| CSS5
    CSSLoader -->|"applies"| CSS6
    CSSLoader -->|"applies"| CSS7

    %% JavaScript Modules Subgraph
    subgraph "JavaScript Modules"
        JS1["Product Display (cards.js)"]:::js
        JS2["Stock Management (stock.js)"]:::js
        JS3["Cart Functionality (carrito.js)"]:::js
        JS4["Cart Icon (icono-carrito.js)"]:::js
        JS5["Menu Behavior (menu.js)"]:::js
        JS6["Budget/Print Functionality (presupuesto.js)"]:::js
        JS7["General Initialization (scripts.js)"]:::js
    end

    %% Connect JS Loader to Individual JS Modules
    JSLoader -->|"initiates"| JS1
    JSLoader -->|"initiates"| JS2
    JSLoader -->|"initiates"| JS3
    JSLoader -->|"initiates"| JS4
    JSLoader -->|"initiates"| JS5
    JSLoader -->|"initiates"| JS6
    JSLoader -->|"initiates"| JS7

    %% Assets/Data Node
    DATA["Product Data (data.json)"]:::asset

    %% Data feeds into JavaScript Loader
    DATA -->|"feeds"| JSLoader

    %% Click Events for UI Pages
    click UI1 "https://github.com/esti-martin/front-act05-escaparate/blob/main/index.html"
    click UI2 "https://github.com/esti-martin/front-act05-escaparate/blob/main/carrito.html"
    click UI3 "https://github.com/esti-martin/front-act05-escaparate/blob/main/presupuesto.html"

    %% Click Event for Assets/Data
    click DATA "https://github.com/esti-martin/front-act05-escaparate/blob/main/assets/data.json"

    %% Click Events for CSS Resources
    click CSS1 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/styles.css"
    click CSS2 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/cards.css"
    click CSS3 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/carrito.css"
    click CSS4 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/formulario.css"
    click CSS5 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/menu.css"
    click CSS6 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/presupuesto.css"
    click CSS7 "https://github.com/esti-martin/front-act05-escaparate/blob/main/css/print.css"

    %% Click Events for JavaScript Modules
    click JS1 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/cards.js"
    click JS2 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/stock.js"
    click JS3 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/carrito.js"
    click JS4 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/icono-carrito.js"
    click JS5 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/menu.js"
    click JS6 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/presupuesto.js"
    click JS7 "https://github.com/esti-martin/front-act05-escaparate/blob/main/js/scripts.js"

    %% Styles
    classDef ui fill:#a6e3e9,stroke:#000,stroke-width:2px;
    classDef css fill:#ffda79,stroke:#000,stroke-width:2px;
    classDef js fill:#ff9f1c,stroke:#000,stroke-width:2px;
    classDef asset fill:#caffbf,stroke:#000,stroke-width:2px;
```
