-
Notifications
You must be signed in to change notification settings - Fork 71
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
Tooltip for deactivated AddProposalButton
(#3909)
#3916
base: dev
Are you sure you want to change the base?
Tooltip for deactivated AddProposalButton
(#3909)
#3916
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: Oleksandr Korniienko <[email protected]>
before
after
|
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.
|
||
const tooltipProps = useMemo(() => { | ||
if (!api?.isConnected) return { tooltipText: 'Connecting to api' } | ||
if (!api?.isConnected || availableSlots > 0) { |
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.
if (!api?.isConnected || availableSlots > 0) { | |
if (availableSlots > 0) { |
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 logic is that until connection is established and when there are slots the default tooltip is shown. Without the first condition a user would see the error "Max active proposals limit reached" during loading.
<Tooltip placement="bottom-end" {...tooltipProps}> | ||
<TransactionButton style="primary" size="medium" onClick={addProposalModal} disabled={!availableSlots}> |
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.
TransactionButton
also renders a Tooltip when a transaction is pending. As a result in case of a pending transaction, this will result in the Tooltip beeing nested (I'm not sure what will actually be shown). To avoid this situation, TransactionButton
could accept TooltipContentProp
:
- If these are defined ⇒ display the Tooltip
- If a transaction is pending ⇒ display the: "Please wait until the current transaction is over" regardless of whether a different tooltip text was passed.
WDYT ?
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.
This makes sense.
#3909
Wrap
TransactionButton
in a tooltip when disabled. Theplacement
prop seemed necessary to better orient the arrow.Note ideally we don't want to hardcode constants, however there is no quick solution with useProposalConstants because it is designed to query
proposalsCodex
notproposalsEngine.activeProposalCount
and can't be easily extended without changing its return type.Waiting for the go-ahead.