Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1568,7 +1579,7 @@ document.getElementById('calculatorForm').addEventListener('submit', (e) => {
assetType: assetType
}
});
});
};

// Language switcher event handlers
document.querySelectorAll('.lang-btn').forEach(btn => {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions js/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -186,7 +187,8 @@ export const TRANSLATIONS = {
tourStep6: 'Чекбоксы включают и отключают отдельные номиналы',
tourStep7: 'Нажмите Посчитать для расчёта вариантов',
tourStep8: 'Здесь появятся результаты — выберите вариант и выполните заказ',
tourStep9: 'Переключение между светлой и тёмной темами',
tourStep9: 'При нажатии на выделенную валюту также рассчитываются варианты упаковки.',
tourStep10: 'Переключение между светлой и тёмной темами',
themeToggle: 'Переключить тему',
themeLight: 'Переключить на светлую тему',
themeDark: 'Переключить на тёмную тему',
Expand Down