-
Notifications
You must be signed in to change notification settings - Fork 212
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
Tokens: Fix hidden you pill on sidebar #1124
Changes from 2 commits
9ddac9c
ca94d1d
cf91af0
9e7cd31
1b0bc12
1fb2106
11d8f98
035ed9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { formatBalance, stakesPercentages } from '../utils' | |
import { addressesEqual } from '../web3-utils' | ||
import LocalIdentityBadge from './LocalIdentityBadge/LocalIdentityBadge' | ||
import You from './You' | ||
import { useIdentity } from './IdentityManager/IdentityManager' | ||
|
||
const DISTRIBUTION_ITEMS_MAX = 7 | ||
|
||
|
@@ -110,13 +111,17 @@ function InfoBoxes({ | |
items={stakes} | ||
renderLegendItem={({ item: account }) => { | ||
const isCurrentUser = addressesEqual(account, connectedAccount) | ||
const [label, showLocalIdentityModal] = useIdentity(account) | ||
|
||
return ( | ||
<div> | ||
<LocalIdentityBadge | ||
entity={account} | ||
connectedAccount={isCurrentUser} | ||
customLabel={!Boolean(label) && isCurrentUser && 'YOU'} | ||
labelStyle={(!Boolean(label) && isCurrentUser ? `color: ${theme.tagIndicatorContent};` : '')} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering—maybe we should move this logic into the We already provide a prop via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didnt wanted to do it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes... I was thinking it could be a special mode of the Could we move to building these props as an object outside? I think it'll be a bit clearer to reason about. E.g. const identityBadgeProps = !isCurrentUser || !Boolean(label)
? {}
: {
customLabel: 'YOU'
labelStyle: `color: ${theme.tagIndicatorContent};`
} (Or however prettier prefers 😄) |
||
/> | ||
{isCurrentUser && <You />} | ||
{isCurrentUser && Boolean(label) && <You />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I wonder if we still need to show this? I understood the change as always showing just the identity badge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, when we have a custom label (like in the first case of the picture) I have to show the custom label or 'YOU'? I think the two things are relevant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. I think keeping the "you" makes sense then. Let's double check what happens if you use a long label; ideally we will keep the "you" full width and shrink the label's size. |
||
</div> | ||
) | ||
}} | ||
|
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.
We generally leave the "trailing" arguments if they're not used: