Skip to content

Commit

Permalink
add governance tab after trade tab and remove voting tab from dcr wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanvians committed Oct 10, 2023
1 parent afa1608 commit e17c1bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 8 additions & 2 deletions ui/page/governance/governance_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
"github.com/crypto-power/cryptopower/ui/values"
)

const GovernancePageID = "Governance"
const (
GovernancePageID = "Governance"
)

type Page struct {
*load.Load
Expand Down Expand Up @@ -52,6 +54,10 @@ func NewGovernancePage(l *load.Load) *Page {
return pg
}

func (pg *Page) ID() string {
return GovernancePageID
}

// OnNavigatedTo is called when the page is about to be displayed and
// may be used to initialize page features that are only relevant when
// the page is displayed.
Expand All @@ -65,7 +71,7 @@ func (pg *Page) OnNavigatedTo() {
}

func (pg *Page) isGovernanceFeatureEnabled() bool {
return pg.WL.SelectedWallet.Wallet.ReadBoolConfigValueForKey(sharedW.FetchProposalConfigKey, false)
return true
}

func (pg *Page) isProposalsAPIAllowed() bool {
Expand Down
6 changes: 5 additions & 1 deletion ui/page/root/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type HomePage struct {
appLevelSettingsButton *cryptomaterial.Clickable
appNotificationButton *cryptomaterial.Clickable
hideBalanceButton *cryptomaterial.Clickable
checkBox cryptomaterial.CheckBoxStyle
infoButton cryptomaterial.IconButton // TOD0: use *cryptomaterial.Clickable

bottomNavigationBar components.BottomNavigationBar
Expand All @@ -60,6 +59,7 @@ var navigationTabTitles = []string{
values.String(values.StrOverview),
values.String(values.StrWallets),
values.String(values.StrTrade),
values.String(values.StrGovernance),
}

func NewHomePage(l *load.Load) *HomePage {
Expand Down Expand Up @@ -194,6 +194,8 @@ func (hp *HomePage) HandleUserInteractions() {
pg = NewWalletSelectorPage(hp.Load)
case values.String(values.StrTrade):
pg = NewTradePage(hp.Load)
case values.String(values.StrGovernance):
pg = governance.NewGovernancePage(hp.Load)
}

hp.Display(pg)
Expand All @@ -205,6 +207,8 @@ func (hp *HomePage) HandleUserInteractions() {
hp.navigationTab.SetSelectedTab(values.String(values.StrWallets))
} else if hp.CurrentPageID() == TradePageID && hp.navigationTab.SelectedTab() != values.String(values.StrTrade) {
hp.navigationTab.SetSelectedTab(values.String(values.StrTrade))
} else if hp.CurrentPageID() == governance.GovernancePageID && hp.navigationTab.SelectedTab() != values.String(values.StrGovernance) {
hp.navigationTab.SetSelectedTab(values.String(values.StrGovernance))
}

for _, item := range hp.drawerNav.AppNavBarItems {
Expand Down
10 changes: 0 additions & 10 deletions ui/page/root/main_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/crypto-power/cryptopower/ui/load"
"github.com/crypto-power/cryptopower/ui/modal"
"github.com/crypto-power/cryptopower/ui/page/components"
"github.com/crypto-power/cryptopower/ui/page/governance"
"github.com/crypto-power/cryptopower/ui/page/info"
"github.com/crypto-power/cryptopower/ui/page/privacy"
"github.com/crypto-power/cryptopower/ui/page/seedbackup"
Expand Down Expand Up @@ -160,13 +159,6 @@ func (mp *MainPage) initNavItems() {
Title: values.String(values.StrStaking),
PageID: staking.OverviewPageID,
},
{
Clickable: mp.Theme.NewClickable(true),
Image: mp.Theme.Icons.GovernanceActiveIcon,
ImageInactive: mp.Theme.Icons.GovernanceInactiveIcon,
Title: values.String(values.StrVoting),
PageID: governance.GovernancePageID,
},
{
Clickable: mp.Theme.NewClickable(true),
Image: mp.Theme.Icons.MoreIcon,
Expand Down Expand Up @@ -459,8 +451,6 @@ func (mp *MainPage) HandleUserInteractions() {
}
case staking.OverviewPageID:
pg = staking.NewStakingPage(mp.Load)
case governance.GovernancePageID:
pg = governance.NewGovernancePage(mp.Load)
case WalletSettingsPageID:
pg = NewWalletSettingsPage(mp.Load)
}
Expand Down

0 comments on commit e17c1bd

Please sign in to comment.