feat(@wallet/NetworkSelector): Single selection updates

When it is single selection:
- Close combobox when an option is selected.
- Don't allow uncheck.
This commit is contained in:
Noelia 2023-03-13 11:33:44 +01:00 committed by Noelia
parent e8b1dad80f
commit ebbb22f514
1 changed files with 10 additions and 4 deletions

View File

@ -115,8 +115,10 @@ Popup {
onClicked: {
if(root.multiSelection)
toggleModelIsActive()
else
radioButton.toggle()
else {
// Don't allow uncheck
if(!radioButton.checked) radioButton.toggle()
}
}
function toggleModelIsActive() {
@ -142,8 +144,12 @@ Popup {
size: StatusRadioButton.Size.Large
ButtonGroup.group: radioBtnGroup
checked: model.index === 0
onCheckedChanged: if(checked) root.singleNetworkSelected(model.chainId, model.chainName, model.iconUrl)
onToggled: if(checked) root.singleNetworkSelected(model.chainId, model.chainName, model.iconUrl)
onCheckedChanged: {
if(checked && !root.multiSelection) {
root.singleNetworkSelected(model.chainId, model.chainName, model.iconUrl)
close()
}
}
}
]
}