status-desktop/storybook/pages/SlippageSelectorPage.qml
Lukáš Tinkl 5cf4592c3b fix: Slippage Selector Issues
- add various error/warning messages according to Figma (where it makes
sense)
- letters or more than 2 decimals are caught by the internal validator
so those combinations are impossible to enter
- fix marking the custom value as (in)valid
- fix selecting "Use default" after typing a custom value
- fix resetting to predefined value after typing a custom value that
matches one of the predefined ones
- reject typing thousands separator
- add regression QML tests for the above fixes

Fixes #15017
2024-09-03 17:36:48 +02:00

79 lines
1.9 KiB
QML

import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import shared.controls 1.0
import utils 1.0
import Storybook 1.0
SplitView {
orientation: Qt.Horizontal
Logs { id: logs }
Pane {
SplitView.fillWidth: true
SplitView.fillHeight: true
SlippageSelector {
id: slippageSelector
anchors.centerIn: parent
}
}
LogsAndControlsPanel {
SplitView.fillHeight: true
SplitView.preferredWidth: 300
logsView.logText: logs.logText
ColumnLayout {
anchors.fill: parent
Label {
Layout.fillWidth: true
font.weight: Font.Medium
text: "Value: %1".arg(slippageSelector.value)
}
Label {
Layout.fillWidth: true
font.weight: Font.Medium
text: "Valid: %1".arg(slippageSelector.valid ? "true" : "false")
}
Label {
Layout.fillWidth: true
font.weight: Font.Medium
text: "Edited: %1".arg(slippageSelector.isEdited ? "true" : "false")
}
ColumnLayout {
Repeater {
model: [0, 0.1, 0.5, 0.24, 0.8, 120.84]
Button {
text: "set " + modelData
onClicked: slippageSelector.value = modelData
}
}
}
Button {
text: "Reset defaults"
onClicked: slippageSelector.reset()
}
Item { Layout.fillHeight: true }
}
}
}
// category: Controls
// https://www.figma.com/design/TS0eQX9dAZXqZtELiwKIoK/Swap---Milestone-1?node-id=3409-257346&t=ENK93cK7GyTqEV8S-0
// https://www.figma.com/design/TS0eQX9dAZXqZtELiwKIoK/Swap---Milestone-1?node-id=3410-262441&t=ENK93cK7GyTqEV8S-0