diff --git a/js/app.js b/js/app.js index aac6247..147c33b 100644 --- a/js/app.js +++ b/js/app.js @@ -720,6 +720,13 @@ function createCurrencyButtons() { `; container.appendChild(button); + // Add second submission method + button.addEventListener('click', () => { + if ( currency.code === currentCurrency ) { + handleFormSubmission(); + } + }); + // Add event listener button.addEventListener('click', () => { currentCurrency = currency.code; @@ -1065,9 +1072,13 @@ function displayResults(data) { updateDisplayOrderButtons(); } -// Form submission handler +// add form submission to calculate button document.getElementById('calculatorForm').addEventListener('submit', (e) => { e.preventDefault(); + handleFormSubmission(); +}) +// Form submission handler +function handleFormSubmission () { track('calculate', { currency: currentCurrency, asset_type: assetType, stock_mode: stockMode, amount: document.getElementById('amount').value }); // Check if we need to stop calculation @@ -1568,7 +1579,7 @@ document.getElementById('calculatorForm').addEventListener('submit', (e) => { assetType: assetType } }); -}); +}; // Language switcher event handlers document.querySelectorAll('.lang-btn').forEach(btn => { @@ -2865,7 +2876,8 @@ const TOUR_STEPS = [ { target: '.enabled-cell', text: 'tourStep6' }, { target: '#calculateBtn', text: 'tourStep7' }, { target: '.results-panel', text: 'tourStep8' }, - { target: '#themeToggleBtn', text: 'tourStep9' }, + { target: '#currencyButtons', text: 'tourStep9' }, + { target: '#themeToggleBtn', text: 'tourStep10' }, ]; let tourStep = 0; diff --git a/js/translations.js b/js/translations.js index 26cf7f2..d1c847d 100644 --- a/js/translations.js +++ b/js/translations.js @@ -90,7 +90,8 @@ export const TRANSLATIONS = { tourStep6: 'Use checkboxes to enable or disable specific denominations', tourStep7: 'Hit Calculate to get packing options', tourStep8: 'Results will appear here — pick a variant and execute the order', - tourStep9: 'Switch between light and dark themes', + tourStep9: 'Clicking the highlighted currecy also cacluates the packing options', + tourStep10: 'Switch between light and dark themes', themeToggle: 'Toggle theme', themeLight: 'Switch to light theme', themeDark: 'Switch to dark theme', @@ -186,7 +187,8 @@ export const TRANSLATIONS = { tourStep6: 'Чекбоксы включают и отключают отдельные номиналы', tourStep7: 'Нажмите Посчитать для расчёта вариантов', tourStep8: 'Здесь появятся результаты — выберите вариант и выполните заказ', - tourStep9: 'Переключение между светлой и тёмной темами', + tourStep9: 'При нажатии на выделенную валюту также рассчитываются варианты упаковки.', + tourStep10: 'Переключение между светлой и тёмной темами', themeToggle: 'Переключить тему', themeLight: 'Переключить на светлую тему', themeDark: 'Переключить на тёмную тему',