From 478851d02e506e2feb9ce1d4f2ea1b9ae1792c10 Mon Sep 17 00:00:00 2001 From: dev-warrior777 <126670673+dev-warrior777@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:25:55 +0800 Subject: [PATCH] client/webserver: Update Order-details Type to show the correct value. (#3044) * client/webserver: Update Order-details Type to show the correct value. * Also cleaned up walletpair BW_ARGS to override dexc.conf options. --------- Co-authored-by: dev-warrior777 <> --- client/webserver/jsintl.go | 5 +++++ client/webserver/site/src/js/locales.ts | 1 + client/webserver/site/src/js/markets.ts | 2 +- client/webserver/site/src/js/orderutil.ts | 11 +++++++++++ dex/testing/walletpair/walletpair.sh | 4 ++-- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/webserver/jsintl.go b/client/webserver/jsintl.go index 2a33a92c50..acc13a4ae8 100644 --- a/client/webserver/jsintl.go +++ b/client/webserver/jsintl.go @@ -86,6 +86,7 @@ const ( limitOrderID = "LIMIT_ORDER" limitOrderImmediateTifID = "LIMIT_ORDER_IMMEDIATE_TIF" marketOrderID = "MARKET_ORDER" + cancelOrderID = "CANCEL_ORDER" matchStatusNewlyMatchedID = "MATCH_STATUS_NEWLY_MATCHED" matchStatusMakerSwapCastID = "MATCH_STATUS_MAKER_SWAP_CAST" matchStatusTakerSwapCastID = "MATCH_STATUS_TAKER_SWAP_CAST" @@ -304,6 +305,7 @@ var enUS = map[string]*intl.Translation{ limitOrderID: {T: "limit"}, limitOrderImmediateTifID: {T: "limit (i)", Notes: "i = immediate"}, marketOrderID: {T: "market"}, + cancelOrderID: {T: "cancel"}, matchStatusNewlyMatchedID: {T: "Newly Matched"}, matchStatusMakerSwapCastID: {T: "Maker Swap Sent"}, matchStatusTakerSwapCastID: {T: "Taker Swap Sent"}, @@ -525,6 +527,9 @@ var zhCN = map[string]*intl.Translation{ createID: {T: "创建"}, availableID: {T: "可用"}, immatureID: {T: "不成"}, + limitOrderID: {T: "限价单"}, + marketOrderID: {T: "市价单"}, + cancelOrderID: {T: "取消单"}, } var plPL = map[string]*intl.Translation{ diff --git a/client/webserver/site/src/js/locales.ts b/client/webserver/site/src/js/locales.ts index 056dcdcc62..7c4ca1b7a6 100644 --- a/client/webserver/site/src/js/locales.ts +++ b/client/webserver/site/src/js/locales.ts @@ -86,6 +86,7 @@ export const ID_UNSUPPORTED_ASSET_INFO_ERR_MSG = 'UNSUPPORTED_ASSET_INFO_ERR_MSG export const ID_LIMIT_ORDER = 'LIMIT_ORDER' export const ID_LIMIT_ORDER_IMMEDIATE_TIF = 'LIMIT_ORDER_IMMEDIATE_TIF' export const ID_MARKET_ORDER = 'MARKET_ORDER' +export const ID_CANCEL_ORDER = 'CANCEL_ORDER' export const ID_MATCH_STATUS_NEWLY_MATCHED = 'MATCH_STATUS_NEWLY_MATCHED' export const ID_MATCH_STATUS_MAKER_SWAP_CAST = 'MATCH_STATUS_MAKER_SWAP_CAST' export const ID_MATCH_STATUS_TAKER_SWAP_CAST = 'MATCH_STATUS_TAKER_SWAP_CAST' diff --git a/client/webserver/site/src/js/markets.ts b/client/webserver/site/src/js/markets.ts index f254349f6a..8121cd0831 100644 --- a/client/webserver/site/src/js/markets.ts +++ b/client/webserver/site/src/js/markets.ts @@ -1713,7 +1713,7 @@ export default class MarketsPage extends BasePage { else rateStr = Doc.formatRateFullPrecision(ord.rate, market.baseUnitInfo, market.quoteUnitInfo, cfg.ratestep) details.rate.textContent = mord.header.rate.textContent = rateStr header.baseSymbol.textContent = market.baseUnitInfo.conventional.unit - details.type.textContent = market.quoteUnitInfo.conventional.unit + details.type.textContent = OrderUtil.orderTypeText(ord.type) this.updateMetaOrder(mord) Doc.bind(div, 'mouseenter', () => { diff --git a/client/webserver/site/src/js/orderutil.ts b/client/webserver/site/src/js/orderutil.ts index eb5d99c016..c136704617 100644 --- a/client/webserver/site/src/js/orderutil.ts +++ b/client/webserver/site/src/js/orderutil.ts @@ -244,3 +244,14 @@ function dexAssetSymbol (host: string, assetID: number): string { export function isCancellable (ord: Order): boolean { return ord.type === Limit && ord.tif === StandingTiF && ord.status < StatusExecuted } + +export function orderTypeText (ordType: number): string { + switch (ordType) { + case OrderTypeLimit: + return intl.prep(intl.ID_LIMIT_ORDER) + case OrderTypeMarket: + return intl.prep(intl.ID_MARKET_ORDER) + default: // OrderTypeCancel + return intl.prep(intl.ID_CANCEL_ORDER) + } +} diff --git a/dex/testing/walletpair/walletpair.sh b/dex/testing/walletpair/walletpair.sh index d35499dc9d..7c43394815 100755 --- a/dex/testing/walletpair/walletpair.sh +++ b/dex/testing/walletpair/walletpair.sh @@ -27,10 +27,10 @@ while [ "${1:-}" != "" ]; do ;; -2) ONLY_TWO="1" - echo "Only starting wallet # 1" + echo "Only starting wallet # 2" ;; *) - BW_ARGS+=("$1") + BW_ARGS+=" ${1}" ;; esac shift