How candiath/ets2-mobile-route-advisor works
Main Components
• External Data Source: The ETS2 Telemetry Server (an external dependency). This is where the telemetry data (such as truck position, speed, navigation details, etc.) originates.
• Mobile Route Advisor UI: The core of this project. Include the following subcomponents:
• Dashboard Interface: Represented by dashboard.html and linked scripts (dashboard.js) that manage the overall UI.
• & Navigation Module: The “maps” directory (especially maps/ats/js/map.js, ol.js, and cities.js) handles displaying interactive maps, navigation overlays, and tile rendering.
• Styling & Theming: The “css” directory containing style sheets (ol.css, dashboard.css) that define the visual presentation.
• Localization: The “language” directory with JSON files (e.g., en-US.json) that support multi-language capabilities.
• Additional Assets: The “flags” and “flags-usa” directories provide country flags and similar graphical resources.
• Configuration: The root “config.json” (and maps/ats/config.json) to control various settings and options for the skin.
Relationships and Data Flow
• Interaction Between Modules:
• The Dashboard Interface (HTML/JS) communicates with the Map & Navigation module to render live maps and navigation overlays.
• The configuration files feed settings to the UI logic, influencing behavior (like auto zoom based on speed or tile loading preferences).
• Localization resources are referenced by the Dashboard logic to present texts in the appropriate language.
• Asset Loading: Illustrate that static resources (CSS, flags, images) support the look and feel, and are loaded by the browser as part of the UI rendering.
Architectural Patterns and Design Principles
• Separation of Concerns: Different folders clearly separate styles (CSS), logic (JavaScript in dashboard.js and map-related files), and static resources (flags, maps tiles).
• Client-Side Rendering: The system heavily relies on browser rendering, driven by JavaScript and HTML templates.
• Extensibility: With separate configuration and language files, it’s built in a modular way to allow easy customization and localization.
Relevant Technologies and Libraries
• Frontend Web Technologies: HTML, CSS, and JavaScript.
• Rendering: The “ol.js” (possibly referencing OpenLayers or a custom mapping library) which is central to rendering map tiles and interactive navigation.
• Configuration via JSON: Using JSON for both overall configuration and localization.
• External Interaction: The ETS2 Telemetry Server is referenced as a source of real-time data, though it is not part of this codebase; rather, it is integrated via API or WebSocket communication.
Putting It All Together
• Data/Configuration Layer: Represent JSON config files.
• Business Logic/UI Layer: Show the dashboard HTML/JS and map module.
• Presentation/Resource Layer: Represent the CSS, images, flags, and language JSON.