Open altherlex opened 2 years ago
Can I work on it? Also why is this done https://github.com/anuraghazra/github-readme-stats/blob/master/src/cards/top-languages-card.js#L170 ?
@RedHeadphone I am not 100% sure if I understand the feature request of @altherlex, but I guess it is about removing the percentages on the card. Feel free to create a PR for this option, and I will review it! I can not promise that it will be merged into the master shortly since #1708 doesn't have many upvotes.
This is done to make the progress item the correct width when a language percentage is below 10
-> 0.1
. The variable naming is a bit unfortunate.
How is that correcting width? instead it is increasing size from it's original value. It is not done in normal form, only in compact form.
@RedHeadphone I haven't worked on the language card in a while, and that code was written by @anuraghazra, but here are my 2 cents. I think the compact card function code ensures that language results can be stacked next to each other. The maximum percentage we can get is 100% which is three characters. In this case, in the compact card, you will only have one item, so you don't need to worry about stacking items next to each other. When you have two items, items will be stacked. In most cases, you will have two characters for the percentages (e.g. 50%/50%). This is what the offset width represents. When an item is lower than 10%, however, you only have one character before the dot, and you, therefore, have to add 10px to align the items on the second column. You can check out how these widths work by inspecting https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact using the chrome devTools.
but that progress variable isn't used for character offset, it is used for progress bar rect. To me that logic seems to be unnecessary.
with that logic
without that logic
Edit: Only possible reason I can think of why it was added is that low width rect are not rendered at all, to compensate that extra width is given which makes rect render
but that progress variable isn't used for character offset, it is used for progress bar rect. To me that logic seems to be unnecessary.
with that logic
without that logic
Edit: Only possible reason I can think of why it was added is that low width rect are not rendered at all, to compensate that extra width is given which makes rect render
I just checked the code on my laptop, and I think your conclusion is correct. The createLanguageTextNode
function is responsible for the card item generation, while the code you showed creates the progress bar. @anuraghazra do you clamp the progress of languages at 10% to keep them from disappearing on the card? Maybe let's add a short comment explaining the behaviour.
even I don't feel that this option will be used much, If anyone else wants to do this, go ahead!
Hey @altherlex can I work on it? Could you please assign it to me?
Hey, is there any updates on this issue? I have interest to work on it
@az3vedo As I have yet to receive a PR of @HemanthPaila feel free to work on it. I just assigned you 👍🏻.
@rickstaa I'm quite confuse, there is an option on top-langs route called hide_progress that already hide the numbers url example: https://github-readme-stats-fzcliha4u-az3vedo.vercel.app/api/top-langs?username=az3vedo&language=true&layout=compact&hide_progress=true
if I understood the discussion above along with the sugestion of @altherlex, we should add a option to show the progress bar but hiding the percentage numbers, right?
@rickstaa I'm quite confuse, there is an option on top-langs route called hide_progress that already hide the numbers url example: https://github-readme-stats-fzcliha4u-az3vedo.vercel.app/api/top-langs?username=az3vedo&language=true&layout=compact&hide_progress=true
if I understood the discussion above along with the sugestion of @altherlex, we should add a option to show the progress bar but hiding the percentage numbers, right?
@az3vedo I'm not 100% sure I was unaware of the hide_progress
parameter myself 👍🏻. Maybe @altherlex can elaborate 🤔.
Top Languages Card API option for not displaying numbers