From 46e17ab35e2eeb887dbc03fb42da0b031b6d1ad2 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sat, 18 Jul 2026 05:23:11 -0300 Subject: [PATCH] fix(liquidity): render refresh controls without SVG --- .../components/liquidity/AmmRefreshButton.qml | 38 +++++++++++++++++++ .../components/liquidity/NewPositionForm.qml | 9 +---- apps/amm/qml/pages/LiquidityPage.qml | 9 +---- apps/amm/tests/qml/tst_LiquidityPage.qml | 13 +++++++ 4 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 apps/amm/qml/components/liquidity/AmmRefreshButton.qml diff --git a/apps/amm/qml/components/liquidity/AmmRefreshButton.qml b/apps/amm/qml/components/liquidity/AmmRefreshButton.qml new file mode 100644 index 0000000..e1ed383 --- /dev/null +++ b/apps/amm/qml/components/liquidity/AmmRefreshButton.qml @@ -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 + } +} diff --git a/apps/amm/qml/components/liquidity/NewPositionForm.qml b/apps/amm/qml/components/liquidity/NewPositionForm.qml index 5da13b8..afa8c7e 100644 --- a/apps/amm/qml/components/liquidity/NewPositionForm.qml +++ b/apps/amm/qml/components/liquidity/NewPositionForm.qml @@ -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() } } diff --git a/apps/amm/qml/pages/LiquidityPage.qml b/apps/amm/qml/pages/LiquidityPage.qml index d76f385..d15bdba 100644 --- a/apps/amm/qml/pages/LiquidityPage.qml +++ b/apps/amm/qml/pages/LiquidityPage.qml @@ -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) } } diff --git a/apps/amm/tests/qml/tst_LiquidityPage.qml b/apps/amm/tests/qml/tst_LiquidityPage.qml index e4d4f4c..28f94cd 100644 --- a/apps/amm/tests/qml/tst_LiquidityPage.qml +++ b/apps/amm/tests/qml/tst_LiquidityPage.qml @@ -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 })