How lucasdoreac/luaraujo-calculadoras works
Project type and purpose
• This is a static, client-side web application consisting of educational financial calculators.
• It uses HTML, CSS, and JavaScript (with Chart.js, Bootstrap 5, and Font Awesome) to render interactive simulations in the browser.
File structure
• Top-level HTML pages:
• index.html, contato.html
• calculadoras/calc-1.html, calc-2.html, calc-3.html
• assets/css: style sheets for layout, themes (light/dark), and chart styling/fixes
• assets/js: core UI components, chart helpers, theme-switch logic, and the PGBL-CDB fix
• assets/js/modules: domain logic for each calculator’s inputs, validation, calculation, and result rendering
Key insights from the README
• Three calculator flows, each a standalone HTML entry point + shared CSS/JS assets
• Emphasis on theme switching, accessibility, and contrast improvements
• Dependencies: Bootstrap 5.3.0, Chart.js 3.9.1, Font Awesome 6.0.0
• No server-side component—computation and rendering happen entirely in the browser
Main components
a. Presentation Layer (Browser)
• HTML Pages (index.html, contacto.html, calculadoras/*.html)
• CSS assets (general styles, theme-switch, chart themes)
• JavaScript assets
• Core UI components (navbar, footer)
• Theme switcher module
• Chart rendering & fixes
• Calculator modules (calculadora.js, calculo-investimentos.js, exibicao-resultados.js, validation.js)
b. Third-Party Libraries (external dependencies)
• Bootstrap CSS/JS (layout & components)
• Chart.js (data visualization)
c. Data Flow & Interactions
• User triggers input on an HTML page → validation.js
• Calculator module computes results → chart-helpers.js
• Chart.js renders graphs in the DOM
• theme-switch toggles CSS variables & classes
d. Hosting & Deployment (optional)
• Static hosting (e.g., GitHub Pages, Netlify) serving all files
• Build/minify step (not currently implemented but recommended)
Architectural patterns & design principles
• Modular JS: each calculator’s logic isolated in its own module
• Separation of concerns:
• Presentation (HTML/CSS)
• Business logic (calculator modules)
• Utility functions (chart-helpers.js, validation.js)
• Accessibility & theming handled globally via theme-switch module and contrast-focused CSS
Detail
• Individual JS module (validation, calculadora, exibicao-resultados, etc.) rather than lumping all scripts together
• Call out the pgbl-cdb-fix.js as a special “bug-fix” component attached to calc-2.html
• Theme-switch module influencing both CSS (theme-switch.css) and JS-driven DOM updates
• Accessibility concerns: keyboard nav, semantic HTML, contrast rules (reference CONTRASTE.md)