# mhieu1296/led_xe_buyt_transerco architecture

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

- Interactive diagram: https://gitdiagram.com/mhieu1296/led_xe_buyt_transerco
- Repository: https://github.com/mhieu1296/led_xe_buyt_transerco

## Overview

##### Project type and purpose
- This is a single-page, front-end web application that simulates the LED-display signs used on Hanoi’s public buses.
- It isn’t a multi-tier or server-based system; it runs entirely in the browser, using HTML/CSS/JavaScript to render and animate “LED” segments and to accept user input (route info, modes, controls).

##### File structure
- Top-level HTML pages:
- index.html – the main display and control interface
- input.html – the form where the user enters route code, endpoints, company name
- Static assets:
- assets/fonts/*.otf – custom LED fonts
- Style layer:
- css/main.css – layout, positioning of LED grid
- css/input.css – styling the data-entry form
- css/font.css – font face declarations
- Behavior layer (JavaScript):
- js/window_onload.js – bootstraps the app on page load
- js/theme.js – theme switching logic (e.g. night mode)
- js/dieu_khien_LED.js – control module: starts, stops, freezes, reverses LED
- js/hien_thi_LED.js – display module: runs each “mode,” schedules timers, toggles individual LED cells

##### README for additional insights
- There are six display “modes” (Xe điện 1, Xe điện 2, etc.), each a sequence of timed show/erase effects.
- Core functions: show route code, endpoints, logos, company names, blink code, reverse scroll, freeze, clear.
- Parameters (route code, names) are user-configurable and stored client-side (likely localStorage).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        UI_Display["Display Canvas & Control Panel"]:::ui
        UI_Input["Input Form"]:::ui
    end

    %% Logic Modules
    subgraph "Logic Modules"
        direction TB
        Module_Loader["App Loader"]:::logic
        Module_Theme["Theme Manager"]:::logic
        Module_Controller["Controller Module"]:::logic
        Module_Display["Display Engine"]:::logic
    end

    %% Storage
    subgraph "Storage"
        direction TB
        Storage_ls["localStorage"]:::storage
    end

    %% Assets
    subgraph "Assets"
        direction TB
        Assets_Fonts["Custom LED Fonts"]:::assets
        Assets_Images["Logos & Icons"]:::assets
    end

    %% Documentation
    Doc["Project Documentation (README.md)"]:::assets

    %% Connections
    Module_Loader --> Module_Theme
    Module_Loader --> Module_Controller
    Module_Loader --> Module_Display
    Module_Loader --> UI_Display
    Module_Loader --> UI_Input

    UI_Input -->|save settings| Storage_ls
    UI_Input --> Module_Controller

    UI_Display -->|user actions| Module_Controller
    Module_Theme -->|apply theme| UI_Display

    Module_Controller -->|invoke modes| Module_Display
    Module_Controller -->|save settings| Storage_ls

    Module_Display -->|update DOM| UI_Display
    Module_Display -->|state-machine loop| Module_Display

    Assets_Fonts --> Module_Display
    Assets_Images --> UI_Display
    Assets_Images --> Module_Display

    Doc --- Module_Loader

    %% Click Events
    click UI_Display "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/index.html"
    click UI_Input "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/input.html"
    click Module_Loader "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/js/window_onload.js"
    click Module_Theme "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/js/theme.js"
    click Module_Controller "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/js/dieu_khien_LED.js"
    click Module_Display "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/js/hien_thi_LED.js"
    click Assets_Fonts "https://github.com/mhieu1296/led_xe_buyt_transerco/tree/main/assets/fonts"
    click Assets_Images "https://github.com/mhieu1296/led_xe_buyt_transerco/tree/main/assets/image"
    click Doc "https://github.com/mhieu1296/led_xe_buyt_transerco/blob/main/README.md"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#036BB9,color:#036BB9;
    classDef logic fill:#DFFFD0,stroke:#7AB800,color:#7AB800;
    classDef storage fill:#FFF3BF,stroke:#D4A017,color:#D4A017;
    classDef assets fill:#F0F0F0,stroke:#9E9E9E,color:#424242;
```
