feat: add bidirectional XMR to fiat conversion

Introduced bidirectional conversion functionality for XMR to fiat calculations. Added form elements and event listeners to handle user inputs and conversion direction. Enhanced URL and metadata processing to be dynamic based on protocol. Updated UI with conversion buttons for a better user experience. Safelisted new CSS classes in webpack configuration.
This commit is contained in:
Kumi 2024-08-10 16:23:52 +02:00
parent 5747f73c68
commit e97805d379
Signed by: kumi
GPG key ID: ECBCC9082395383F
4 changed files with 90 additions and 26 deletions

View file

@ -20,6 +20,8 @@ document.addEventListener('DOMContentLoaded', function () {
const xmrInput = document.getElementById('xmrInput');
const fiatInput = document.getElementById('fiatInput');
const selectBox = document.getElementById('selectBox');
const convertXMRToFiatBtn = document.getElementById('convertXMRToFiat');
const convertFiatToXMRBtn = document.getElementById('convertFiatToXMR');
// Add event listeners for the copy buttons
copyXMRBtn.addEventListener('click', copyToClipBoardXMR);
@ -62,6 +64,17 @@ document.addEventListener('DOMContentLoaded', function () {
}
});
// Add event listeners for the conversion buttons
convertXMRToFiatBtn.addEventListener('click', (e) => {
e.preventDefault();
xmrConvert();
});
convertFiatToXMRBtn.addEventListener('click', (e) => {
e.preventDefault();
fiatConvert();
});
// Fetch updated exchange rates immediately, then every 5 seconds
fetchUpdatedExchangeRates();
setInterval(fetchUpdatedExchangeRates, 5000);