Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dexpro/orderbook/bignum alignment #2465

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions atomic_defi_design/Dex/Constants/General.qml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@ QtObject {
return feetype + " " + amount + " " + ticker + " (" + fiat_text + ")"
}

function reducedBignum(text, decimals=8, max_length=12) {
let val = new BigNumber(text).toFixed(decimals)
if (val.length > max_length)
{
return val.substring(0, max_length)
}
return val
}

function getSimpleFromPlaceholder(selectedTicker, selectedOrder, sell_ticker_balance) {
if (privacy_mode)
{
Expand Down
28 changes: 14 additions & 14 deletions atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Item
DefaultTooltip
{
visible: mouse_area.containsMouse && (tooltip_text.text_value != "")
width: 300
width: 340

contentItem: RowLayout
{
width: 290
width: 330

Qaterial.ColorIcon
{
Expand Down Expand Up @@ -175,22 +175,22 @@ Item
// Dot on the left side of the row to indicate own order
Rectangle
{
Layout.leftMargin: 6
Layout.leftMargin: 4
Layout.alignment: Qt.AlignVCenter
opacity: is_mine ? 1 : 0
width: 6
height: 6
radius: 3
width: 4
height: 4
radius: 2
color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor
}

// Price
Dex.ElidableText
{
Layout.fillHeight: true
Layout.minimumWidth: 90
Layout.minimumWidth: 100
Layout.alignment: Qt.AlignVCenter
text: { new BigNumber(price).toFixed(8) }
text: General.reducedBignum(price, 8)
font.family: DexTypo.fontFamily
font.pixelSize: 12
color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor
Expand All @@ -203,9 +203,9 @@ Item
Dex.ElidableText
{
Layout.fillHeight: true
Layout.minimumWidth: 90
Layout.minimumWidth: 100
Layout.alignment: Qt.AlignVCenter
text: { new BigNumber(base_max_volume).toFixed(6) }
text: General.reducedBignum(base_max_volume, 6)
font.family: DexTypo.fontFamily
font.pixelSize: 12
horizontalAlignment: Text.AlignRight
Expand All @@ -219,12 +219,12 @@ Item
{
id: total_text
Layout.fillHeight: true
Layout.minimumWidth: 90
Layout.minimumWidth: 100
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
font.family: DexTypo.fontFamily
font.pixelSize: 12
text: { new BigNumber(total).toFixed(6) }
text: General.reducedBignum(total, 6)
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
Expand All @@ -236,7 +236,7 @@ Item
{
id: cancel_flat_btn
Layout.fillHeight: true
width: 30
width: 20
Layout.alignment: Qt.AlignVCenter

MouseArea
Expand All @@ -261,7 +261,7 @@ Item
Qaterial.ColorIcon
{
anchors.centerIn: parent
iconSize: 16
iconSize: 14
color: Dex.CurrentTheme.warningColor
source: Qaterial.Icons.close
visible: is_mine
Expand Down
4 changes: 2 additions & 2 deletions atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Widget
readonly property string pair_volume_24hr: API.app.trading_pg.pair_volume_24hr
readonly property string pair: atomic_qt_utilities.retrieve_main_ticker(left_ticker) + "/" + atomic_qt_utilities.retrieve_main_ticker(right_ticker)

margins: 10
spacing: 10
margins: 8
spacing: 8
collapsable: false

Header
Expand Down
Loading