document.addEventListener('DOMContentLoaded', () => { const exchangeRates = { 'XOF': 1, 'GHS': 0.02, // Mock: 1 XOF = 0.02 GHS (fake) 'GNF': 13.5 // Mock: 1 XOF = 13.5 GNF (fake) }; const currencySymbols = { 'XOF': 'CFA', 'GHS': 'GH₵', 'GNF': 'FG' }; let currentCurrency = 'XOF'; const currencyBadge = document.getElementById('currencyBadge'); const balanceElements = document.querySelectorAll('[data-base-balance]'); function updateBalances(newCurrency) { currentCurrency = newCurrency; currencyBadge.textContent = newCurrency; balanceElements.forEach(el => { const baseBalance = parseFloat(el.getAttribute('data-base-balance')); const converted = baseBalance * exchangeRates[newCurrency]; // Formatting let formatted; if (newCurrency === 'XOF') { formatted = new Intl.NumberFormat('fr-FR').format(Math.round(converted)); } else { formatted = new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(converted); } el.innerHTML = `${formatted} ${currencySymbols[newCurrency]}`; }); } currencyBadge.addEventListener('click', () => { const currencies = ['XOF', 'GHS', 'GNF']; let nextIndex = (currencies.indexOf(currentCurrency) + 1) % currencies.length; updateBalances(currencies[nextIndex]); }); // Mock Quick Actions document.querySelectorAll('.action-btn').forEach(btn => { btn.addEventListener('click', () => { const action = btn.querySelector('.action-label').textContent; alert(`${action} module coming soon!`); }); }); });