Lukáš Tinkl 42533b8c61 feat:[UI - Swap] Create new TokenSelector component
- create new dedicated (asset) token selector component
- integrate it into `SwapInputPanel` and `SwapModal`
- add respective SB page and QML tests suite

Fixes #14783
2024-06-25 13:06:57 +02:00

35 lines
937 B
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import AppLayouts.Wallet 1.0
import utils 1.0
StatusButton {
id: root
required property double value
required property string symbol
required property bool valid
property var formatCurrencyAmount: (amount, symbol) => { return "FIXME" }
readonly property double maxSafeValue: WalletUtils.calculateMaxSafeSendAmount(value, symbol)
readonly property string maxSafeValueAsString: maxSafeValue.toLocaleString(locale, 'f', -128)
locale: LocaleUtils.userInputLocale
implicitHeight: 22
type: valid ? StatusBaseButton.Type.Normal : StatusBaseButton.Type.Danger
text: qsTr("Max. %1").arg(value === 0 ? locale.zeroDigit : root.formatCurrencyAmount(maxSafeValue, root.symbol))
horizontalPadding: 8
verticalPadding: 3
radius: 20
font.pixelSize: 12
font.weight: Font.Normal
}