diff --git a/public/css/offers.css b/public/css/offers.css index 17ac4b5..54ecefa 100644 --- a/public/css/offers.css +++ b/public/css/offers.css @@ -377,7 +377,7 @@ width: 2em; } -#submit-button-area { +.submit-button-area { margin-top: 1em; margin-bottom: 1em; } diff --git a/src/front/pages/offers.js b/src/front/pages/offers.js index 3c639dd..6cc7221 100644 --- a/src/front/pages/offers.js +++ b/src/front/pages/offers.js @@ -12,9 +12,7 @@ const PopupNotification = require('../components/PopupNotification'); const offerService = require('../services/offerService'); -class CreateOfferModal { - // Actual creation logic to be provided by a service - // Stop relying on IDs +class CreateOfferModal { // Stop relying on IDs constructor({ parentElement, onCreationCallback, offerService }) { this.element = null; this.parentElement = parentElement; @@ -98,7 +96,17 @@ class CreateOfferModal { }); const submitButtonArea = document.createElement('div'); - submitButtonArea.id = 'submit-button-area'; + submitButtonArea.classList.add('submit-button-area') + this.publishOfferButton = new PublishOfferButton({ + parentElement: submitButtonArea, + id: 'button-submit-offer', + onClickCallback: async () => { + await this.createOffer(); + await this.onCreationCallback(); + await this.toggleOfferCreatedAlert(); + }, + }); + this.publishOfferButton.render(); const closeButtonArea = document.createElement('div'); closeButtonArea.id = 'close-offer-controls-area'; @@ -122,17 +130,6 @@ class CreateOfferModal { return Math.floor(Math.random() * (95000 - 70000 + 1) + 70000); }; - this.publishOfferButton = new PublishOfferButton({ - parentElement: document.getElementById('submit-button-area'), - id: 'button-submit-offer', - onClickCallback: async () => { - await this.createOffer(); - await this.onCreationCallback(); - await this.toggleOfferCreatedAlert(); - }, - }); - this.publishOfferButton.render(); - this.buyOrSellButtonGroup = new BuyOrSellButtonGroup({ parentElement: document.getElementById('buy-or-sell-area'), id: 'button-group-buy-or-sell',