Skip to content

Commit

Permalink
Update receive page
Browse files Browse the repository at this point in the history
  • Loading branch information
song50119 committed Mar 27, 2021
1 parent 62d6af2 commit ad4cbee
Show file tree
Hide file tree
Showing 4 changed files with 496 additions and 463 deletions.
17 changes: 17 additions & 0 deletions ui/modal_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const SecurityToolsInfoTemplate = "SecurityToolsInfo"
const ImportWatchOnlyWalletTemplate = "ImportWatchOnlyWallet"
const UnlockWalletRestoreTemplate = "UnlockWalletRestoreTemplate"
const SendInfoTemplate = "SendInfo"
const ReceiveInfoTemplate = "ReceiveInfo"

type ModalTemplate struct {
th *decredmaterial.Theme
Expand Down Expand Up @@ -264,6 +265,16 @@ func (m *ModalTemplate) sendInfo() []func(gtx C) D {
}
}

func (m *ModalTemplate) receiveInfo() []func(gtx C) D {
return []func(gtx C) D{
func(gtx C) D {
text := m.th.Body1("Each time you receive a payment, a new address is generated to protect your privacy.")
text.Color = m.th.Color.Gray
return text.Layout(gtx)
},
}
}

func (m *ModalTemplate) privacyInfo() []func(gtx C) D {
return []func(gtx C) D{
func(gtx C) D {
Expand Down Expand Up @@ -596,6 +607,12 @@ func (m *ModalTemplate) handle(th *decredmaterial.Theme, load *modalLoad) (templ
}
template = m.sendInfo()
return
case ReceiveInfoTemplate:
if m.cancel.Button.Clicked() {
load.cancel.(func())()
}
template = m.receiveInfo()
return
default:
return
}
Expand Down
50 changes: 0 additions & 50 deletions ui/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"gioui.org/unit"
"gioui.org/widget"

"github.com/decred/dcrd/dcrutil"
"github.com/planetdecred/godcr/ui/decredmaterial"
"github.com/planetdecred/godcr/ui/values"
"github.com/planetdecred/godcr/wallet"
Expand Down Expand Up @@ -656,55 +655,6 @@ func (page pageCommon) LayoutWithAccounts(gtx layout.Context, body layout.Widget
})
}

func (page pageCommon) SelectedAccountLayout(gtx layout.Context) layout.Dimensions {
current := page.info.Wallets[*page.selectedWallet]
account := page.info.Wallets[*page.selectedWallet].Accounts[*page.selectedAccount]

selectedDetails := func(gtx C) D {
return layout.UniformInset(values.MarginPadding10).Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Flex{}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding5}.Layout(gtx, func(gtx C) D {
return page.theme.H6(account.Name).Layout(gtx)
})
}),
layout.Rigid(func(gtx C) D {
return layout.Inset{Left: values.MarginPadding20}.Layout(gtx, func(gtx C) D {
return page.theme.H6(dcrutil.Amount(account.SpendableBalance).String()).Layout(gtx)
})
}),
)
}),
layout.Rigid(func(gtx C) D {
return layout.Flex{}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding5}.Layout(gtx, func(gtx C) D {
return page.theme.Body2(current.Name).Layout(gtx)
})
}),
layout.Rigid(func(gtx C) D {
return layout.Inset{Left: values.MarginPadding20}.Layout(gtx, func(gtx C) D {
return page.theme.Body2(current.Balance).Layout(gtx)
})
}),
)
}),
)
})
}

card := page.theme.Card()
card.Radius = decredmaterial.CornerRadius{
NE: 0,
NW: 0,
SE: 0,
SW: 0,
}
return card.Layout(gtx, selectedDetails)
}

func (page pageCommon) UniformPadding(gtx layout.Context, body layout.Widget) layout.Dimensions {
return layout.UniformInset(values.MarginPadding24).Layout(gtx, body)
}
Expand Down
Loading

0 comments on commit ad4cbee

Please sign in to comment.