format
This commit is contained in:
parent
8a6fd5c7e5
commit
37b9722643
1 changed files with 17 additions and 27 deletions
|
|
@ -19,7 +19,6 @@ function readIntFromEurAmountInput() {
|
||||||
return cleanInputNumber;
|
return cleanInputNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function validateAndFormatEurAmountInput() {
|
function validateAndFormatEurAmountInput() {
|
||||||
const cleanInputNumber = readIntFromEurAmountInput();
|
const cleanInputNumber = readIntFromEurAmountInput();
|
||||||
eurAmountInput.classList.remove('input-is-valid', 'input-is-invalid');
|
eurAmountInput.classList.remove('input-is-valid', 'input-is-invalid');
|
||||||
|
|
@ -41,7 +40,6 @@ function updateBtcInput() {
|
||||||
btcAmountInput.value = formattedSatsAmount;
|
btcAmountInput.value = formattedSatsAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AmountInput {
|
class AmountInput {
|
||||||
constructor({ parentElement, id }) {
|
constructor({ parentElement, id }) {
|
||||||
this.element = null;
|
this.element = null;
|
||||||
|
|
@ -103,8 +101,6 @@ class AmountInput {
|
||||||
amountArea.appendChild(eurAmount);
|
amountArea.appendChild(eurAmount);
|
||||||
amountArea.appendChild(btcAmount);
|
amountArea.appendChild(btcAmount);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
eurInput.addEventListener('blur', () => {
|
eurInput.addEventListener('blur', () => {
|
||||||
validateAndFormatEurAmountInput();
|
validateAndFormatEurAmountInput();
|
||||||
updateBtcInput();
|
updateBtcInput();
|
||||||
|
|
@ -125,7 +121,7 @@ function offersPage() {
|
||||||
|
|
||||||
const mockPriceProvidingCallback = () => {
|
const mockPriceProvidingCallback = () => {
|
||||||
return Math.floor(Math.random() * (95000 - 70000 + 1) + 70000);
|
return Math.floor(Math.random() * (95000 - 70000 + 1) + 70000);
|
||||||
}
|
};
|
||||||
|
|
||||||
const publishOfferButton = new PublishOfferButton({
|
const publishOfferButton = new PublishOfferButton({
|
||||||
parentElement: document.getElementById('submit-button-area'),
|
parentElement: document.getElementById('submit-button-area'),
|
||||||
|
|
@ -164,11 +160,10 @@ function offersPage() {
|
||||||
priceDisplay.updatePrices();
|
priceDisplay.updatePrices();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const amountInput = new AmountInput({
|
const amountInput = new AmountInput({
|
||||||
parentElement: document.getElementById('amount-area'),
|
parentElement: document.getElementById('amount-area'),
|
||||||
id: 'amount-area-content'
|
id: 'amount-area-content',
|
||||||
})
|
});
|
||||||
|
|
||||||
amountInput.render();
|
amountInput.render();
|
||||||
// -----------
|
// -----------
|
||||||
|
|
@ -232,9 +227,6 @@ function offersPage() {
|
||||||
viewMyOffersRoot.style.display === 'block' ? 'none' : 'block';
|
viewMyOffersRoot.style.display === 'block' ? 'none' : 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function validateBitcoinMethodCheckboxes(clickedCheckbox) {
|
function validateBitcoinMethodCheckboxes(clickedCheckbox) {
|
||||||
let checkedCount = btcMethodCheckboxes.filter((cb) => cb.checked).length;
|
let checkedCount = btcMethodCheckboxes.filter((cb) => cb.checked).length;
|
||||||
if (checkedCount === 0) {
|
if (checkedCount === 0) {
|
||||||
|
|
@ -754,8 +746,6 @@ function offersPage() {
|
||||||
toggleCreateOfferModal();
|
toggleCreateOfferModal();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (const btcMethodCheckbox of btcMethodCheckboxes) {
|
for (const btcMethodCheckbox of btcMethodCheckboxes) {
|
||||||
btcMethodCheckbox.addEventListener('click', () => {
|
btcMethodCheckbox.addEventListener('click', () => {
|
||||||
validateBitcoinMethodCheckboxes(btcMethodCheckbox);
|
validateBitcoinMethodCheckboxes(btcMethodCheckbox);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue