Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <[email protected]>
  • Loading branch information
ukane-philemon committed Feb 1, 2024
1 parent cd4d8ee commit 3f8bc94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions ui/page/root/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (hp *HomePage) initDEX() {
dexPassEditor := hp.Theme.EditorPassword(new(widget.Editor), values.String(values.StrDexPassword))
dexPassEditor.Editor.SingleLine, dexPassEditor.IsRequired = true, true

showWalletToSyncModal := func() {
showWalletsToSyncModal := func() {
// DEX client has active orders or expired bonds, retrieve the
// wallets involved and ensure they are synced or syncing.
walletsToSyncMap := make(map[uint32]*struct{})
Expand All @@ -235,7 +235,7 @@ func (hp *HomePage) initDEX() {
walletsToSyncMap[bond.AssetID] = &struct{}{}
}

var walletsToSyncStr string
var namesOfWalletsToSync []string
var walletsToSync []sharedW.Asset
for assetID := range walletsToSyncMap {
walletID, err := dexClient.WalletIDForAsset(assetID)
Expand All @@ -259,7 +259,7 @@ func (hp *HomePage) initDEX() {
}

walletsToSync = append(walletsToSync, wallet)
walletsToSyncStr += "," + fmt.Sprintf("%s (%s)", wallet.GetWalletName(), wallet.GetAssetType())
namesOfWalletsToSync = append(namesOfWalletsToSync, fmt.Sprintf("%s (%s)", wallet.GetWalletName(), wallet.GetAssetType()))
}

if len(walletsToSync) == 0 {
Expand All @@ -268,7 +268,7 @@ func (hp *HomePage) initDEX() {

walletSyncRequestModal := modal.NewCustomModal(hp.Load).
Title(values.String(values.StrWalletsNeedToSync)).
Body(values.StringF(values.StrWalletsNeedToSyncMsg, strings.Trim(walletsToSyncStr, ","))).
Body(values.StringF(values.StrWalletsNeedToSyncMsg, strings.Join(namesOfWalletsToSync, ", "))).
SetNegativeButtonText(values.String(values.StrIWillSyncLater)).
SetPositiveButtonText(values.String(values.StrOkaySync)).
SetPositiveButtonCallback(func(isChecked bool, im *modal.InfoModal) bool {
Expand All @@ -287,7 +287,6 @@ func (hp *HomePage) initDEX() {
}
}

hp.ParentWindow().Reload()
return true
}).SetCancelable(false)
hp.ParentWindow().ShowModal(walletSyncRequestModal)
Expand All @@ -304,10 +303,9 @@ func (hp *HomePage) initDEX() {
}),
)
}).
SetNegativeButtonText(values.String(values.StrLoginLater)).
NegativeButtonStyle(hp.Theme.Color.OrangeRipple, hp.Theme.Color.Surface).
SetNegativeButtonText(values.String(values.StrIWillLoginLater)).
SetNegativeButtonCallback(func() {
showWalletToSyncModal()
showWalletsToSyncModal()
}).
SetPositiveButtonText(values.String(values.StrLogin)).
SetPositiveButtonCallback(func(isChecked bool, im *modal.InfoModal) bool {
Expand All @@ -318,7 +316,7 @@ func (hp *HomePage) initDEX() {
return false
}

showWalletToSyncModal()
showWalletsToSyncModal()
return true
}).
SetCancelable(false)
Expand Down
2 changes: 1 addition & 1 deletion ui/values/localizable/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,10 @@ const EN = `
"walletsNeedToSync" = "Wallet(s) need to sync"
"walletsNeedToSyncMsg" = "The following wallet(s) used by the DEX client needs to sync to settle active trade(s) or refund expired bonds: %s"
"iWillSyncLater" = "I'll sync later"
"iWillLoginLater" = "I'll login later"
"okaySync" = "Okay, sync"
"paste" = "Paste"
"backupDEXSeed" = "Backup DEX Seed"
"dexSeed" = "DEX Seed"
"optionalRestorationSeed" = "Restoration Seed (optional)"
"loginLater" = "I'll login later"
`
2 changes: 1 addition & 1 deletion ui/values/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,12 @@ const (
StrWalletsNeedToSync = "walletsNeedToSync"
StrWalletsNeedToSyncMsg = "walletsNeedToSyncMsg"
StrIWillSyncLater = "iWillSyncLater"
StrIWillLoginLater = "iWillLoginLater"
StrOkaySync = "okaySync"
StrPaste = "paste"
StrBackupDEXSeed = "backupDEXSeed"
StrDEXSeed = "dexSeed"
StrOptionalRestorationSeed = "optionalRestorationSeed"
StrLoginLater = "loginLater"

StrLoginDEXForActiveOrdersOrExpiredBonds = "loginDEXForActiveOrdersOrExpiredBonds"
)

0 comments on commit 3f8bc94

Please sign in to comment.