-
Notifications
You must be signed in to change notification settings - Fork 41
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: shorten "From" in details #336
base: development
Are you sure you want to change the base?
Conversation
|
I think this should only shorten when needed. On full desktop view it is not needed but it is still shortened. |
I know that, but for me the "For" in main collect display is also shortened therefore I didn't know. Will fix both. |
This is a fancy solution |
@0x4007 should be good 2 go |
Here is a video demo: shortenedAddress.mp4 |
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.
Works fine. Although the js approach seems to be kind of an overkill for a task of shortening strings, I suppose we could simply apply css to shorten addresses at the end.
I've added ens name handling too to fix #237. Demo: ens-demo.webm |
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 should be simplified using CSS
return address; | ||
} | ||
|
||
// remove 1 letter for every 6px below 520px |
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 use pure CSS. I implemented this logic in work.ubq.fi for the issue titles and repository names. You can probably use the same logic.
function formatLargeNumber(value: BigNumber, decimals: number): string { | ||
const num = parseFloat(ethers.utils.formatUnits(value, decimals)); | ||
|
||
if (num >= 1_000_000_000_000_000) { | ||
return "Unlimited"; // we can consider quintillion and above basically unlimited | ||
return "Unlimited"; // we can consider quintillion and above basically unlimited |
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.
return "Unlimited"; // we can consider quintillion and above basically unlimited | |
return "Unlimited"; // we can consider quadrillion and above basically unlimited |
Normally resolving multiple issues with a single pull is forbidden but to be honest both should have bene consolidated into a single task anyways so will let that slide! Can you implement using CSS? It will require less logic and we don't need to clutter our typescript further. |
Yeah will refac today |
@0x4007 in work.ubq.fi you use |
|
The trimming part of it is working though I can't make td respect the width of the table. It overflows to fit content going out of the screen as attached in the following screenshot: I've searched and tried out some StackOverflow solutions. Will try it later, if anyone knows easily how to do that lmk, it also seems someone tried to fix td overflow before as well indicated by: It sucks to fix this which is a limiter of implementing a css solution. |
@zugdev, this task has been idle for a while. Please provide an update. |
Resolves #312
Resolves #237