Skip to content

Commit

Permalink
martonp review followup
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Aug 28, 2023
1 parent a925afa commit c179cc0
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 17 deletions.
18 changes: 17 additions & 1 deletion client/core/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ func (ord *OrderReader) ToSymbol() string {
return ord.BaseSymbol
}

// FromTicker if the conventional unit for the from asset.
func (ord *OrderReader) FromTicker() string {
if ord.Sell {
return ord.BaseUnitInfo.Conventional.Unit
}
return ord.QuoteUnitInfo.Conventional.Unit
}

// ToTicker if the conventional unit for the to asset.
func (ord *OrderReader) ToTicker() string {
if ord.Sell {
return ord.QuoteUnitInfo.Conventional.Unit
}
return ord.BaseUnitInfo.Conventional.Unit
}

// FromFeeSymbol is the symbol of the asset used to pay swap fees.
func (ord *OrderReader) FromFeeSymbol() string {
if ord.Sell {
Expand Down Expand Up @@ -318,7 +334,7 @@ func (ord *OrderReader) RateString() string {
if ord.Type == order.MarketOrderType {
return "market"
}
return fmt.Sprintf("%s %s/%s", ord.formatRate(ord.Rate), ord.QuoteSymbol, ord.BaseSymbol)
return fmt.Sprintf("%s %s/%s", ord.formatRate(ord.Rate), ord.QuoteUnitInfo.Conventional.Unit, ord.BaseUnitInfo.Conventional.Unit)
}

// AverageRateString returns a formatting string containing the average rate of
Expand Down
2 changes: 1 addition & 1 deletion client/webserver/site/src/html/bodybuilder.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
{{end}}

{{define "bottom"}}
<script src="/js/entry.js?v=00c2e23d|27a79eb3"></script>
<script src="/js/entry.js?v=41f4932c|4c313cb4"></script>
</body>
</html>
{{end}}
4 changes: 2 additions & 2 deletions client/webserver/site/src/html/markets.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@
<div>
[[[:title:lot_size]]]:
<span id="lotSize"></span>
<span data-unit="base"></span>
<span data-unit="base" data-unit-format="noparent"></span>
</div>
<div>
[[[Rate Step]]]:
<span id="rateStep"></span>
<span data-unit="quote"></span>
<span data-unit="quote" data-unit-format="noparent"></span>
</div>
</div>
<div class="my-2 fs14 h21" id="maxBox">
Expand Down
4 changes: 2 additions & 2 deletions client/webserver/site/src/html/order.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{define "microIcon"}}
<img src="/img/coins/{{.}}.png" class="micro-icon">
<img src="/img/coins/{{baseAssetSymbol .}}.png" class="micro-icon">
{{end}}

{{define "order"}}
Expand Down Expand Up @@ -40,7 +40,7 @@
</div>
<div class="order-datum">
<div>[[[Offering]]]</div>
<div>{{$ord.OfferString}} {{$ord.FromSymbol}} {{template "microIcon" $ord.FromSymbol}}</div>
<div>{{$ord.OfferString}} {{$ord.FromTicker}} {{template "microIcon" $ord.FromTicker}}</div>
</div>
<div class="order-datum">
<div>[[[Asking]]]</div>
Expand Down
14 changes: 7 additions & 7 deletions client/webserver/site/src/html/wallets.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@
{{- /* SEND */ -}}
<form class="pb-3 d-hide" id="sendForm" autocomplete="off">
<div class="form-closer hoverbg"><span class="ico-cross"></span></div>
<div class="py-1 text-center position-relative fs24 sans-light">
<div class="py-1 flex-center position-relative fs24 sans-light">
[[[Send]]]
<img id="sendLogo" class="mini-icon mx-1">
<img id="sendLogo" class="mini-icon mx-2">
<span id="sendName"></span>
<div class="flex-center pt-1 d-hide fs18 sans" id="sendTokenMsgBox">
<span>[[[Token on]]]</span>
<img id="sendTokenParentLogo" class="ms-1 micro-icon">
<span id="sendTokenParentName"></span>
</div>
</div>
<div class="flex-center pt-1 d-hide fs18 sans" id="sendTokenMsgBox">
<span>[[[Token on]]]</span>
<img id="sendTokenParentLogo" class="ms-1 micro-icon">
<span id="sendTokenParentName"></span>
</div>
<div class="mt-3">
<label for="sendAddr" class="form-label ps-1 mb-1">[[[Address]]]</label>
Expand Down
2 changes: 1 addition & 1 deletion client/webserver/site/src/js/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ export class DepositAddress {
const asset = app().assets[assetID]
page.depositLogo.src = Doc.logoPath(asset.symbol)
const wallet = app().walletMap[assetID]
page.depositName.textContent = asset.name
page.depositName.textContent = asset.unitInfo.conventional.unit
page.depositAddress.textContent = wallet.address
page.qrcode.src = `/generateqrcode?address=${wallet.address}`
if (asset.token) {
Expand Down
4 changes: 2 additions & 2 deletions client/webserver/site/src/js/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ export default class WalletsPage extends BasePage {
async showSendForm (assetID: number) {
const page = this.page
const box = page.sendForm
const { wallet, name, unitInfo: ui, symbol, token } = app().assets[assetID]
const { wallet, unitInfo: ui, symbol, token } = app().assets[assetID]
Doc.hide(page.toggleSubtract)
page.subtractCheckBox.checked = false

Expand All @@ -1153,7 +1153,7 @@ export default class WalletsPage extends BasePage {
this.showFiatValue(assetID, 0, page.sendValue)
page.walletBal.textContent = Doc.formatFullPrecision(wallet.balance.available, ui)
page.sendLogo.src = Doc.logoPath(symbol)
page.sendName.textContent = name
page.sendName.textContent = ui.conventional.unit
if (token) {
const parentAsset = app().assets[token.parentID]
page.sendTokenParentLogo.src = Doc.logoPath(parentAsset.symbol)
Expand Down
7 changes: 7 additions & 0 deletions client/webserver/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,11 @@ var templateFuncs = template.FuncMap{
}
return "/img/coins/" + string(char) + ".png"
},
"baseAssetSymbol": func(symbol string) string {
parts := strings.Split(symbol, ".")
if len(parts) == 0 {
return "wtf"
}
return parts[0]
},
}
2 changes: 1 addition & 1 deletion server/asset/eth/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var (

// blockPollInterval is the delay between calls to bestBlockHash to check
// for new blocks. Modify at compile time via blockPollIntervalStr:
// go build -tags lgpl -ldflags "-X 'decred.org/dcrdex/server/asset/eth.blockPollIntervalStr=10s'"
// go build -ldflags "-X 'decred.org/dcrdex/server/asset/eth.blockPollIntervalStr=10s'"
blockPollInterval = time.Second
blockPollIntervalStr string
)
Expand Down

0 comments on commit c179cc0

Please sign in to comment.