ipfs-companion icon indicating copy to clipboard operation
ipfs-companion copied to clipboard

fix: truncate no. of peers to unit of "k" when > 999

Open Carson12345 opened this issue 3 years ago • 3 comments

#1017

About The issue opener found out that when number of peers is 1000 or above, the last digit might be partially invisible and cause confusion due to the badge's max width.

The core team replied to the issue suggesting to truncate it in the format of "1k", "2k". So I implemented the approach and made this PR.

Original UI

128388115-9fcf5a09-6e82-4234-9d7d-b9225213ccad

Committed UI Change

  • [X] truncate no. of peers to unit of "k" when > 999 (e.g. the count is 2352 in this case)
Screenshot 2022-02-18 at 11 44 58 AM

Show full number when < 999

Screenshot 2022-02-18 at 11 46 59 AM

This is my first PR, please let me know if I could do it better, looking forward to help with other tasks of this repo and IPFS!

Carson12345 avatar Feb 18 '22 13:02 Carson12345

Thank you for submitting this PR! A maintainer will be here shortly to review it. We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the rest) and in its best form. Follow the code contribution guidelines if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment. Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on any missing things and potentially assigning a reviewer for high priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within seven business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. We are very grateful for your contribution!

welcome[bot] avatar Feb 18 '22 13:02 welcome[bot]

sorry that my code didn't pass the test for JS lint, has fixed by using standard JS lint and pushed. Thanks for reviewing!

Carson12345 avatar Feb 22 '22 02:02 Carson12345

sorry that my code didn't pass the test for JS lint, has fixed by using standard JS lint and pushed. Thanks for reviewing!

Not a problem. Thanks so much for the contribution! I touched up the code a tiny bit and am giving it my approval now.

SgtPooki avatar Jul 11 '22 18:07 SgtPooki