-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
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. |
f89d9a9
to
b916364
Compare
resolve conflicts |
d7e60d5
to
7672c39
Compare
any particular reason for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The columns fit correctly, maybe we can do without the horizontal scroll. |
Yes, I wanted to have something up and ready for review. |
93882ce
to
333a7bd
Compare
Not fixed yet. I'm unable to fix the backdrop layout issue atm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
@dreacot according figma we should use Market or Currency Pair ?
-
dropdown should close when click outside, I remember it was handled in previous versions
Darn, I missed this.
Yes but it’s buggy so I created an issue to discuss other options.
I’m leaving out the slide and some other elements on this page for a follow up PR. |
Some display functions are still missing but as @ukane-philemon said it can be improved later. Otherwise everything is fine with me |
0e68441
to
9936a46
Compare
ui/page/dcrdex/market.go
Outdated
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()), | ||
) | ||
}) | ||
}) |
There was a problem hiding this comment.
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 theserverAndCurrencySelection
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a221580
to
123adcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass.
123adcf
to
4f4d3ba
Compare
715b7fc
to
0f5868a
Compare
ui/page/dcrdex/market.go
Outdated
func (pg DEXMarketPage) addServerDisplay() func(gtx C) D { | ||
return func(gtx cryptomaterial.C) cryptomaterial.D { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
The modification to the dropdown component is only required by this page. |
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 |
0f5868a
to
b06849e
Compare
There was a problem hiding this 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.
ui/cryptomaterial/dropdown.go
Outdated
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/governance/proposals_page.go
Outdated
if pg.statusDropDown.Reversed() { | ||
pg.statusDropDown.ExpandedLayoutInset.Right = values.MarginPadding55 | ||
} else { | ||
pg.statusDropDown.ExpandedLayoutInset.Left = values.MarginPadding55 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
pg.orderTypesDropdown.FontWeight = font.SemiBold | ||
pg.orderTypesDropdown.MakeSelectedItemHoverableAfterCollapse = false | ||
pg.orderTypesDropdown.SelectedItemIconColor = &pg.Theme.Color.Primary | ||
pg.orderTypesDropdown.ExpandedLayoutInset = layout.Inset{Top: values.MarginPadding30} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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](https://private-user-images.githubusercontent.com/57448127/286393457-b2967df7-f62d-4442-9498-d172509df46f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODEzNTgsIm5iZiI6MTczOTI4MTA1OCwicGF0aCI6Ii81NzQ0ODEyNy8yODYzOTM0NTctYjI5NjdkZjctZjYyZC00NDQyLTk0OTgtZDE3MjUwOWRmNDZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDEzMzczOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYyMTFiMzU2MDhmOTZkNWU2MWEwY2VhMzdhZWJlYWFmZjg3N2E3NDkwYTMzZTUwY2UzM2E2YWFhYTQxYjkwOWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.GU-BoJLeAGQBXnIG7tyESdakYSpjXNakylNQHB1s7mE)
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. |
713af53
to
768f347
Compare
768f347
to
b7c1446
Compare
Signed-off-by: Philemon Ukane <[email protected]>
Signed-off-by: Philemon Ukane <[email protected]>
b7c1446
to
06e0586
Compare
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).