Skip to content
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

Add the option to use short form for the Total Contributions count #729

Closed
jgphilpott opened this issue Nov 11, 2024 · 2 comments · Fixed by #745
Closed

Add the option to use short form for the Total Contributions count #729

jgphilpott opened this issue Nov 11, 2024 · 2 comments · Fixed by #745
Labels
enhancement New feature or request

Comments

@jgphilpott
Copy link
Contributor

jgphilpott commented Nov 11, 2024

Is your feature request related to a problem? Please describe:

Large integers for Total Contributions will start to look squished if the number reaches 1 million or more. Also, some people might like to see the count in short form even if it is less than 1M.

Describe the solution you'd like

You should have the option to display the Total Contributions count in short form, this could default to true.

Here is some example JS code:

function shortNumber(number) {

    const units = ['', 'K', 'M', 'B', 'T']
    let unitIndex = 0

    while (number >= 1000 && unitIndex < units.length - 1) {
        number /= 1000
        unitIndex++
    }

    number = parseFloat(number.toFixed(1))
    unit = units[unitIndex]

    return number + unit

}

This turns 1234 into 1.2k, 1234567 into 1.2M, 1234567890 into 1.2B and so on ...

Describe alternatives you've considered

N/A

Additional context

This problem and solution were originally discussed here: #725 (comment)

@DenverCoder1
Copy link
Owner

It is implemented now!

image

@jgphilpott
Copy link
Contributor Author

Awesome, that's great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants