From 660ce5f8bb102d0e6e074cab4e718aed2ad283f2 Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Wed, 23 Oct 2024 00:17:00 +0100 Subject: [PATCH] multi: Fix CEX page - Fix asset selector dropdown - Fix asset amount input - Fix order schedular modal and balance to maintain field - Fix order settings modal - Handle error from failed order schedules Signed-off-by: Philemon Ukane --- go.mod | 2 +- libwallet/assets/ltc/wallet.go | 1 - ui/page/components/account_dropdown.go | 4 + ui/page/exchange/create_order_page.go | 226 ++++++++++++---------- ui/page/exchange/order_scheduler_modal.go | 66 +++---- ui/page/exchange/order_settings_modal.go | 24 ++- ui/values/localizable/en.go | 2 + ui/values/strings.go | 2 + 8 files changed, 185 insertions(+), 142 deletions(-) diff --git a/go.mod b/go.mod index e40d3564f..57d2e7af5 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( github.com/decred/slog v1.2.0 github.com/decred/vspd/client/v3 v3.0.0 github.com/decred/vspd/types/v2 v2.1.0 + github.com/decred/vspd/types/v3 v3.0.0 github.com/dgraph-io/badger v1.6.2 github.com/gen2brain/beeep v0.0.0-20220402123239-6a3042f4b71a github.com/gomarkdown/markdown v0.0.0-20230922105210-14b16010c2ee @@ -126,7 +127,6 @@ require ( github.com/decred/dcrtime v0.0.0-20191018193024-8d8b4ef0458e // indirect github.com/decred/go-socks v1.1.0 // indirect github.com/decred/vspd/client/v4 v4.0.0 // indirect - github.com/decred/vspd/types/v3 v3.0.0 // indirect github.com/dgraph-io/ristretto v0.0.2 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect diff --git a/libwallet/assets/ltc/wallet.go b/libwallet/assets/ltc/wallet.go index 1809f8dd1..4c3f56885 100644 --- a/libwallet/assets/ltc/wallet.go +++ b/libwallet/assets/ltc/wallet.go @@ -316,7 +316,6 @@ func (asset *Asset) NeutrinoClient() *ChainService { func (asset *Asset) IsSynced() bool { asset.syncData.mu.RLock() defer asset.syncData.mu.RUnlock() - return asset.syncData.synced } diff --git a/ui/page/components/account_dropdown.go b/ui/page/components/account_dropdown.go index 51508d8f2..17313661e 100644 --- a/ui/page/components/account_dropdown.go +++ b/ui/page/components/account_dropdown.go @@ -179,6 +179,10 @@ func (d *AccountDropdown) Handle(gtx C) { func (d *AccountDropdown) Layout(gtx C, title string) D { return layout.Flex{Axis: layout.Vertical}.Layout(gtx, layout.Rigid(func(gtx C) D { + if title == "" { + return D{} + } + lbl := d.Theme.H6(title) lbl.TextSize = values.TextSizeTransform(d.IsMobileView(), values.TextSize16) lbl.Font.Weight = font.SemiBold diff --git a/ui/page/exchange/create_order_page.go b/ui/page/exchange/create_order_page.go index bc5b9fb91..ab2732d6f 100644 --- a/ui/page/exchange/create_order_page.go +++ b/ui/page/exchange/create_order_page.go @@ -87,11 +87,11 @@ type orderData struct { exchange api.IDExchange exchangeServer instantswap.ExchangeServer - sourceAccountSelector *components.AccountDropdown sourceWalletSelector *components.WalletDropdown + sourceAccountSelector *components.AccountDropdown - destinationAccountSelector *components.AccountDropdown destinationWalletSelector *components.WalletDropdown + destinationAccountSelector *components.AccountDropdown sourceWalletID int sourceAccountNumber int32 @@ -310,57 +310,6 @@ func (pg *CreateOrderPage) OnNavigatedFrom() { pg.stopNtfnListeners() } -func (pg *CreateOrderPage) handleEditorEvents(gtx C) { - for { - event, ok := pg.fromAmountEditor.Edit.Editor.Update(gtx) - if !ok { - break - } - - if gtx.Source.Focused(pg.fromAmountEditor.Edit.Editor) { - switch event.(type) { - case widget.ChangeEvent: - pg.setToAmount(pg.fromAmountEditor.Edit.Editor.Text()) - } - } - } - - for { - event, ok := pg.toAmountEditor.Edit.Editor.Update(gtx) - if !ok { - break - } - - if gtx.Source.Focused(pg.toAmountEditor.Edit.Editor) { - switch event.(type) { - case widget.ChangeEvent: - if pg.inputsNotEmpty(pg.toAmountEditor.Edit.Editor) { - f, err := strconv.ParseFloat(pg.toAmountEditor.Edit.Editor.Text(), 32) - if err != nil { - // empty usd input - pg.fromAmountEditor.Edit.Editor.SetText("") - pg.amountErrorText = values.String(values.StrInvalidAmount) - pg.fromAmountEditor.Edit.LineColor = pg.Theme.Color.Danger - pg.toAmountEditor.Edit.LineColor = pg.Theme.Color.Danger - return - } - pg.amountErrorText = "" - if pg.exchangeRate != -1 { - value := f * pg.exchangeRate - v := strconv.FormatFloat(value, 'f', 8, 64) - pg.amountErrorText = "" - pg.fromAmountEditor.Edit.LineColor = pg.Theme.Color.Gray2 - pg.toAmountEditor.Edit.LineColor = pg.Theme.Color.Gray2 - pg.fromAmountEditor.Edit.Editor.SetText(v) - } - } else { - pg.fromAmountEditor.Edit.Editor.SetText("") - } - } - } - } -} - func (pg *CreateOrderPage) HandleUserInteractions(gtx C) { pg.createOrderBtn.SetEnabled(pg.canCreateOrder()) @@ -451,10 +400,6 @@ func (pg *CreateOrderPage) HandleUserInteractions(gtx C) { pg.destinationAddress = destinationAddress orderSchedulerModal := newOrderSchedulerModalModal(pg.Load, pg.orderData). - OnOrderSchedulerStarted(func() { - infoModal := modal.NewSuccessModal(pg.Load, values.String(values.StrSchedulerRunning), modal.DefaultClickFunc()) - pg.ParentWindow().ShowModal(infoModal) - }). OnCancel(func() { // needed to satisfy the modal instance pg.scheduler.SetChecked(false) }) @@ -479,6 +424,53 @@ func (pg *CreateOrderPage) HandleUserInteractions(gtx C) { pg.walletCreationSuccessFunc(false, assetToCreate) }, assetToCreate)) } + + if pg.sourceWalletSelector != nil { + pg.sourceWalletSelector.Handle(gtx) + } + + if pg.sourceAccountSelector != nil { + pg.sourceAccountSelector.Handle(gtx) + } + + if pg.destinationWalletSelector != nil { + pg.destinationWalletSelector.Handle(gtx) + } + + if pg.destinationAccountSelector != nil { + pg.destinationAccountSelector.Handle(gtx) + } + + for pg.fromAmountEditor.Edit.Changed() && pg.fromAmountEditor.Edit.IsFocused() { + pg.setToAmount(pg.fromAmountEditor.Edit.Editor.Text()) + } + + for pg.toAmountEditor.Edit.Changed() && pg.toAmountEditor.Edit.IsFocused() { + amountTxt := pg.toAmountEditor.Edit.Editor.Text() + if amountTxt == "" { + pg.fromAmountEditor.Edit.Editor.SetText("") + continue + } + + f, err := strconv.ParseFloat(amountTxt, 32) + if err != nil { + // empty usd input + pg.fromAmountEditor.Edit.Editor.SetText("") + pg.amountErrorText = values.String(values.StrInvalidAmount) + pg.fromAmountEditor.Edit.LineColor = pg.Theme.Color.Danger + pg.toAmountEditor.Edit.LineColor = pg.Theme.Color.Danger + return + } + pg.amountErrorText = "" + if pg.exchangeRate != -1 { + value := f * pg.exchangeRate + v := strconv.FormatFloat(value, 'f', 8, 64) + pg.amountErrorText = "" + pg.fromAmountEditor.Edit.LineColor = pg.Theme.Color.Gray2 + pg.toAmountEditor.Edit.LineColor = pg.Theme.Color.Gray2 + pg.fromAmountEditor.Edit.Editor.SetText(v) + } + } } func (pg *CreateOrderPage) setToAmount(amount string) { @@ -574,6 +566,9 @@ func (pg *CreateOrderPage) updateAssetSelection(selectedFromAsset []libutils.Ass pg.fromCurrency = selectedAsset pg.fromAmountEditor.AssetTypeSelector.SetSelectedAssetType(pg.fromCurrency) + if ok := pg.resetSourceWallet(nil); !ok { + return selectedAsset, false + } // If the to and from asset are the same, select a new to asset. if selectedAsset == pg.toCurrency { @@ -581,11 +576,10 @@ func (pg *CreateOrderPage) updateAssetSelection(selectedFromAsset []libutils.Ass allAssets := pg.AssetsManager.AllAssetTypes() for _, asset := range allAssets { if asset != selectedAsset { - // Select the first available asset as the new to asset. - pg.toCurrency = asset pg.toAmountEditor.AssetTypeSelector.SetSelectedAssetType(pg.toCurrency) + pg.resetDestinationWallet(nil) break } @@ -598,6 +592,9 @@ func (pg *CreateOrderPage) updateAssetSelection(selectedFromAsset []libutils.Ass pg.toCurrency = selectedAsset pg.toAmountEditor.AssetTypeSelector.SetSelectedAssetType(pg.toCurrency) + if ok := pg.resetDestinationWallet(nil); !ok { + return selectedAsset, false + } // If the to and from asset are the same, select a new from asset. if selectedAsset == pg.fromCurrency { @@ -606,11 +603,10 @@ func (pg *CreateOrderPage) updateAssetSelection(selectedFromAsset []libutils.Ass allAssets := pg.AssetsManager.AllAssetTypes() for _, asset := range allAssets { if asset != selectedAsset { - // Select the first available asset as the new from asset. - pg.fromCurrency = asset pg.fromAmountEditor.AssetTypeSelector.SetSelectedAssetType(pg.fromCurrency) + pg.resetSourceWallet(nil) break } @@ -689,7 +685,6 @@ func (pg *CreateOrderPage) isMultipleAssetTypeWalletAvailable() bool { } func (pg *CreateOrderPage) Layout(gtx C) D { - pg.handleEditorEvents(gtx) if pg.isFirstVisit { return pg.Theme.List(pg.splashPageContainer).Layout(gtx, 1, func(gtx C, _ int) D { return pg.splashPage(gtx) @@ -762,7 +757,6 @@ func (pg *CreateOrderPage) Layout(gtx C) D { return layout.Stack{}.Layout(gtx, layout.Expanded(pg.layoutMobile), overlay) } return layout.Stack{}.Layout(gtx, layout.Expanded(pg.layoutDesktop), overlay) - }) }) }) @@ -920,7 +914,7 @@ func (pg *CreateOrderPage) layoutDesktop(gtx C) D { if pg.fetchingRate { gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding16) gtx.Constraints.Min.X = gtx.Constraints.Max.X - return pg.materialLoader.Layout(gtx) + return layout.Inset{Top: values.MarginPadding5}.Layout(gtx, pg.materialLoader.Layout) } txt := pg.Theme.Label(textSize14, pg.exchangeRateInfo) txt.Color = pg.Theme.Color.Gray1 @@ -941,7 +935,7 @@ func (pg *CreateOrderPage) layoutDesktop(gtx C) D { if pg.fetchingRate { gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding16) gtx.Constraints.Min.X = gtx.Constraints.Max.X - return pg.materialLoader.Layout(gtx) + return layout.Inset{Top: values.MarginPadding5}.Layout(gtx, pg.materialLoader.Layout) } fromCur := strings.ToUpper(pg.fromCurrency.String()) @@ -1042,7 +1036,7 @@ func (pg *CreateOrderPage) layoutDesktop(gtx C) D { if pg.AssetsManager.InstantSwap.IsSyncing() { gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding8) gtx.Constraints.Min.X = gtx.Constraints.Max.X - return layout.Inset{Bottom: values.MarginPadding1}.Layout(gtx, pg.materialLoader.Layout) + return layout.Inset{Top: values.MarginPadding2, Bottom: values.MarginPadding1}.Layout(gtx, pg.materialLoader.Layout) } return pg.Theme.NewIcon(pg.Theme.Icons.NavigationRefresh).LayoutTransform(gtx, pg.IsMobileView(), values.MarginPadding18) }) @@ -1203,7 +1197,7 @@ func (pg *CreateOrderPage) showConfirmOrderModal() { confirmOrderModal := newConfirmOrderModal(pg.Load, pg.orderData). OnOrderCompleted(func(order *instantswap.Order) { - pg.scroll.FetchScrollData(false, pg.ParentWindow(), false) + pg.scroll.FetchScrollData(false, pg.ParentWindow(), true) successModal := modal.NewCustomModal(pg.Load). Title(values.String(values.StrOrderSubmitted)). SetCancelable(true). @@ -1320,64 +1314,38 @@ func (pg *CreateOrderPage) loadOrderConfig() { if noSourceWallet { isConfigUpdateRequired = true } - pg.sourceWalletSelector = components. - NewWalletDropdown(pg.Load, pg.fromCurrency). - Setup(sourceWallet) - sourceWallet = pg.sourceWalletSelector.SelectedWallet() - // Source account picker - pg.sourceAccountSelector = components.NewAccountDropdown(pg.Load). - AccountValidator(func(account *sharedW.Account) bool { - return account.Number != load.MaxInt32 && !sourceWallet.IsWatchingOnlyWallet() - }). - Setup(pg.sourceWalletSelector.SelectedWallet()) + pg.resetSourceWallet(sourceWallet) if sourceAccount != -1 { - if _, err := sourceWallet.GetAccount(sourceAccount); err != nil { + if _, err := pg.sourceWalletSelector.SelectedWallet().GetAccount(sourceAccount); err != nil { log.Error(err) } } if pg.sourceAccountSelector.SelectedAccount() == nil { isConfigUpdateRequired = true - _ = pg.sourceAccountSelector.Setup(sourceWallet) + _ = pg.sourceAccountSelector.Setup(pg.sourceWalletSelector.SelectedWallet()) } - pg.sourceWalletSelector.SetChangedCallback(func(selectedWallet sharedW.Asset) { - _ = pg.sourceAccountSelector.Setup(selectedWallet) - }) - // Destination wallet picker if noDestinationWallet { isConfigUpdateRequired = true } - pg.destinationWalletSelector = components. - NewWalletDropdown(pg.Load, pg.toCurrency). - Setup(destinationWallet) - destinationWallet = pg.destinationWalletSelector.SelectedWallet() - // Destination account picker - pg.destinationAccountSelector = components.NewAccountDropdown(pg.Load). - AccountValidator(func(account *sharedW.Account) bool { - return account.Number != load.MaxInt32 - }). - Setup(pg.destinationWalletSelector.SelectedWallet()) + pg.resetDestinationWallet(destinationWallet) if destinationAccount != -1 { - if _, err := destinationWallet.GetAccount(destinationAccount); err != nil { + if _, err := pg.destinationWalletSelector.SelectedWallet().GetAccount(destinationAccount); err != nil { log.Error(err) } } if pg.destinationAccountSelector.SelectedAccount() == nil { isConfigUpdateRequired = true - _ = pg.destinationAccountSelector.Setup(destinationWallet) + _ = pg.destinationAccountSelector.Setup(pg.destinationWalletSelector.SelectedWallet()) } - pg.destinationWalletSelector.SetChangedCallback(func(selectedWallet sharedW.Asset) { - _ = pg.destinationAccountSelector.Setup(selectedWallet) - }) - if isConfigUpdateRequired { pg.updateExchangeConfig() } @@ -1386,6 +1354,62 @@ func (pg *CreateOrderPage) loadOrderConfig() { pg.toAmountEditor.AssetTypeSelector.SetSelectedAssetType(pg.toCurrency) } +func (pg *CreateOrderPage) resetSourceWallet(sourceWallet sharedW.Asset) bool { + if sourceWallet == nil { + // Try to fetch a wallet that match from currency. + wallets := pg.AssetsManager.AssetWallets(pg.fromCurrency) + if len(wallets) == 0 { + return false + } + + sourceWallet = wallets[0] + } + + pg.sourceWalletSelector = components. + NewWalletDropdown(pg.Load, pg.fromCurrency). + SetChangedCallback(func(a sharedW.Asset) { + _ = pg.sourceAccountSelector.Setup(a) + }). + Setup(sourceWallet) + + // Source account picker + pg.sourceAccountSelector = components.NewAccountDropdown(pg.Load). + AccountValidator(func(account *sharedW.Account) bool { + return account.Number != load.MaxInt32 && !sourceWallet.IsWatchingOnlyWallet() + }). + Setup(pg.sourceWalletSelector.SelectedWallet()) + + return true +} + +func (pg *CreateOrderPage) resetDestinationWallet(destinationWallet sharedW.Asset) bool { + if destinationWallet == nil { + // Try to fetch a wallet that match from currency. + wallets := pg.AssetsManager.AssetWallets(pg.toCurrency) + if len(wallets) == 0 { + return false + } + + destinationWallet = wallets[0] + } + + pg.destinationWalletSelector = components. + NewWalletDropdown(pg.Load, pg.toCurrency). + SetChangedCallback(func(selectedWallet sharedW.Asset) { + _ = pg.destinationAccountSelector.Setup(selectedWallet) + }). + Setup(destinationWallet) + + // Destination account picker + pg.destinationAccountSelector = components.NewAccountDropdown(pg.Load). + AccountValidator(func(account *sharedW.Account) bool { + return account.Number != load.MaxInt32 + }). + Setup(pg.destinationWalletSelector.SelectedWallet()) + + return true +} + // updateExchangeConfig Updates the newly created or modified exchange // configuration. func (pg *CreateOrderPage) updateExchangeConfig() { @@ -1408,11 +1432,11 @@ func (pg *CreateOrderPage) updateExchangeConfig() { func (pg *CreateOrderPage) listenForNotifications() { orderNotificationListener := &instantswap.OrderNotificationListener{ OnExchangeOrdersSynced: func() { - pg.scroll.FetchScrollData(false, pg.ParentWindow(), false) + pg.scroll.FetchScrollData(false, pg.ParentWindow(), true) pg.ParentWindow().Reload() }, OnOrderCreated: func(_ *instantswap.Order) { - pg.scroll.FetchScrollData(false, pg.ParentWindow(), false) + pg.scroll.FetchScrollData(false, pg.ParentWindow(), true) pg.ParentWindow().Reload() }, OnOrderSchedulerStarted: func() { diff --git a/ui/page/exchange/order_scheduler_modal.go b/ui/page/exchange/order_scheduler_modal.go index 387f9033e..c7574672d 100644 --- a/ui/page/exchange/order_scheduler_modal.go +++ b/ui/page/exchange/order_scheduler_modal.go @@ -17,7 +17,7 @@ import ( libutils "github.com/crypto-power/cryptopower/libwallet/utils" "github.com/crypto-power/cryptopower/ui/cryptomaterial" "github.com/crypto-power/cryptopower/ui/load" - "github.com/crypto-power/cryptopower/ui/page/components" + "github.com/crypto-power/cryptopower/ui/modal" "github.com/crypto-power/cryptopower/ui/values" api "github.com/crypto-power/instantswap/instantswap" ) @@ -31,8 +31,7 @@ type orderSchedulerModal struct { pageContainer *widget.List - orderSchedulerStarted func() - onCancel func() + onCancel func() cancelBtn cryptomaterial.Button startBtn cryptomaterial.Button @@ -123,11 +122,6 @@ func newOrderSchedulerModalModal(l *load.Load, data *orderData) *orderSchedulerM return osm } -func (osm *orderSchedulerModal) OnOrderSchedulerStarted(orderSchedulerStarted func()) *orderSchedulerModal { - osm.orderSchedulerStarted = orderSchedulerStarted - return osm -} - func (osm *orderSchedulerModal) OnCancel(cancel func()) *orderSchedulerModal { osm.onCancel = cancel return osm @@ -171,32 +165,24 @@ func (osm *orderSchedulerModal) Handle(gtx C) { }() } - for { - event, ok := osm.balanceToMaintain.Editor.Update(gtx) - if !ok { - break + for osm.balanceToMaintain.Changed() && osm.balanceToMaintain.IsFocused() { + balanceToMaintain := osm.balanceToMaintain.Editor.Text() + if balanceToMaintain == "" { + continue } - if gtx.Source.Focused(osm.balanceToMaintain.Editor) { - switch event.(type) { - case widget.ChangeEvent: - if components.InputsNotEmpty(osm.balanceToMaintain.Editor) { - f, err := strconv.ParseFloat(osm.balanceToMaintain.Editor.Text(), 32) - if err != nil { - osm.balanceToMaintainErrorText = values.String(values.StrInvalidAmount) - osm.balanceToMaintain.LineColor = osm.Theme.Color.Danger - return - } - - if f >= osm.sourceAccountSelector.SelectedAccount().Balance.Spendable.ToCoin() || f < 0 { - osm.balanceToMaintainErrorText = values.String(values.StrInvalidAmount) - osm.balanceToMaintain.LineColor = osm.Theme.Color.Danger - return - } - osm.balanceToMaintainErrorText = "" - - } - } + osm.balanceToMaintainErrorText = "" + f, err := strconv.ParseFloat(osm.balanceToMaintain.Editor.Text(), 32) + if err != nil { + osm.balanceToMaintainErrorText = values.String(values.StrInvalidAmount) + osm.balanceToMaintain.LineColor = osm.Theme.Color.Danger + return + } + + if f >= osm.sourceAccountSelector.SelectedAccount().Balance.Spendable.ToCoin() || f < 0 { + osm.balanceToMaintainErrorText = values.String(values.StrInvalidAmount) + osm.balanceToMaintain.LineColor = osm.Theme.Color.Danger + return } } } @@ -279,7 +265,7 @@ func (osm *orderSchedulerModal) Layout(gtx layout.Context) D { if osm.fetchingRate { gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding16) gtx.Constraints.Min.X = gtx.Constraints.Max.X - return osm.materialLoader.Layout(gtx) + return layout.Inset{Top: values.MarginPadding5}.Layout(gtx, osm.materialLoader.Layout) } fromCur := osm.fromCurrency.String() @@ -499,12 +485,22 @@ func (osm *orderSchedulerModal) startOrderScheduler() { SpendingPassphrase: osm.passwordEditor.Editor.Text(), } + successModal := modal.NewSuccessModal(osm.Load, values.String(values.StrSchedulerRunning), modal.DefaultClickFunc()) go func() { - _ = osm.AssetsManager.StartScheduler(context.Background(), params) + err = osm.AssetsManager.StartScheduler(context.Background(), params) + if err != nil { + // Dismiss the success modal if still displayed before showing + // the error modal. + successModal.Dismiss() + + errModal := modal.NewErrorModal(osm.Load, values.String(values.StrOrderScheduler), modal.DefaultClickFunc()). + Body(values.StringF(values.StrUnexpectedErrorMsgFmt, err.Error())) + osm.ParentWindow().ShowModal(errModal) + } }() osm.Dismiss() - osm.orderSchedulerStarted() + osm.ParentWindow().ShowModal(successModal) }() } diff --git a/ui/page/exchange/order_settings_modal.go b/ui/page/exchange/order_settings_modal.go index 1c6c63e43..cc7839649 100644 --- a/ui/page/exchange/order_settings_modal.go +++ b/ui/page/exchange/order_settings_modal.go @@ -201,6 +201,22 @@ func (osm *orderSettingsModal) Handle(gtx C) { if osm.feeRateSelector.SaveRate.Clicked(gtx) { osm.feeRateSelector.OnEditRateClicked(osm.sourceWalletSelector.SelectedWallet()) } + + if osm.sourceWalletSelector != nil { + osm.sourceWalletSelector.Handle(gtx) + } + + if osm.sourceAccountSelector != nil { + osm.sourceAccountSelector.Handle(gtx) + } + + if osm.destinationWalletSelector != nil { + osm.destinationWalletSelector.Handle(gtx) + } + + if osm.destinationAccountSelector != nil { + osm.destinationAccountSelector.Handle(gtx) + } } func (osm *orderSettingsModal) handleCopyEvent(gtx C) { @@ -300,11 +316,11 @@ func (osm *orderSettingsModal) Layout(gtx layout.Context) D { return layout.Inset{ Bottom: values.MarginPadding16, }.Layout(gtx, func(gtx C) D { - return osm.sourceWalletSelector.Layout(gtx, values.StrSource) + return osm.sourceWalletSelector.Layout(gtx, "") }) }), layout.Rigid(func(gtx C) D { - return osm.sourceAccountSelector.Layout(gtx, values.StrSource) + return osm.sourceAccountSelector.Layout(gtx, "") }), layout.Rigid(func(gtx C) D { if !osm.sourceWalletSelector.SelectedWallet().IsSynced() { @@ -347,14 +363,14 @@ func (osm *orderSettingsModal) Layout(gtx layout.Context) D { return layout.Inset{ Bottom: values.MarginPadding16, }.Layout(gtx, func(gtx C) D { - return osm.destinationWalletSelector.Layout(gtx, values.StrSource) + return osm.destinationWalletSelector.Layout(gtx, "") }) }), layout.Rigid(func(gtx C) D { return layout.Inset{ Bottom: values.MarginPadding16, }.Layout(gtx, func(gtx C) D { - return osm.destinationAccountSelector.Layout(gtx, values.StrSource) + return osm.destinationAccountSelector.Layout(gtx, "") }) }), layout.Rigid(func(gtx C) D { diff --git a/ui/values/localizable/en.go b/ui/values/localizable/en.go index 00617b1fc..87f819e7a 100644 --- a/ui/values/localizable/en.go +++ b/ui/values/localizable/en.go @@ -956,4 +956,6 @@ const EN = ` "privacy" = "Privacy" "removeRecipient" = "Remove recipient" "removeRecipientWarning" = "Are you sure you want to proceed with removing the recipient?" +"unexpectedErrorMsgFmt" = "Something unexpected happened: %s" +"unexpectedError" = "Unexpected Error" ` diff --git a/ui/values/strings.go b/ui/values/strings.go index 2a520e3ae..ffe2f863c 100644 --- a/ui/values/strings.go +++ b/ui/values/strings.go @@ -1065,4 +1065,6 @@ const ( StrPrivacy = "privacy" StrRemoveRecipient = "removeRecipient" StrRemoveRecipientWarning = "removeRecipientWarning" + StrUnexpectedErrorMsgFmt = "unexpectedErrorMsgFmt" + StrUnexpectedError = "unexpectedError" )