separate price setting behaviour
This commit is contained in:
parent
97847f503b
commit
cca4402126
1 changed files with 16 additions and 12 deletions
|
|
@ -18,15 +18,6 @@ class PriceDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const marketPrice = this.priceProvidingCallback()
|
|
||||||
const marketPriceString = formatNumberWithSpaces(marketPrice);
|
|
||||||
const offerPriceString = formatNumberWithSpaces(
|
|
||||||
Math.round(marketPrice * (
|
|
||||||
1 + this.premiumProvidingCallback()
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
const container = document.createElement("div");
|
const container = document.createElement("div");
|
||||||
container.id = "premium-price-display-area";
|
container.id = "premium-price-display-area";
|
||||||
|
|
||||||
|
|
@ -36,7 +27,7 @@ class PriceDisplay {
|
||||||
|
|
||||||
const offerSpan = document.createElement("span");
|
const offerSpan = document.createElement("span");
|
||||||
offerSpan.id = "offer-price";
|
offerSpan.id = "offer-price";
|
||||||
offerSpan.textContent = offerPriceString;
|
this.offerPriceSpan = offerSpan
|
||||||
|
|
||||||
offerParagraph.appendChild(offerSpan);
|
offerParagraph.appendChild(offerSpan);
|
||||||
offerParagraph.append("€/BTC");
|
offerParagraph.append("€/BTC");
|
||||||
|
|
@ -47,7 +38,7 @@ class PriceDisplay {
|
||||||
|
|
||||||
const marketSpan = document.createElement("span");
|
const marketSpan = document.createElement("span");
|
||||||
marketSpan.id = "market-price";
|
marketSpan.id = "market-price";
|
||||||
marketSpan.textContent = marketPriceString;
|
this.marketPriceSpan = marketSpan
|
||||||
|
|
||||||
marketParagraph.appendChild(marketSpan);
|
marketParagraph.appendChild(marketSpan);
|
||||||
marketParagraph.append("€/BTC)");
|
marketParagraph.append("€/BTC)");
|
||||||
|
|
@ -55,12 +46,25 @@ class PriceDisplay {
|
||||||
container.appendChild(offerParagraph);
|
container.appendChild(offerParagraph);
|
||||||
container.appendChild(marketParagraph);
|
container.appendChild(marketParagraph);
|
||||||
|
|
||||||
|
this.updatePrices();
|
||||||
|
|
||||||
this.element = container;
|
this.element = container;
|
||||||
this.parentElement.appendChild(this.element);
|
this.parentElement.appendChild(this.element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {}
|
updatePrices() {
|
||||||
|
const marketPrice = this.priceProvidingCallback()
|
||||||
|
const marketPriceString = formatNumberWithSpaces(marketPrice);
|
||||||
|
const offerPriceString = formatNumberWithSpaces(
|
||||||
|
Math.round(marketPrice * (
|
||||||
|
1 + this.premiumProvidingCallback()
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
|
this.marketPriceSpan.innerText = marketPriceString;
|
||||||
|
this.offerPriceSpan.innerText = offerPriceString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function offersPage() {
|
function offersPage() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue