-
Notifications
You must be signed in to change notification settings - Fork 146
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
feat: hide balance #5830
feat: hide balance #5830
Conversation
</Box> | ||
</Flex> | ||
</Link> | ||
<Box mr={{ md: 'space.05' }}> |
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.
Added this margin to align with the other buttons ("large screen" only)
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 sure if this file should be in the "common" directory. Is there a better place?
Thanks for the contribution @adrianocola , its much appreciated. I'll check it out now. In the meantime can you please:
Thanks! |
7713135
to
3cc02b5
Compare
Hey @pete-watters, thank you for the feedback. I just made the changes you asked for. Let me know if there is anything else I need to change! |
Thanks @adrianocola 👍 I checked with the team and their feedback was that it would be better to store this setting in Otherwise the code looks pretty good to me. Thanks again! |
Thanks for the team input, @pete-watters! I've added the Context to hide the balances that are only visible on the Home screen. The components that show the balance on the Home screen (like I can hide the balance everywhere in the extension. Some approaches:
To maintain the current solution where balances are hidden only on the Home screen, I can modify some components, such as Please let me know what you prefer or if you have any other suggestions! |
Thank you for your hard work @adrianocola 💪 I spoke to the dev team and the design team and we think it's best to keep this simple and manage the state globally with
|
@pete-watters, I forgot about the menu! This is definitively the best solution! Should I create a new commit for this, or would you prefer I continue squashing them? Edit: I made the change and kept everything in a single commit! |
3cc02b5
to
57ee6b0
Compare
That's great, thank you. One commit is best 👍 I'll test it soon and hopefully get it merged. Thanks! |
@markmhendrickson @pete-watters we prob need to hide balances here as well? wdyt |
dad3fda
to
3078f8f
Compare
3078f8f
to
78a7805
Compare
I think we could for stacked balances but not in the popup header. In the popup you don't always have access to the settings menu so you won't be able to easily show your balance again. It could be nice to hide it everywhere though |
Thanks @adrianocola 👍 I tested this and it LGTM. I checked with the design team and they asked if you can get rid of the toggle 👁️ on the account card and just have it in the We also have an open Q here about hiding it in more places #5830 (comment). It should be good to merge if you could please:
Thanks for your patience here and for your contributions |
It does seem better to hide consistently, even if some places (like the popup header) don't allow toggling per se. The user can open up the extension home and toggle from there as desired, even if not directly in the popup. |
Hey, team! Thank you for the input; I'll do it, @pete-watters! 💪 I also like the idea of consistently hiding everywhere. How about allowing the user to click the hidden balance in the header to show the balance? I can even extend this behavior to other places (where the balance doesn't show over a clickable button) to provide an easy way to show balances. Screen.Recording.2024-09-04.at.08.27.32.mov |
Good idea @adrianocola 👍 I checked with the design team and they would be happy if you can go ahead with this. Thanks again for your hard work |
Shall we use *** instead of ••• as the dot seems to get confused with our ellipses? |
78a7805
to
604cc24
Compare
8bc0558
to
8d4b1cd
Compare
Hey @pete-watters, I've made the changes proposed by the team! This is a summary with the changes:
Let me know if there is anything else I need to change! |
Thanks @adrianocola 👏 It's generally looking really great, thanks for all of the hard work, it's almost there. I mentioned one possible coding style improvement here I noticed that for locked balances the UI is not aligned correctly, so that needs to be fixed: |
c770a25
to
49e7d00
Compare
Hey @pete-watters, thanks for the support and patience!
|
49e7d00
to
459f6e5
Compare
canClickToShow?: boolean; | ||
} | ||
|
||
export function BalancePrivate({ children, canClickToShow, ...rest }: BalancePrivateProps) { |
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.
Maybe this can be PrivateBalance
to match the convention of PrivateText
?
Do you need the prop canClickToShow
? It seems to be always passed in as true
?
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 renamed the component and am now using it in a place that needs to set the prop canClickToShow=false
(I actually don't pass it at all).
@@ -0,0 +1,38 @@ | |||
import React from 'react'; |
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.
Maybe we can introduce a container
component here - PrivateText
, so that it can fetch the setting from the state and avoid drilling it down?
So it would be something like private-text.tsx
:
import { PrivateTextLayout } from '@app/ui/components/privacy/private-text.layout';
export function PrivateText() {
const isPrivate = useIsPrivateMode();
return (
<PrivateTextLayout
isPrivate={isBalancePrivate}
onShowValue={onShowBalance}
display="inline-block"
overflow="hidden"
>
{balance}
</PrivateTextLayout>
)
}
That could help avoid having to drill down isPrivate={isPrivate}
so often and we could isolate it into it's own feature: features/privacy/
. We could also add onShowValue={onShowBalance}
in there
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 previous version had this container component, and I used it everywhere. Unfortunately, this broke the Storybook and the project structure because it was used in other layout
components. The biggest ones were the CryptoAssetItemLayout
and TransactionItemLayout
components.
I've removed the drilling down of the isPrivate
prop in the AssetList
component. I've moved the state subscription closer to the CryptoAssetItemLayout
or TransactionItemLayout
component.
I moved the PrivateText
and PrivateTextLayout
components to the app/components/privacy/
folder. These components are used by other components in the components
and features
folders, so the dependency-cruiser
did not allow me to place them in the features
folder.
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.
OK great, thanks for the explanation 👍
This looks great @adrianocola and it is working perfectly, nice job! I added two more suggestions about how we could improve the design of the code but I think it's pretty solid overall and close to merge. Let me know what you think |
459f6e5
to
d2599ab
Compare
@pete-watters, thanks for the suggestions. Almost there!
|
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.
Great work @adrianocola , thanks for your persistence here. The code looks good to me and I tested it and it's working well.
I will try to get it merged soon but we are having a CI issue now I need to fix first.
@mica000 can you check this build and do a Design QA when you have a chance?
Here's a demo in case it helps
https://github.com/user-attachments/assets/7d545fd9-b411-4b83-8cde-9f3cad3d02c8
@adrianocola : Great work on this feature 👏 I will get it merged and into the next release once we have resolved the CI issue |
Indeed! Thanks @adrianocola!! ✨ |
@adrianocola - I got your work merged in and we will include it in the next release. Thanks again for your efforts here 👏 |
Thank you so much, everyone! I’m really glad I could contribute and work with all of you! 🚀 |
This PR:
Implementation details:
HideableBalance
component that shows/hides its child based on theHideBalanceContext
value.HideBalanceProvider
and added it to the home page.Please let me know if there’s anything I need to change!
Wallet:
Screen.Recording.2024-08-27.at.14.32.13.mov
Large Screen:
Screen.Recording.2024-08-27.at.14.33.45.mov