Skip to content

Commit

Permalink
remove toggle, update USD text, rebase PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirmorrison committed Oct 2, 2023
1 parent 5ba8b63 commit c4511a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ui/cryptomaterial/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (img *Image) LayoutSize(gtx C, size unit.Dp) D {
}

func (img *Image) LayoutSize2(gtx C, width, height unit.Dp) D {
dst := image.NewRGBA(image.Rectangle{Max: image.Point{X: int(width), Y: int(height * 2)}})
dst := image.NewRGBA(image.Rectangle{Max: image.Point{X: int(width * 2), Y: int(height * 2)}})
draw.BiLinear.Scale(dst, dst.Bounds(), img, img.Bounds(), draw.Src, nil)

i := widget.Image{Src: paint.NewImageOp(dst)}
Expand Down
2 changes: 1 addition & 1 deletion ui/modal/info_modal_layouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func sourceModalInfo(th *cryptomaterial.Theme) []layout.Widget {
}

func totalValueInfo(th *cryptomaterial.Theme) []layout.Widget {
text := values.StringF(values.StrTotalValueMsg, `<br />`)
text := values.StringF(values.StrTotalValueMsg, `<br />`, `<br />`)
return []layout.Widget{
renderers.RenderHTML(text, th).Layout,
}
Expand Down
16 changes: 5 additions & 11 deletions ui/page/root/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type HomePage struct {
ctxCancel context.CancelFunc
drawerNav components.NavDrawer

totalUSDValueSwitch *cryptomaterial.Switch
navigationTab *cryptomaterial.Tab
appLevelSettingsButton *cryptomaterial.Clickable
appNotificationButton *cryptomaterial.Clickable
Expand Down Expand Up @@ -66,8 +65,6 @@ func NewHomePage(l *load.Load) *HomePage {
_, hp.infoButton = components.SubpageHeaderButtons(l)
hp.infoButton.Size = values.MarginPadding15

hp.totalUSDValueSwitch = hp.Theme.Switch()

hp.drawerNav = components.NavDrawer{
Load: hp.Load,
CurrentPage: hp.CurrentPageID(),
Expand Down Expand Up @@ -110,8 +107,6 @@ func (hp *HomePage) OnNavigatedTo() {
hp.Display(NewOverviewPage(hp.Load))
}

hp.totalUSDValueSwitch.SetChecked(hp.WL.AssetsManager.IsTotalAssetBalanceOn())

hp.CurrentPage().OnNavigatedTo()
}

Expand Down Expand Up @@ -194,10 +189,6 @@ func (hp *HomePage) HandleUserInteractions() {
// TODO use assetManager config settings
hp.isBalanceHidden = !hp.isBalanceHidden
}

if hp.totalUSDValueSwitch.Changed() {
hp.WL.AssetsManager.SetTotalAssetBalanceState(hp.totalUSDValueSwitch.IsChecked())
}
}

// KeysToHandle returns an expression that describes a set of key combinations
Expand All @@ -224,6 +215,10 @@ func (hp *HomePage) HandleKeyPress(evt *key.Event) {
}
}

func (hp *HomePage) OnCurrencyChanged() {
go hp.CalculateAssetsUSDBalance()
}

// OnNavigatedFrom is called when the page is about to be removed from
// the displayed window. This method should ideally be used to disable
// features that are irrelevant when the page is NOT displayed.
Expand Down Expand Up @@ -332,7 +327,7 @@ func (hp *HomePage) totalBalanceLayout(gtx C) D {
}

func (hp *HomePage) balanceLayout(gtx C) D {
if hp.totalUSDValueSwitch.IsChecked() && hp.totalBalanceUSD != "" {
if components.IsFetchExchangeRateAPIAllowed(hp.WL) && hp.totalBalanceUSD != "" {
return layout.Flex{}.Layout(gtx,
layout.Rigid(hp.LayoutUSDBalance),
layout.Rigid(func(gtx C) D {
Expand Down Expand Up @@ -379,7 +374,6 @@ func (hp *HomePage) totalBalanceTextAndIconButtonLayout(gtx C) D {
Right: values.MarginPadding10,
}.Layout(gtx, hp.infoButton.Layout)
}),
layout.Rigid(hp.totalUSDValueSwitch.Layout),
)
}

Expand Down
4 changes: 2 additions & 2 deletions ui/values/localizable/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ const EN = `
"totalBalance" = "Total Balance"
"totalCost" = "Total cost"
"totalVotes" = "Total votes: %6.0d"
"totalValue" = "Total Value"
"totalValueMsg" = "Total value is the valuation of all the wallets you have at the USD market price.%v Your total balance may not be up to date due to some wallets not being fully synced. To obtain a more accurate balance, please proceed to the specific wallet page"
"totalValue" = "Total USD Value"
"totalValueMsg" = "Total value is the valuation of all the wallets you have at the USD market price.%v Your total balance may not be up to date due to some wallets not being fully synced. To obtain a more accurate balance, please proceed to the specific wallet page. %v You can enable/disable rate fetching from the app settings."
"totalVotesReverse" = "%d Total votes"
"transactionDetails" = "Transaction details"
"transactionId" = "Transaction ID"
Expand Down

0 comments on commit c4511a8

Please sign in to comment.