Skip to content

Commit 7ccddc4

Browse files
noeliaSDKhushboo-dev-cpp
authored andcommitted
fix(AddEditSavedAddressPopup): Improve checksum validation UX
- Removed tooltip from checksum indicator on all platforms. - Checksum mismatch is now treated as a standard error instead of a tooltip hint. - Prevents adding an address with an invalid checksum. Closes #19081
1 parent 9001fea commit 7ccddc4

File tree

4 files changed

+50
-46
lines changed

4 files changed

+50
-46
lines changed

ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ Item {
222222
This property sets the visibility of the background. Default value is true.
223223
*/
224224
property bool showBackground: true
225-
225+
/*!
226+
\qmlproperty bool StatusBaseInput::warningMode
227+
This property sets warning mode on the input
228+
*/
229+
property bool warningMode: false
226230
/*!
227231
\qmlproperty StatusAssetSettings StatusBaseInput::icon
228232
This property holds a set of settings for the icon of the StatusBaseInput.
@@ -306,6 +310,9 @@ Item {
306310
if (!root.valid && root.dirty) {
307311
return Theme.palette.dangerColor1
308312
}
313+
if(root.warningMode) {
314+
return Theme.palette.warningColor1
315+
}
309316
if (edit.cursorVisible) {
310317
return Theme.palette.primaryColor1
311318
}

ui/StatusQ/src/StatusQ/Controls/StatusInput.qml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ Control {
233233
This property sets the pending validators to be considered.
234234
*/
235235
property var pendingValidators: []
236+
/*!
237+
\qmlproperty bool StatusInput::warningMode
238+
This property sets warning mode on the input
239+
*/
240+
property bool warningMode: false
241+
/*!
242+
\qmlproperty string StatusInput::warningMessage
243+
This property sets the warning message text.
244+
*/
245+
property string warningMessage: ""
236246

237247
/*!
238248
\qmlsignal
@@ -522,6 +532,7 @@ Control {
522532
Layout.bottomMargin: bottomRow.height > 0 ? labelPadding : 0
523533
maximumLength: root.charLimit
524534
font: root.font
535+
warningMode: root.warningMode
525536
onTextChanged: root.validate()
526537
Keys.forwardTo: [root]
527538
onIconClicked: root.iconClicked()
@@ -586,7 +597,18 @@ Control {
586597
color: Theme.palette.dangerColor1
587598
wrapMode: Text.WordWrap
588599
horizontalAlignment: Text.AlignRight
589-
}
600+
}
601+
602+
StatusBaseText {
603+
id: warningMessage
604+
Layout.fillWidth: true
605+
visible: !!text && root.warningMode && !errorMessage.visible
606+
font.pixelSize: Theme.tertiaryTextFontSize
607+
color: Theme.palette.warningColor1
608+
wrapMode: Text.WordWrap
609+
horizontalAlignment: Text.AlignRight
610+
text: root.warningMessage
611+
}
590612

591613
StatusBaseText {
592614
id: bottomLabelMessageRight

ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ StatusModal {
102102
|| !d.editMode
103103
|| d.colorId.toUpperCase() !== d.storedColorId.toUpperCase()
104104

105-
property bool incorrectChecksum: false
106-
105+
property bool incorrectChecksum: {
106+
if (d.addressInputIsAddress) {
107+
d.incorrectChecksum = !root.store.isChecksumValidForAddress(d.address)
108+
}
109+
}
107110

108111
readonly property bool addressInputIsENS: !!d.ens &&
109112
Utils.isValidEns(d.ens)
@@ -208,13 +211,6 @@ StatusModal {
208211
addressInput.errorMessageCmp.visible = true
209212
}
210213

211-
function checkIfAddressChecksumIsValid() {
212-
d.incorrectChecksum = false
213-
if (d.addressInputIsAddress) {
214-
d.incorrectChecksum = !root.store.isChecksumValidForAddress(d.address)
215-
}
216-
}
217-
218214
function checkForAddressInputErrorsWarnings() {
219215
addressInput.errorMessageCmp.visible = false
220216
addressInput.errorMessageCmp.color = Theme.palette.dangerColor1
@@ -244,7 +240,6 @@ StatusModal {
244240

245241
if (d.addressInputIsAddress) {
246242
d.checkForAddressInputOwningErrorsWarnings()
247-
d.checkIfAddressChecksumIsValid()
248243
return
249244
}
250245

@@ -430,7 +425,7 @@ StatusModal {
430425
enabled: !(d.editMode || d.addAddress)
431426
input.edit.textFormat: TextEdit.RichText
432427
input.rightComponent: (d.resolvingEnsNameInProgress || d.checkingContactsAddressInProgress) ?
433-
loadingIndicator : d.incorrectChecksum? incorrectChecksumComponent : null
428+
loadingIndicator : null
434429
input.asset.name: d.addressInputValid && !d.editMode ? "checkbox" : ""
435430
input.asset.color: enabled ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
436431
input.asset.width: 17
@@ -439,6 +434,9 @@ StatusModal {
439434
input.leftIcon: false
440435
input.tabNavItem: nameInput
441436

437+
warningMode: d.incorrectChecksum
438+
warningMessage: qsTr("Checksum of the entered address is incorrect")
439+
442440
multiline: true
443441

444442
property string plainText: input.edit.getText(0, text.length).trim()
@@ -449,18 +447,6 @@ StatusModal {
449447
StatusLoadingIndicator {}
450448
}
451449

452-
Component {
453-
id: incorrectChecksumComponent
454-
455-
StatusIconWithTooltip {
456-
icon: "warning"
457-
width: 20
458-
height: 20
459-
color: Theme.palette.warningColor1
460-
tooltipText: qsTr("Checksum of the entered address is incorrect")
461-
}
462-
}
463-
464450
onTextChanged: {
465451
if (skipTextUpdate || !d.initialized)
466452
return

ui/imports/shared/popups/addaccount/panels/WatchOnlyAddressSection.qml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,16 @@ Column {
6060
label: qsTr("Ethereum address or ENS name")
6161
placeholderText: qsTr("Type or paste ETH address")
6262
input.multiline: true
63-
input.rightComponent: Row {
64-
spacing: 8
65-
66-
StatusIconWithTooltip {
67-
visible: d.incorrectChecksum
68-
icon: "warning"
69-
width: 20
70-
height: 20
71-
color: Theme.palette.warningColor1
72-
tooltipText: qsTr("Checksum of the entered address is incorrect")
73-
}
74-
75-
StatusButton {
76-
anchors.verticalCenter: parent.verticalCenter
77-
borderColor: Theme.palette.primaryColor1
78-
size: StatusBaseButton.Size.Tiny
79-
text: qsTr("Paste")
80-
onClicked: {
81-
addressInput.text = ""
82-
addressInput.input.edit.paste()
83-
}
63+
warningMode: d.incorrectChecksum
64+
warningMessage: qsTr("Checksum of the entered address is incorrect")
65+
input.rightComponent: StatusButton {
66+
anchors.verticalCenter: parent.verticalCenter
67+
borderColor: Theme.palette.primaryColor1
68+
size: StatusBaseButton.Size.Tiny
69+
text: qsTr("Paste")
70+
onClicked: {
71+
addressInput.text = ""
72+
addressInput.input.edit.paste()
8473
}
8574
}
8675
validators: [

0 commit comments

Comments
 (0)