Skip to content

Commit

Permalink
fix page refresh issue
Browse files Browse the repository at this point in the history
* reset proposal details description layout when back btn is clicked
  • Loading branch information
Sirmorrison committed Apr 14, 2021
1 parent bd048cd commit ebb7070
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions ui/proposal_details_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ func (pg *proposalDetails) Layout(gtx C, common pageCommon) D {
title: truncateString(proposal.Name, 40),
back: func() {
common.changePage(PageProposals)
pg.descriptionList.Position.First, pg.descriptionList.Position.Offset = 0, 0
},
body: func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
Expand Down
10 changes: 4 additions & 6 deletions ui/proposals_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func (p proposalNotificationListeners) OnProposalVoteFinished(proposal *dcrlibwa

func (p proposalNotificationListeners) OnProposalsSynced() {
p.page.isSynced = true
p.page.refreshWindow()
}

type proposalItem struct {
Expand Down Expand Up @@ -89,7 +88,6 @@ type proposalsPage struct {
state int
hasRegisteredListeners bool
isSynced bool
refreshWindow func()
updatedIcon *widget.Icon
updatedLabel decredmaterial.Label
syncButton *widget.Clickable
Expand Down Expand Up @@ -120,7 +118,6 @@ func (win *Window) ProposalsPage(common pageCommon) layout.Widget {
legendIcon: common.icons.imageBrightness1,
infoIcon: common.icons.actionInfo,
selectedProposal: &win.selectedProposal,
refreshWindow: common.refreshWindow,
updatedIcon: common.icons.navigationCheck,
updatedLabel: common.theme.Body2("Updated"),
syncButton: new(widget.Clickable),
Expand Down Expand Up @@ -169,7 +166,7 @@ func (pg *proposalsPage) Handle(common pageCommon) {

for pg.syncButton.Clicked() {
pg.wallet.SyncProposals()
pg.refreshWindow()
common.refreshPage()
}
}

Expand Down Expand Up @@ -544,8 +541,9 @@ func (pg *proposalsPage) layoutStartSyncSection(gtx C) D {
})
}

func (pg *proposalsPage) layoutSyncSection(gtx C) D {
func (pg *proposalsPage) layoutSyncSection(gtx C, common pageCommon) D {
if pg.isSynced {
common.refreshPage()
return pg.layoutIsSyncedSection(gtx)
} else if pg.wallet.IsSyncingProposals() {
return pg.layoutIsSyncingSection(gtx)
Expand Down Expand Up @@ -586,7 +584,7 @@ func (pg *proposalsPage) Layout(gtx C, common pageCommon) D {
}
return layout.UniformInset(m).Layout(gtx, func(gtx C) D {
return layout.Center.Layout(gtx, func(gtx C) D {
return pg.layoutSyncSection(gtx)
return pg.layoutSyncSection(gtx, common)
})
})
})
Expand Down

0 comments on commit ebb7070

Please sign in to comment.