Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add main page #459

Merged
merged 8 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Expand Up @@ -43,4 +43,4 @@ jobs:
--enable staticcheck --enable gosimple \
--enable unconvert --enable ineffassign \
--enable structcheck --enable goimports \
--enable unparam --enable golint
--enable unparam
10 changes: 4 additions & 6 deletions ui/about_page.go
Expand Up @@ -11,7 +11,7 @@ import (
const PageAbout = "About"

type aboutPage struct {
common pageCommon
common *pageCommon
theme *decredmaterial.Theme
card decredmaterial.Card
container *layout.List
Expand All @@ -27,7 +27,7 @@ type aboutPage struct {
chevronRightIcon *widget.Icon
}

func (win *Window) AboutPage(common pageCommon) Page {
func AboutPage(common *pageCommon) Page {
pg := &aboutPage{
common: common,
theme: common.theme,
Expand All @@ -38,7 +38,7 @@ func (win *Window) AboutPage(common pageCommon) Page {
buildDate: common.theme.Body1("Build date"),
buildDateValue: common.theme.Body1("2020-09-10"),
network: common.theme.Body1("Network"),
networkValue: common.theme.Body1(win.wallet.Net),
networkValue: common.theme.Body1(common.wallet.Net),
license: common.theme.Body1("License"),
chevronRightIcon: common.icons.chevronRight,
}
Expand Down Expand Up @@ -67,9 +67,7 @@ func (pg *aboutPage) Layout(gtx layout.Context) layout.Dimensions {
return pg.common.SubPageLayout(gtx, page)
}

return pg.common.Layout(gtx, func(gtx C) D {
return pg.common.UniformPadding(gtx, body)
})
return pg.common.UniformPadding(gtx, body)
}

func (pg *aboutPage) layoutRows(gtx layout.Context) layout.Dimensions {
Expand Down
14 changes: 6 additions & 8 deletions ui/account_details_page.go
Expand Up @@ -16,7 +16,7 @@ import (
const PageAccountDetails = "AccountDetails"

type acctDetailsPage struct {
common pageCommon
common *pageCommon
wallet *wallet.Wallet
current wallet.InfoShort
theme *decredmaterial.Theme
Expand All @@ -27,14 +27,14 @@ type acctDetailsPage struct {
errorReceiver chan error
}

func (win *Window) AcctDetailsPage(common pageCommon) Page {
func AcctDetailsPage(common *pageCommon) Page {
pg := &acctDetailsPage{
acctDetailsPageContainer: layout.List{
Axis: layout.Vertical,
},
common: common,
wallet: common.wallet,
acctInfo: &win.walletAccount,
acctInfo: common.walletAccount,
theme: common.theme,
backButton: common.theme.PlainIconButton(new(widget.Clickable), common.icons.navigationArrowBack),
editAccount: new(widget.Clickable),
Expand All @@ -52,7 +52,7 @@ func (pg *acctDetailsPage) Layout(gtx layout.Context) layout.Dimensions {

widgets := []func(gtx C) D{
func(gtx C) D {
return pg.accountBalanceLayout(gtx, &common)
return pg.accountBalanceLayout(gtx, common)
},
func(gtx C) D {
m := values.MarginPadding10
Expand Down Expand Up @@ -102,9 +102,7 @@ func (pg *acctDetailsPage) Layout(gtx layout.Context) layout.Dimensions {
}
return common.SubPageLayout(gtx, page)
}
return common.Layout(gtx, func(gtx C) D {
return common.UniformPadding(gtx, body)
})
return pg.common.UniformPadding(gtx, body)
}

func (pg *acctDetailsPage) accountBalanceLayout(gtx layout.Context, common *pageCommon) layout.Dimensions {
Expand Down Expand Up @@ -248,7 +246,7 @@ func (pg *acctDetailsPage) pageSections(gtx layout.Context, body layout.Widget)
return layout.Inset{Left: m, Right: m, Top: mtb, Bottom: mtb}.Layout(gtx, body)
}

func (pg *acctDetailsPage) Handler(gtx layout.Context, common pageCommon) {
func (pg *acctDetailsPage) Handler(gtx layout.Context, common *pageCommon) {
if pg.backButton.Button.Clicked() {
common.changePage(PageWallet)
}
Expand Down