Skip to content

Commit

Permalink
update layout and logic for send page
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Dec 29, 2023
1 parent c2ef4b1 commit 86cf69a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 10 additions & 2 deletions ui/cryptomaterial/dropdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type DropDown struct {
dropdownIcon *widget.Icon
navigationIcon *widget.Icon
clickable *Clickable
maxTextLeng int

group uint
closeAllDropdown func(group uint)
Expand Down Expand Up @@ -223,8 +224,15 @@ func (d *DropDown) Reversed() bool {
return d.revs
}

func (d *DropDown) SetMaxTextLeng(leng int) {
d.maxTextLeng = leng
}

func (d *DropDown) Layout(gtx C) D {
d.handleEvents()
if d.maxTextLeng == 0 {
d.maxTextLeng = maxDropdownItemTextLen
}

if d.MakeCollapsedLayoutVisibleWhenExpanded {
return d.collapsedAndExpandedLayout(gtx)
Expand Down Expand Up @@ -351,8 +359,8 @@ func (d *DropDown) itemLayout(gtx C, index int, clickable *Clickable, item *Drop

return bodyLayout.Layout2(gtx, func(gtx C) D {
lbl := d.theme.Body2(item.Text)
if !d.expanded && len(item.Text) > maxDropdownItemTextLen {
lbl.Text = item.Text[:maxDropdownItemTextLen-3 /* subtract space for the ellipsis */] + "..."
if !d.expanded && len(item.Text) > d.maxTextLeng {
lbl.Text = item.Text[:d.maxTextLeng-3 /* subtract space for the ellipsis */] + "..."
}
lbl.Font.Weight = d.FontWeight
lbl.TextSize = d.getTextSize(values.TextSize14)
Expand Down
1 change: 1 addition & 0 deletions ui/page/components/fee_rate_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func (fs *FeeRateSelector) UpdatedFeeRate(selectedWallet sharedW.Asset) {
fs.fetchedRatesDropDown.ExpandedLayoutInset = layout.Inset{Top: values.MarginPadding35}
fs.fetchedRatesDropDown.MakeCollapsedLayoutVisibleWhenExpanded = true
fs.fetchedRatesDropDown.Background = &fs.Theme.Color.Gray4
fs.fetchedRatesDropDown.SetMaxTextLeng(30)
}

// OnEditRateCliked is called when the edit feerate button is clicked.
Expand Down
6 changes: 5 additions & 1 deletion ui/page/send/manual_coin_selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ func (pg *ManualCoinSelectionPage) HandleUserInteractions() {
}

if pg.fromCoinSelection.Clicked() {
pg.ParentNavigator().Display(pg.sendPage)
if pg.modalLayout != nil {
pg.modalLayout.Dismiss()
} else {
pg.ParentNavigator().Display(pg.sendPage)
}
}

if pg.clearButton.Clicked() {
Expand Down

0 comments on commit 86cf69a

Please sign in to comment.