Skip to content

Commit

Permalink
minor alignment clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirmorrison committed Sep 23, 2023
1 parent cdc757c commit 693dd45
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 32 deletions.
Binary file modified ui/assets/decredicons/btcBkgImage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ui/cryptomaterial/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (img *Image) LayoutSize(gtx C, size unit.Dp) D {
}

func (img *Image) LayoutSize2(gtx C, width, height unit.Dp) D {
dst := image.NewRGBA(image.Rectangle{Max: image.Point{X: int(width * 2), Y: int(height * 2)}})
dst := image.NewRGBA(image.Rectangle{Max: image.Point{X: int(width), Y: int(height * 2)}})
draw.BiLinear.Scale(dst, dst.Bounds(), img, img.Bounds(), draw.Src, nil)

i := widget.Image{Src: paint.NewImageOp(dst)}
Expand Down
4 changes: 2 additions & 2 deletions ui/cryptomaterial/slider.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ func (s *Slider) handleClickEvent() {
if s.selected == l {
s.selected = 0
} else {
s.selected += 1
s.selected++
}
}

if s.prevButton.Clicked() {
if s.selected == 0 {
s.selected = l
} else {
s.selected -= 1
s.selected--
}
}
}
51 changes: 22 additions & 29 deletions ui/page/root/overview_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/crypto-power/cryptopower/app"
"github.com/crypto-power/cryptopower/libwallet"

// sharedW "github.com/crypto-power/cryptopower/libwallet/assets/wallet"
// libutils "github.com/crypto-power/cryptopower/libwallet/utils"
"github.com/crypto-power/cryptopower/libwallet/instantswap"
"github.com/crypto-power/cryptopower/ui/cryptomaterial"
"github.com/crypto-power/cryptopower/ui/load"
Expand Down Expand Up @@ -45,7 +43,6 @@ type OverviewPage struct {

proposalItems []*components.ProposalItem
orders []*instantswap.Order
// transactionList *cryptomaterial.ClickableList

card cryptomaterial.Card
}
Expand Down Expand Up @@ -178,7 +175,7 @@ func (pg *OverviewPage) layoutDesktop(gtx layout.Context) layout.Dimensions {
})
}

func (pg *OverviewPage) layoutMobile(gtx C) D {
func (pg *OverviewPage) layoutMobile(_ C) D {
return D{}
}

Expand All @@ -189,8 +186,8 @@ func (pg *OverviewPage) sliderLayout(gtx C) D {
Orientation: layout.Horizontal,
Direction: layout.Center,
}.Layout(gtx,
layout.Rigid(pg.supportedCoinSliderLayout),
layout.Rigid(func(gtx C) D {
layout.Flexed(.5, pg.supportedCoinSliderLayout),
layout.Flexed(.5, func(gtx C) D {
return layout.Inset{Left: values.MarginPadding10}.Layout(gtx, pg.mixerSliderLayout)
}),
)
Expand Down Expand Up @@ -234,17 +231,10 @@ func (pg *OverviewPage) supportedCoinSliderLayout(gtx C) D {
return pg.coinSlider.Layout(gtx, sliderWidget)
}

func (pg *OverviewPage) mixerSliderLayout(gtx C) D {
sliderWidget := []layout.Widget{
pg.mixerLayout,
}
return pg.mixerSlider.Layout(gtx, sliderWidget)
}

func (pg *OverviewPage) supportedCoinItemLayout(gtx C, item supportedCoinSliderItem) D {
return layout.Stack{}.Layout(gtx,
layout.Stacked(func(gtx C) D {
return item.BackgroundImage.LayoutSize2(gtx, values.MarginPadding368, values.MarginPadding221)
return item.BackgroundImage.LayoutSize2(gtx, unit.Dp(gtx.Constraints.Max.X), values.MarginPadding221)
}),
layout.Expanded(func(gtx C) D {
col := pg.Theme.Color.InvText
Expand Down Expand Up @@ -291,10 +281,17 @@ func (pg *OverviewPage) supportedCoinItemLayout(gtx C, item supportedCoinSliderI
)
}

func (pg *OverviewPage) mixerSliderLayout(gtx C) D {
sliderWidget := []layout.Widget{
pg.mixerLayout,
}
return pg.mixerSlider.Layout(gtx, sliderWidget)
}

func (pg *OverviewPage) mixerLayout(gtx C) D {
r := 8
return cryptomaterial.LinearLayout{
Width: gtx.Dp(values.MarginPadding368),
Width: gtx.Constraints.Max.X,
Height: gtx.Dp(values.MarginPadding221),
Orientation: layout.Vertical,
Padding: layout.UniformInset(values.MarginPadding15),
Expand Down Expand Up @@ -550,16 +547,21 @@ func (pg *OverviewPage) txStakingSection(gtx C) D {
Orientation: layout.Horizontal,
Direction: layout.Center,
}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return pg.pageContentWrapper(gtx, "Recent Proposals", func(gtx C) D {
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
return pg.Theme.Body1("No recent transaction").Layout(gtx)
layout.Flexed(.5, func(gtx C) D {
return layout.Inset{Right: values.MarginPadding10}.Layout(gtx, func(gtx C) D {
return pg.pageContentWrapper(gtx, "Recent Transactions", func(gtx C) D {
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.Theme.Body1("No recent transaction").Layout(gtx)
})
})
})
}),
layout.Rigid(func(gtx C) D {
layout.Flexed(.5, func(gtx C) D {
return pg.pageContentWrapper(gtx, "Staking Activity", func(gtx C) D {
return pg.centerLayout(gtx, values.MarginPadding10, values.MarginPadding10, func(gtx C) D {
gtx.Constraints.Min.X = gtx.Constraints.Max.X

return pg.Theme.Body1("No recent Staking Activity").Layout(gtx)
})
})
Expand Down Expand Up @@ -593,15 +595,6 @@ func (pg *OverviewPage) recentTrades(gtx C) D {
})
}

// func (pg *TransactionsPage) loadTransactions(offset, pageSize int32) (interface{}, int, bool, error) {
// wal := pg.WL.SelectedWallet.Wallet
// tempTxs, err := wal.GetTransactionsRaw(0, 3, libutils.TxFilterAll, true)
// if err != nil {
// err = fmt.Errorf("Error loading transactions: %v", err)
// }
// return tempTxs, len(tempTxs), isReset, err
// }

func (pg *OverviewPage) recentProposal(gtx C) D {
return pg.pageContentWrapper(gtx, "Recent Proposals", func(gtx C) D {
if len(pg.proposalItems) == 0 {
Expand Down

0 comments on commit 693dd45

Please sign in to comment.