mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
fix(liquidity): render refresh controls without SVG
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Button {
|
||||
id: root
|
||||
|
||||
required property var theme
|
||||
property string accessibleName: qsTr("Refresh position data")
|
||||
|
||||
implicitWidth: 40
|
||||
implicitHeight: 40
|
||||
hoverEnabled: true
|
||||
text: "\u21bb"
|
||||
|
||||
Accessible.name: root.accessibleName
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: Accessible.name
|
||||
|
||||
contentItem: Text {
|
||||
text: root.text
|
||||
color: root.enabled ? root.theme.colors.textSecondary
|
||||
: root.theme.colors.textPlaceholder
|
||||
font.pixelSize: 20
|
||||
font.weight: Font.Medium
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: width / 2
|
||||
color: root.pressed ? root.theme.colors.selection
|
||||
: root.hovered || root.activeFocus
|
||||
? root.theme.colors.panelHoverBg
|
||||
: root.theme.colors.panelBg
|
||||
border.color: root.theme.colors.borderStrong
|
||||
border.width: 1
|
||||
}
|
||||
}
|
||||
@@ -206,17 +206,12 @@ AmmActionCard {
|
||||
implicitHeight: 24
|
||||
}
|
||||
|
||||
LogosIconButton {
|
||||
iconSource: LogosIcons.refresh
|
||||
iconColor: root.theme.colors.textSecondary
|
||||
iconSize: 18
|
||||
AmmRefreshButton {
|
||||
theme: root.theme
|
||||
Layout.preferredWidth: 36
|
||||
Layout.preferredHeight: 36
|
||||
enabled: !root.contextLoading && !root.submitting
|
||||
visible: root.showRefreshAction
|
||||
Accessible.name: qsTr("Refresh position data")
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: Accessible.name
|
||||
onClicked: root.refreshRequested()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,17 +89,12 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
LogosIconButton {
|
||||
AmmRefreshButton {
|
||||
objectName: "refreshPositionButton"
|
||||
iconSource: LogosIcons.refresh
|
||||
iconColor: theme.colors.textSecondary
|
||||
iconSize: 18
|
||||
theme: theme
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
enabled: !newPositionFlow.contextLoading && !newPositionFlow.submitting
|
||||
Accessible.name: qsTr("Refresh position data")
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: Accessible.name
|
||||
onClicked: newPositionFlow.refreshContext(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,12 @@ TestCase {
|
||||
var rail = findChild(page, "positionStepRail")
|
||||
var compactSteps = findChild(page, "compactPositionSteps")
|
||||
var form = findChild(page, "newPositionForm")
|
||||
var refresh = findChild(page, "refreshPositionButton")
|
||||
verify(rail)
|
||||
verify(compactSteps)
|
||||
verify(form)
|
||||
verify(refresh)
|
||||
compare(refresh.text, "\u21bb")
|
||||
compare(page.wideLayout, true)
|
||||
verify(form.width > rail.width)
|
||||
|
||||
@@ -125,6 +128,16 @@ TestCase {
|
||||
compare(page.flow.contextHints(true).refreshWalletAccounts, true)
|
||||
}
|
||||
|
||||
function test_refreshControlRequestsContext() {
|
||||
var backend = createTemporaryObject(backendComponent, testCase)
|
||||
var page = createTemporaryObject(pageComponent, testCase, { "backend": backend })
|
||||
var refresh = findChild(page, "refreshPositionButton")
|
||||
verify(refresh)
|
||||
|
||||
refresh.clicked()
|
||||
tryCompare(backend, "contextRefreshCalls", 1)
|
||||
}
|
||||
|
||||
function test_repeatedIdenticalContextCompletesRefresh() {
|
||||
var backend = createTemporaryObject(backendComponent, testCase)
|
||||
var page = createTemporaryObject(pageComponent, testCase, { "backend": backend })
|
||||
|
||||
Reference in New Issue
Block a user