Skip to content

Commit

Permalink
ui: remove dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
oluwandabira committed Apr 24, 2020
1 parent bb0da23 commit 7e3c419
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 78 deletions.
42 changes: 0 additions & 42 deletions ui/dialog.go

This file was deleted.

46 changes: 10 additions & 36 deletions ui/wallet_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import (

const PageWallet = "wallet"

// const (
// subDeleteWallet = iota
// subAddAcct
// subVerifyMessage
// )

type walletPage struct {
dialog *dialogWidgets
//subPage int
container, accountsList layout.List
renaming, deleting bool
rename, delete, beginRename, cancelRename, addAcct widget.Button
Expand All @@ -22,7 +28,6 @@ type walletPage struct {

func WalletPage(common pageCommon) layout.Widget {
page := &walletPage{
dialog: newDialogWidgets(common),
container: layout.List{
Axis: layout.Vertical,
},
Expand Down Expand Up @@ -119,12 +124,9 @@ func (page *walletPage) Layout(common pageCommon) {
page.deleteW.Layout(gtx, &page.delete)
},
}

page.dialog.LayoutIfActive(gtx, func() {
common.LayoutWithWallets(gtx, func() {
page.container.Layout(common.gtx, len(wdgs), func(i int) {
wdgs[i]()
})
common.LayoutWithWallets(gtx, func() {
page.container.Layout(common.gtx, len(wdgs), func(i int) {
wdgs[i]()
})
})
}
Expand All @@ -151,32 +153,4 @@ func (page *walletPage) Handle(common pageCommon) {
page.renaming = false
}
}

if page.delete.Clicked(gtx) {
page.dialog.SetDialog(page.dialog.deleteWallet(common))
}
}

func (wdgs *dialogWidgets) deleteWallet(common pageCommon) layout.Widget {
return func() {
gtx := common.gtx
common.theme.Surface(gtx, func() {
vertFlex.Layout(gtx,
rigid(func() {
wdgs.cancelW.Layout(gtx, &wdgs.cancel)
}),
rigid(func() {
wdgs.passwordW.Layout(gtx, &wdgs.password)
}),
rigid(func() {
wdgs.confirmW.Layout(gtx, &wdgs.confirm)
}),
)
})
if wdgs.confirm.Clicked(gtx) {
pass := wdgs.password.Text()
common.wallet.DeleteWallet(common.info.Wallets[*common.selectedWallet].ID, pass)
wdgs.active = false
}
}
}

0 comments on commit 7e3c419

Please sign in to comment.