How r7ni/mithqalcalculator works
Project Type and Purpose
• The project is a static front-end web application. Its purpose is to let users perform two-way conversions between Baháʼí Mithqáls (of Gold/Silver) and monetary values in ISO 4217 currencies.
• It relies purely on HTML, CSS, and JavaScript (with TypeScript removed from this version) and integrates with external APIs to fetch live precious metal prices and currency rates.
File Structure and Its Implications
• Top-Level Files:
• index.html: Central page hosting the calculator interface.
• about.html, 404.html: Additional static pages (informational and error handling).
• script.js: Contains the front-end conversion logic, including API calls.
• style.css (and additional language-specific CSS like ar.css, fa.css): Styling for the user interface.
• CNAME, favicon, and other static assets: For deployment and branding.
• GitHub Directory (.github/workflows): Indicates that there are automated workflows set up (such as static analysis or deployment pipelines using GitHub Actions) even though the project itself is static.
Core Components of the System
a. User Interface (Frontend):
• Components: index.html (main calculator interface), about.html, 404.html, language-specific pages.
• Assets: style.css, ar.css, fa.css for styling and layout.
b. Business Logic:
• script.js holds the conversion logic and data handling for both the conversion calculations and the API calls to fetch live data.
c. External Services:
• External APIs for real-time gold and silver prices.
• External APIs for live currency conversion rates (using USD as the base value).
d. Deployment/CI (via .github/workflows):
• Integration of GitHub Actions for continuous integration and potentially for deployment validation of static content.
Mapping the Relationships and Data Flow
• From index.html:
• That script.js handles both the conversion process (user input calculations) and API requests.
• For API interactions:
• That these API calls are asynchronous, affecting how live data is fetched and processed.
• Infrastructure/Workflow:
• A “GitHub Actions” or “CI/CD Pipeline” block connected to the repository (with .github/workflows files) showing where static analysis, tests, or deployment processes occur.