Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fees popover in transaction modal #317
Fees popover in transaction modal #317
Changes from 4 commits
9284bfc
3d9e425
eb29f17
79bd638
568ad88
37e98bc
538d473
d47b534
745a997
c16b8fc
a97a29a
cccb0f6
2f1dcad
07ab446
fd65c55
a5bf66b
5a5764d
4c642eb
3ed9a2e
5d814a5
0de3011
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 wonder if this is the best solution for sure. What if for the next list element we want to apply another custom label? This could create a mess. What do you think about allowing label customization? I'm thinking of something like this:
Then we can pass the following label:
What do you think about this solution?
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.
Your solution is good in the case when we need a more complex, unique UI. My solution can be easier to implement for other cases using sublabel and popover just passing appropriate, simple props, instead of passing:
every time when we need a sublabel or popover.
Let's leave it as it is, and if the need arises, we will consider extending this solution.
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.
hm @r-czajkowski I'm curious what you think about 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.
Also, If we stay with your approach I think we should also rename the
popover
to something more generic. Currently, we pass the component that is a tooltip which can be confusing.acre/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/StakeDetails.tsx
Line 40 in 79bd638
Additionally, the icon is not centered relative to the text.
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 was broken after the last change(https://github.com/thesis/acre/pull/317/files/eb29f17f128688667324dbb90a289b6841e8c397#r1549007304), it has already been fixed - 37e98bc
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.
At this moment looks like this component is only used in
ActiveStakingStep
. So I think we can even keep it inshared/TransactionModal/ActiveStakinStep/FeesTransacionItem.tsx
.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.
TransactionDetails/index.ts
New component
we can try to extract this part:
since we repeat it in
AmountItem
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.
Thanks for the feedback @r-czajkowski ! I am also a fan of generic components, hence my suggestion to use optional props such as
sublabel
/tooltip
inTransactionDetailsItem
. Thanks to this, we can support similar solutions in the future, not only for fees and this fees tooltip:This solution allow us to freely and easily pass any sublabel or tooltip according to design without the risk of any regression which gives us a generic approach.
The sublabel can be any text and the tooltip can be any tooltip component we want to show.
Correct me if I understood wrong, but creating the
StakingFeesTransactionDetailsItem
component according to your proposal is not generic, but rather very restrictive only for this Fee case:Maybe let's combine our suggestions and create an independent component like
TransactionDetailsTooltipItem
, which will accept thetooltip
andsublabel
as a prop and at the same time the current component TransactionDetailsItem will remain unchanged. What do you think?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.
My point is that we should avoid props like
tooltip
,sublabel
because we may end up with meaningless props likerightLabel
orleftSublabel
orsubValue
. So I propose to split the main component into smaller components that allow as to build more specific components.Yes
StakingFeesTransactionDetailsItem
is not generic it is a specific component for a given case and has only one proplabel
instead oftooltip
,sublabel
etc.This is only my suggestion and I prefer this style for creating components but ofc we can use this approach. I'm just not convinced about the flexibility of this approach. E.g. if the designer adds another element to the designs will we add another prop?
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.
Okey dokey, I restored the transaction details component to its original shape and created a similar one for fees:
c16b8fc