4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-12 02:05:51 +00:00

user can set default price for sell trade by clicking on button (feat. by irohdw)

This commit is contained in:
AlphaX-Projects 2022-11-15 16:51:02 +01:00
parent 4682ee891c
commit 442ea2e366
18 changed files with 75 additions and 41 deletions

View File

@ -321,7 +321,8 @@
"tchange43":"MEINE KAUFGESCHICHTE",
"tchange44":"Automatischer Kaufauftrag erfolgreich hinzugefügt!",
"tchange45":"AUTO KAUFEN MIT",
"tchange46":"AUTOKAUF"
"tchange46":"AUTOKAUF",
"tchange47":"Verkaufe für diesen Preis"
},
"rewardsharepage":{
"rchange1":"Belohnungsanteile",

View File

@ -321,7 +321,8 @@
"tchange43":"MI HISTORIAL DE COMPRAS",
"tchange44":"Orden de compra automática agregada con éxito!",
"tchange45":"AUTO COMPRAR CON",
"tchange46":"COMPRA AUTOMÁTICA"
"tchange46":"COMPRA AUTOMÁTICA",
"tchange47":"Vender por este precio"
},
"rewardsharepage":{
"rchange1":"Rewardshares",

View File

@ -321,7 +321,8 @@
"tchange43":"MON HISTORIQUE D'ACHAT",
"tchange44":"Commande d'achat automatique ajoutée avec succès !",
"tchange45":"ACHAT AUTO AVEC",
"tchange46":"ACHAT AUTOMATIQUE"
"tchange46":"ACHAT AUTOMATIQUE",
"tchange47":"Vendre à ce prix"
},
"rewardsharepage":{
"rchange1":"Récompenses",

View File

@ -322,7 +322,8 @@
"tchange43":"मेरा इतिहास खरीदें",
"tchange44":"स्वतः खरीद आदेश सफलतापूर्वक जोड़ा गया!",
"tchange45":"ऑटो के साथ खरीदें",
"tchange46":"ऑटो खरीदें"
"tchange46":"ऑटो खरीदें",
"tchange47":"इस कीमत पर बेचें"
},
"rewardsharepage":{
"rchange1":"रिवॉर्डशेयर",

View File

@ -321,7 +321,8 @@
"tchange43":"MOJA POVIJEST KUPNJE",
"tchange44":"Uspješno dodana automatska narudžba za kupnju!",
"tchange45":"AUTO KUPITE SA",
"tchange46":"AUTO OTKUP"
"tchange46":"AUTO OTKUP",
"tchange47":"Prodaj za ovu cijenu"
},
"rewardsharepage":{
"rchange1":"Nagradni udio (Rewardshares)",

View File

@ -321,7 +321,8 @@
"tchange43":"VÁSÁRLÁSI TÖRTÉNETEM",
"tchange44":"Az automatikus vásárlási rendelés sikeresen hozzáadva!",
"tchange45":"AUTOMATIKUS VÁSÁRLÁS",
"tchange46":"AUTOMATIKUS VÁSÁRLÁS"
"tchange46":"AUTOMATIKUS VÁSÁRLÁS",
"tchange47":"Eladni ezen az áron"
},
"rewardsharepage":{
"rchange1":"Jutalommegosztások",

View File

@ -321,7 +321,8 @@
"tchange43":"LA MIA STORIA DI ACQUISTO",
"tchange44":"Ordine di acquisto automatico aggiunto con successo!",
"tchange45":"ACQUISTA AUTO CON",
"tchange46":"ACQUISTO AUTO"
"tchange46":"ACQUISTO AUTO",
"tchange47":"Vendi a questo prezzo"
},
"rewardsharepage":{
"rchange1":"Quote di ricompensa",

View File

@ -321,7 +321,8 @@
"tchange43":"내 구매 내역",
"tchange44":"자동 구매 주문을 성공적으로 추가했습니다!",
"tchange45":"자동 구매",
"tchange46":"자동 구매"
"tchange46":"자동 구매",
"tchange47":"이 가격에 팔아요"
},
"rewardsharepage":{
"rchange1":"보상 공유",

View File

@ -321,7 +321,8 @@
"tchange43":"MIN KJØPSHISTORIE",
"tchange44":"Autokjøpsordre er lagt til!",
"tchange45":"AUTOKJØP MED",
"tchange46":"AUTOKJØP"
"tchange46":"AUTOKJØP",
"tchange47":"Selges for denne prisen"
},
"rewardsharepage":{
"rchange1":"Belønningsdel",

View File

@ -321,7 +321,8 @@
"tchange43":"MOJA HISTORIA ZAKUPÓW",
"tchange44":"Pomyślnie dodano automatyczne zamówienie zakupu!",
"tchange45":"AUTO KUP Z",
"tchange46":"AUTO KUP"
"tchange46":"AUTO KUP",
"tchange47":"Sprzedaj za tę cenę"
},
"rewardsharepage":{
"rchange1":"Podział nagród",

View File

@ -321,7 +321,8 @@
"tchange43":"MEU HISTÓRICO DE COMPRAS",
"tchange44":"Pedido de compra automática adicionado com sucesso!",
"tchange45":"COMPRA AUTOMÁTICA COM",
"tchange46":"COMPRA AUTOMÁTICA"
"tchange46":"COMPRA AUTOMÁTICA",
"tchange47":"Vendo por este preço"
},
"rewardsharepage":{
"rchange1":"Ações de recompensa",

View File

@ -321,7 +321,8 @@
"tchange43":"ISTORICUL MEU DE CUMPARARI",
"tchange44":"Comanda de cumparare automata a fost adaugata cu succes!",
"tchange45":"CUMPARA AUTOMATA CU",
"tchange46":"CUMPARARE AUTOMATA"
"tchange46":"CUMPARARE AUTOMATA",
"tchange47":"Vinde la acest pret"
},
"rewardsharepage":{
"rchange1":"Cote de recompensa",

View File

@ -321,7 +321,8 @@
"tchange43":"MOJA ISTORIJA KUPOVINE",
"tchange44":"Narudžbina za automatsku kupovinu je uspešno dodata!",
"tchange45":"AUTO KUPI SA",
"tchange46":"AUTO BUI"
"tchange46":"AUTO BUI",
"tchange47":"Prodaj za ovu cenu"
},
"rewardsharepage":{
"rchange1":"Udeo nagrade",

View File

@ -321,7 +321,8 @@
"tchange43":"МОЯ ИСТОРИЯ ПОКУПОК",
"tchange44":"Заказ на автоматическую покупку успешно добавлен!",
"tchange45":"АВТО КУПИТЬ С",
"tchange46":"АВТО КУПИТЬ"
"tchange46":"АВТО КУПИТЬ",
"tchange47":"Продать по этой цене"
},
"rewardsharepage":{
"rchange1":"Вознаграждения",

View File

@ -321,7 +321,8 @@
"tchange43":"MY BUY HISTORY",
"tchange44":"Successfully added auto buy order!",
"tchange45":"AUTO BUY WITH",
"tchange46":"AUTO BUY"
"tchange46":"AUTO BUY",
"tchange47":"Sell for this price"
},
"rewardsharepage":{
"rchange1":"Rewardshares",

View File

@ -321,7 +321,8 @@
"tchange43":"我的购买历史",
"tchange44":"成功添加自动买单!",
"tchange45":"自动购买",
"tchange46":"自动购买"
"tchange46":"自动购买",
"tchange47":"以这个价格出售"
},
"rewardsharepage":{
"rchange1":"铸币密钥",

View File

@ -321,7 +321,8 @@
"tchange43":"我的購買歷史",
"tchange44":"成功添加自動買單!",
"tchange45":"自動購買",
"tchange46":"自動購買"
"tchange46":"自動購買",
"tchange47":"以這個價格出售"
},
"rewardsharepage":{
"rchange1":"鑄幣密鑰",

View File

@ -72,7 +72,8 @@ class TradePortal extends LitElement {
tradeAddressResult: { type: Array },
displayTradeAddress: { type: String },
displayTradeLevel: { type: String },
displayTradeBalance: { type: String }
displayTradeBalance: { type: String },
qortRatio: {type: Number}
}
}
@ -1175,6 +1176,7 @@ class TradePortal extends LitElement {
<div style="text-align: center;">
<h2 style="color: var(--black);">${translate("tradepage.tchange33")} ${this.listedCoins.get(this.selectedCoin).coinCode} ${translate("tradepage.tchange40")}</h2>
<h3 style="color: var(--black);">1 <span style="color: #03a9f4;">QORT</span> = ${this.exchangeRateQort()} ${this.listedCoins.get(this.selectedCoin).coinCode}</h3>
<mwc-button dense unelevated label="${translate("tradepage.tchange47")}" @click=${() => this.setDefaultSellPrice()}></mwc-button>
</div>
<div></div>
</div>
@ -1300,11 +1302,7 @@ class TradePortal extends LitElement {
use(checkLanguage)
if (checkTheme === 'dark') {
this.theme = 'dark'
} else {
this.theme = 'light'
}
this.theme = (checkTheme === 'dark') ? 'dark' : 'light'
document.querySelector('html').setAttribute('theme', this.theme)
})
@ -1370,11 +1368,7 @@ class TradePortal extends LitElement {
changeTheme() {
const checkTheme = localStorage.getItem('qortalTheme')
if (checkTheme === 'dark') {
this.theme = 'dark';
} else {
this.theme = 'light';
}
this.theme = (checkTheme === 'dark') ? 'dark' : 'light'
document.querySelector('html').setAttribute('theme', this.theme);
}
@ -1398,19 +1392,29 @@ class TradePortal extends LitElement {
}
exchangeRateQort() {
if (this.listedCoins.get(this.selectedCoin).coinCode === "BTC") {
return html`${this.qortbtc}`
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "LTC") {
return html`${this.qortltc}`
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DOGE") {
return html`${this.qortdoge}`
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DGB") {
return html`${this.qortdgb}`
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "RVN") {
return html`${this.qortrvn}`
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "ARRR") {
return html`${this.qortarrr}`
switch(this.listedCoins.get(this.selectedCoin).coinCode) {
case "BTC":
this.qortRatio = this.qortbtc
break
case "LTC":
this.qortRatio = this.qortltc
break
case "DOGE":
this.qortRatio = this.qortdoge
break
case "DGB":
this.qortRatio = this.qortdgb
break
case "RVN":
this.qortRatio = this.qortrvn
break
case "ARRR":
this.qortRatio = this.qortarrr
break
default:
break
}
return html`${this.qortRatio}`
}
exchangeRateForeign() {
@ -1562,12 +1566,22 @@ class TradePortal extends LitElement {
}
displayTabContent(tab) {
const tabPane = this.shadowRoot.getElementById("tabs-1")
tabPane.setAttribute("activeIndex", (tab === 'buy') ? '0': '1')
const tabBuyContent = this.shadowRoot.getElementById('tab-buy-content')
const tabSellContent = this.shadowRoot.getElementById('tab-sell-content')
tabBuyContent.style.display = (tab === 'buy') ? 'block' : 'none'
const tabSellContent = this.shadowRoot.getElementById('tab-sell-content')
tabSellContent.style.display = (tab === 'sell') ? 'block' : 'none'
}
setDefaultSellPrice() {
this.displayTabContent('sell')
const tabSellPrice = this.shadowRoot.getElementById('sellPriceInput')
tabSellPrice.value = this.qortRatio.isNaN ? 0 : this.qortRatio
}
async reRenderHistoricTrades() {
this.requestUpdate()
await this.updateComplete
@ -1596,10 +1610,13 @@ class TradePortal extends LitElement {
if (Number(haveFunds) > Number(buyFunds)) {
this.buyBtnDisable = false
this.autoBuyWarning = false
this.displayTabContent('buy')
} else {
this.buyBtnDisable = true
this.autoBuyWarning = true
this.displayTabContent('buy')
}
}
async getAllForAddress(tradeAddress) {