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