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 View All button in overview page to see the full list #711

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/page/info/info_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func NewInfoPage(l *load.Load, wallet sharedW.Asset, backup func(sharedW.Asset))
pg.viewAllStakeButton.Font.Weight = font.Medium
pg.viewAllStakeButton.TextSize = values.TextSize16
pg.viewAllStakeButton.Inset = layout.UniformInset(0)
pg.viewAllTxButton.HighlightColor = color.NRGBA{}
pg.viewAllStakeButton.HighlightColor = color.NRGBA{}

pg.mixerRedirectButton, pg.mixerInfoButton = components.SubpageHeaderButtons(l)
pg.mixerRedirectButton.Icon = pg.Theme.Icons.NavigationArrowForward
Expand Down
84 changes: 80 additions & 4 deletions ui/page/root/overview_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sort"
"strings"

"gioui.org/font"
"gioui.org/layout"
"gioui.org/op"
"gioui.org/unit"
Expand Down Expand Up @@ -56,6 +57,11 @@ type OverviewPage struct {
recentTransactions *cryptomaterial.ClickableList
recentStakes *cryptomaterial.ClickableList

viewAllRecentProposalListButton cryptomaterial.Button
viewAllRecentTradeListButton cryptomaterial.Button
viewAllRecentTxButton cryptomaterial.Button
viewAllRecentStakesButton cryptomaterial.Button

scrollContainer *widget.List
mobileMarketOverviewContainer *widget.List

Expand Down Expand Up @@ -167,6 +173,27 @@ func NewOverviewPage(l *load.Load, showNavigationFunc showNavigationFunc) *Overv
listInfoWallets: make([]*components.WalletSyncInfo, 0),
}

pg.viewAllRecentProposalListButton = pg.Theme.OutlineButton(values.String(values.StrViewAll))
pg.viewAllRecentProposalListButton.Font.Weight = font.Medium
pg.viewAllRecentProposalListButton.TextSize = values.TextSize16
pg.viewAllRecentProposalListButton.Inset = layout.UniformInset(0)
pg.viewAllRecentProposalListButton.HighlightColor = color.NRGBA{}
pg.viewAllRecentTradeListButton = pg.Theme.OutlineButton(values.String(values.StrViewAll))
pg.viewAllRecentTradeListButton.Font.Weight = font.Medium
pg.viewAllRecentTradeListButton.TextSize = values.TextSize16
pg.viewAllRecentTradeListButton.Inset = layout.UniformInset(0)
pg.viewAllRecentTradeListButton.HighlightColor = color.NRGBA{}
pg.viewAllRecentTxButton = pg.Theme.OutlineButton(values.String(values.StrViewAll))
pg.viewAllRecentTxButton.Font.Weight = font.Medium
pg.viewAllRecentTxButton.TextSize = values.TextSize16
pg.viewAllRecentTxButton.Inset = layout.UniformInset(0)
pg.viewAllRecentTxButton.HighlightColor = color.NRGBA{}
pg.viewAllRecentStakesButton = pg.Theme.OutlineButton(values.String(values.StrViewAll))
pg.viewAllRecentStakesButton.Font.Weight = font.Medium
pg.viewAllRecentStakesButton.TextSize = values.TextSize16
pg.viewAllRecentStakesButton.Inset = layout.UniformInset(0)
pg.viewAllRecentStakesButton.HighlightColor = color.NRGBA{}

pg.materialLoader = material.Loader(l.Theme.Base)
pg.mixerSlider.IndicatorBackgroundColor = values.TransparentColor(values.TransparentDeepBlue, 0.02)
pg.mixerSlider.SelectedIndicatorColor = pg.Theme.Color.DeepBlue
Expand Down Expand Up @@ -233,6 +260,19 @@ func (pg *OverviewPage) HandleUserInteractions(gtx C) {
go pg.AssetsManager.RateSource.Refresh(true)
}

if pg.viewAllRecentTxButton.Button.Clicked(gtx) {
pg.ParentNavigator().Display(transaction.NewTransactionsPage(pg.Load, nil))
}
if pg.viewAllRecentStakesButton.Button.Clicked(gtx) {
pg.ParentNavigator().Display(transaction.NewTransactionsPageWithType(pg.Load, 1, nil))
}
if pg.viewAllRecentTradeListButton.Button.Clicked(gtx) {
pg.ParentNavigator().Display(exchange.NewTradePage(pg.Load))
}
if pg.viewAllRecentProposalListButton.Button.Clicked(gtx) {
pg.ParentNavigator().Display(governance.NewGovernancePage(pg.Load, nil))
}

if clicked, selectedTxIndex := pg.recentTransactions.ItemClicked(); clicked {
tx, wal := pg.txAndWallet(pg.transactions[selectedTxIndex])
pg.ParentNavigator().Display(transaction.NewTransactionDetailsPage(pg.Load, wal, tx))
Expand Down Expand Up @@ -933,7 +973,7 @@ func (pg *OverviewPage) txStakingSection(gtx C) D {
}

func (pg *OverviewPage) recentTransactionsLayout(gtx C) D {
return pg.pageContentWrapper(gtx, values.String(values.StrRecentTransactions), nil, func(gtx C) D {
return pg.txContentWrapper(gtx, values.String(values.StrRecentTransactions), pg.viewAllRecentTxButton.Layout, func(gtx C) D {
if len(pg.transactions) == 0 {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
Expand Down Expand Up @@ -966,7 +1006,7 @@ func (pg *OverviewPage) recentTransactionsLayout(gtx C) D {
}

func (pg *OverviewPage) recentStakingsLayout(gtx C) D {
return pg.pageContentWrapper(gtx, values.String(values.StrStakingActivity), nil, func(gtx C) D {
return pg.txContentWrapper(gtx, values.String(values.StrStakingActivity), pg.viewAllRecentStakesButton.Layout, func(gtx C) D {
if len(pg.stakes) == 0 {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
Expand Down Expand Up @@ -999,7 +1039,7 @@ func (pg *OverviewPage) recentStakingsLayout(gtx C) D {
}

func (pg *OverviewPage) recentTrades(gtx C) D {
return pg.pageContentWrapper(gtx, values.String(values.StrRecentTrades), nil, func(gtx C) D {
return pg.txContentWrapper(gtx, values.String(values.StrRecentTrades), pg.viewAllRecentTradeListButton.Layout, func(gtx C) D {
if len(pg.orders) == 0 {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
Expand Down Expand Up @@ -1032,7 +1072,7 @@ func (pg *OverviewPage) recentTrades(gtx C) D {
}

func (pg *OverviewPage) recentProposal(gtx C) D {
return pg.pageContentWrapper(gtx, values.String(values.StrRecentProposals), nil, func(gtx C) D {
return pg.txContentWrapper(gtx, values.String(values.StrRecentProposals), pg.viewAllRecentProposalListButton.Layout, func(gtx C) D {
if len(pg.proposalItems) == 0 {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
Expand Down Expand Up @@ -1160,6 +1200,42 @@ func (pg *OverviewPage) pageContentWrapper(gtx C, sectionTitle string, altTitleL
)
}

func (pg *OverviewPage) txContentWrapper(gtx C, sectionTitle string, redirectBtn, body layout.Widget) D {
return layout.Inset{
Bottom: values.MarginPadding16,
}.Layout(gtx, func(gtx C) D {
return pg.Theme.Card().Layout(gtx, func(gtx C) D {
return layout.UniformInset(values.MarginPadding16).Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{
Bottom: values.MarginPadding16,
}.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
layout.Rigid(func(gtx C) D {
if sectionTitle == "" {
return D{}
}
txt := pg.Theme.Body1(sectionTitle)
txt.Font.Weight = font.SemiBold
return txt.Layout(gtx)
}),
layout.Flexed(1, func(gtx C) D {
if redirectBtn != nil {
return layout.E.Layout(gtx, redirectBtn)
}
return D{}
}),
)
})
}),
layout.Rigid(body),
)
})
})
})
}

func (pg *OverviewPage) centerLayout(gtx C, top, bottom unit.Dp, content layout.Widget) D {
return layout.Center.Layout(gtx, func(gtx C) D {
return layout.Inset{
Expand Down
38 changes: 38 additions & 0 deletions ui/page/transaction/transactions_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,44 @@ func NewTransactionsPage(l *load.Load, wallet sharedW.Asset) *TransactionsPage {
return pg
}

func NewTransactionsPageWithType(l *load.Load, selectedTab int, wallet sharedW.Asset) *TransactionsPage {
pg := &TransactionsPage{
Load: l,
GenericPageModal: app.NewGenericPageModal(TransactionsPageID),
separator: l.Theme.Separator(),
transactionList: l.Theme.NewClickableList(layout.Vertical),
txCategoryTab: l.Theme.SegmentedControl(txTabs, cryptomaterial.SegmentTypeGroup),
selectedWallet: wallet,
isShowTitle: true,
}
pg.selectedTxCategoryTab = selectedTab
pg.txCategoryTab.SetSelectedSegment(txTabs[selectedTab])
pg.searchEditor = l.Theme.SearchEditor(new(widget.Editor), values.String(values.StrSearch), l.Theme.Icons.SearchIcon)
pg.searchEditor.Editor.SingleLine = true
pg.searchEditor.TextSize = pg.ConvertTextSize(l.Theme.TextSize)
// init the wallet selector if no wallet was pre-selected
if pg.selectedWallet == nil {
pg.multiWalletLayout = true
pg.initWalletSelector()
pg.isShowTitle = false
}
pg.scroll = components.NewScroll(l, pageSize, pg.fetchTransactions)
pg.filterBtn = l.Theme.NewClickable(false)
pg.exportBtn = l.Theme.NewClickable(false)
pg.transactionList.Radius = cryptomaterial.Radius(14)
pg.transactionList.IsShadowEnabled = true
pg.orderDropDown = l.Theme.DropdownWithCustomPos([]cryptomaterial.DropDownItem{
{Text: values.String(values.StrNewest)},
{Text: values.String(values.StrOldest)},
}, values.ProposalDropdownGroup, 1, 0, false)
pg.orderDropDown.Width = values.MarginPadding100
pg.materialLoader = material.Loader(pg.Theme.Base)
pg.orderDropDown.CollapsedLayoutTextDirection = layout.E
settingCommonDropdown(pg.Theme, pg.orderDropDown)
pg.orderDropDown.SetConvertTextSize(pg.ConvertTextSize)
return pg
}

func (pg *TransactionsPage) DisableUniformTab() {
pg.txCategoryTab.DisableUniform(true)
}
Expand Down
Loading