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

Multi: Create DEX main page #208

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

ukane-philemon
Copy link
Collaborator

@ukane-philemon ukane-philemon commented Oct 27, 2023

Closes #187

The new design(for the order form) in this PR has been agreed upon by @itswisdomagain, everything else stays the same.

Also, some notable UI elements have been omitted in this PR (e.g the order filter row).

DCRDEXscreen_3

@ukane-philemon ukane-philemon changed the title Create DEX main page Multi: Create DEX main page Oct 27, 2023
@ukane-philemon
Copy link
Collaborator Author

Uhmm, I’ll have to do a little cleanup on this PR in the morning and will remove the temp code that allows testing the whole flow. Until then, reviewers can run this PR to view the implemented UI.

ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
@dreacot
Copy link
Member

dreacot commented Oct 30, 2023

resolve conflicts

@dreacot
Copy link
Member

dreacot commented Oct 31, 2023

Also, some notable UI elements have been omitted in this PR (e.g the order filter row).

any particular reason for this?

Copy link
Member

@dreacot dreacot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. clicking the background should close the dropdowns

Screenshot from 2023-10-31 10-25-49

  1. the buy sell buttons might need a bit more left right padding and it seems there's a misalignment with the limit dropdown

Screenshot from 2023-10-31 10-28-02

Screenshot from 2023-10-31 10-28-42

  1. there seems to be a horizontal scroll for the open orders section on figma

Screenshot from 2023-10-31 10-30-38

ui/page/dcrdex/market.go Show resolved Hide resolved
@ukane-philemon
Copy link
Collaborator Author

there seems to be a horizontal scroll for the open orders section on figma

The columns fit correctly, maybe we can do without the horizontal scroll.

@ukane-philemon
Copy link
Collaborator Author

Also, some notable UI elements have been omitted in this PR (e.g the order filter row).

any particular reason for this?

Yes, I wanted to have something up and ready for review.

@dreacot
Copy link
Member

dreacot commented Nov 1, 2023

there seems to be a horizontal scroll for the open orders section on figma

The columns fit correctly, maybe we can do without the horizontal scroll.

i see a last column called status after the settled column
Screenshot from 2023-11-01 10-23-36

ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/segmented_control.go Outdated Show resolved Hide resolved
ui/modal/info_modal.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dcrdex_page.go Outdated Show resolved Hide resolved
@ukane-philemon ukane-philemon force-pushed the dex-main-screen branch 3 times, most recently from 93882ce to 333a7bd Compare November 2, 2023 18:17
@ukane-philemon
Copy link
Collaborator Author

clicking the background should close the dropdowns

Not fixed yet. I'm unable to fix the backdrop layout issue atm.

Copy link
Collaborator

@JustinBeBoy JustinBeBoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. @dreacot according figma we should use Market or Currency Pair ?
    image

  2. dropdown should close when click outside, I remember it was handled in previous versions

image

  1. we don't have slide on this ?
    image

ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dex_onboarding_page.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
@ukane-philemon
Copy link
Collaborator Author

ukane-philemon commented Nov 3, 2023

@dreacot according figma we should use Market or Currency Pair ?

Darn, I missed this.

dropdown should close when click outside, I remember it was handled in previous versions

Yes but it’s buggy so I created an issue to discuss other options.

we don't have slide on this ?

I’m leaving out the slide and some other elements on this page for a follow up PR.

@JustinBeBoy
Copy link
Collaborator

Some display functions are still missing but as @ukane-philemon said it can be improved later. Otherwise everything is fine with me

ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Show resolved Hide resolved
ui/cryptomaterial/segmented_control.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dcrdex_page.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dex_onboarding_page.go Show resolved Hide resolved
ui/page/governance/proposals_page.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
Comment on lines 275 to 292
return pg.Theme.List(pg.scrollContainer).Layout(gtx, 1, func(gtx C, index int) D {
return layout.Stack{}.Layout(gtx,
layout.Expanded(func(gtx C) D {
return layout.Inset{Top: 110}.Layout(gtx, func(gtx C) D {
return pg.pageContainer.Layout(gtx, len(pageContent), func(gtx C, i int) D {
return pageContent[i](gtx)
})
})
}),
layout.Stacked(pg.serverAndCurrencySelection()),
)
})
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Why wrap in a pg.Theme.List? It looks to me that this will produce a list inside a list; why not just one list holding everything?
  • If using a list inside a list is necessary, then instead of a stack layout with the first item having a margin top to accommodate the serverAndCurrencySelection widget, consider using a flex widget with the serverAndCurrencySelection wrapped in a layout.Rigid and the other widget wrapped in a layout.Expanded.

Summary: I think you just need one list holding pg.serverAndCurrencySelection, pg.priceAndVolumeDetail, pg.orderFormAndOrderBook, and pg.openOrdersAndHistory, with the proper spacing between them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pg.serverAndCurrencySelection stacks on top of the rest of the page when it's expanded according to the design and the whole page should be scrollable.

If we have one List holding everything, pg.serverAndCurrencySelection will push the rest of the pages leaving a massive gap when expanded.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send links to the design you're referring to.

Copy link
Collaborator Author

@ukane-philemon ukane-philemon Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-11-27 at 2 57 46 PM

ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
@ukane-philemon ukane-philemon force-pushed the dex-main-screen branch 2 times, most recently from a221580 to 123adcf Compare November 14, 2023 21:26
Copy link
Collaborator

@Sirmorrison Sirmorrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass.

ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dex_onboarding_page.go Outdated Show resolved Hide resolved
ui/page/dcrdex/dex_onboarding_page.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/transaction/transactions_page.go Outdated Show resolved Hide resolved
ui/page/transaction/transactions_page.go Outdated Show resolved Hide resolved
ui/page/governance/proposals_page.go Outdated Show resolved Hide resolved
ui/page/governance/consensus_page.go Outdated Show resolved Hide resolved
ui/page/governance/consensus_page.go Outdated Show resolved Hide resolved
ui/page/exchange/order_history_page.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
Comment on lines 291 to 292
func (pg DEXMarketPage) addServerDisplay() func(gtx C) D {
return func(gtx cryptomaterial.C) cryptomaterial.D {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it can be selectable. When it is selected, you start the process of adding a server. If that process doesn't complete, you clear the selection. If it completes, you select the newly added server. The UI won't show the "Add Server" selection for long, if at all. If it does show for a brief moment, it's understandable. The user was supposed to select a server and he selected the option to add a new server. It makes sense if that selection is displayed briefly as long as the user's request to add a new server is honored.

Copy link
Collaborator

@itswisdomagain itswisdomagain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to recommend moving the dropdown code changes to a new PR with screenshots for relevant portions of changed code, so we can clearly understand the intent of the code changes. I find the current code quite difficult to understand and that means they'd be difficult to maintain.

Alternatively, you can leave the code changes here but provide screenshots for different sections of changed code so the intention can be understood and some refactor or code comments can be suggested to improve the new code.

ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
ui/cryptomaterial/dropdown.go Outdated Show resolved Hide resolved
@ukane-philemon
Copy link
Collaborator Author

I want to recommend moving the dropdown code changes to a new PR with screenshots for relevant portions of changed code, so we can clearly understand the intent of the code changes

The modification to the dropdown component is only required by this page.

@ukane-philemon
Copy link
Collaborator Author

ukane-philemon commented Nov 27, 2023

The UI won't show the "Add Server" selection for long, if at all.

The "Add Server" button will remain part of the dropdown even if the user is already connected to a DEX server and I don't think we'd want to make it "dropdown" item. See: #208 (comment)

EDIT: I made the extraDisplay a dropdown item.

Copy link
Collaborator

@itswisdomagain itswisdomagain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much left holding this PR. Mostly the changes to the dropdown that are still unclear.

Comment on lines 35 to 53
group uint
closeAllDropdown func(group uint)
isDropdownGroupCollapsed func(group uint) bool
Width unit.Dp
linearLayout *LinearLayout
padding layout.Inset
shadow *Shadow
expandedViewAlignment layout.Direction

FontWeight font.Weight
BorderWidth unit.Dp
BorderColor *color.NRGBA
Background *color.NRGBA
SelectedItemIconColor *color.NRGBA
MakeSelectedItemHoverableAfterCollapse bool
SelectedItemDirectionAfterCollapse layout.Direction
StackBelowCollapsedLayout bool
ExpandedLayoutInset layout.Inset
collapsedLayoutInset layout.Inset
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still weary of the many new properties here, and I want to believe there is a simpler, easier-to-understand way to achieve what you want to achieve. Comment on each change and attach a screenshot of the UI that results from that change.

For example, what does StackBelowCollapsedLayout mean? I assume that CollapsedLayout mean the dropdown's layout when collapsed. What is being stacked below it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new interpretation of the dropdown when not open is collapsed. I’m trying to factor in the naming to help understand what it’ll look like.

As shown in the design, when expanded or open, the list of items should be stacked below the collapsed/closed view NOT on top of it as we’ve been doing, hence the naming. This new dropdown layout is just for the market page in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed most of these properties and added comments.

ui/page/components/components.go Outdated Show resolved Hide resolved
ui/page/components/components.go Outdated Show resolved Hide resolved
ui/page/components/utils.go Outdated Show resolved Hide resolved
Comment on lines 275 to 277
if pg.statusDropDown.Reversed() {
pg.statusDropDown.ExpandedLayoutInset.Right = values.MarginPadding55
} else {
pg.statusDropDown.ExpandedLayoutInset.Left = values.MarginPadding55
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to give Dropdown PaddingStart and PaddingEnd variables, then create the inset as needed in the dropdown layout code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropdown.ExpandedLayoutInset is updated and used on the fly cuz it has different padding on mobile and desktop.

ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
pg.orderTypesDropdown.FontWeight = font.SemiBold
pg.orderTypesDropdown.MakeSelectedItemHoverableAfterCollapse = false
pg.orderTypesDropdown.SelectedItemIconColor = &pg.Theme.Color.Primary
pg.orderTypesDropdown.ExpandedLayoutInset = layout.Inset{Top: values.MarginPadding30}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Share a screenshot highlighting how this top spacing is rendered.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ensures vertical alignment with the buySell btn since they are both stacked.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Share a screenshot highlighting how this top spacing is rendered.

By default, layout.Stack stacks its children on top of each other. The last child is always at the top but the designs show the last child (which is the expanded view) below the collapsed layout and in another case (i.e the order type dropdown) the expanded view is just halfway below the collapsed layout.

NOTE: This extra top (margin) when expanded, eats space from the last stack child, hence the need to account for that with len(d.items) * item default height (dp50) + d.ExpandedLayoutInset.Top

Screenshot 2023-11-28 at 9 08 58 PM

ui/page/dcrdex/market.go Outdated Show resolved Hide resolved
@ukane-philemon
Copy link
Collaborator Author

Not much left holding this PR. Mostly the changes to the dropdown that are still unclear.

Dropdown changes look huge cuz we are trying to reuse the same dropdown for the DEX market page which has an entirely different design and layout.

If it helps, I can create another component instead that will be used by only the DEX pages (onboarding and market page).

I can also create a smaller PR for the original Dropdown refactoring in this PR if they are still desirable.

@dreacot dreacot merged commit ab695e8 into crypto-power:master Dec 5, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DCRDEX]: implement the main dex UI
5 participants