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

Update NumberBadge to show hundreds in full, show thousands with k #38605

Merged
merged 3 commits into from Nov 17, 2017
Merged

Update NumberBadge to show hundreds in full, show thousands with k #38605

merged 3 commits into from Nov 17, 2017

Conversation

danbovey
Copy link
Contributor

Fixes #38524

If the 'k' thing isn't acceptable we have the option to ditch that and show something else for 1000 or more. This fix is mainly to make it so that when there are 100-200 changes in a SCM workspace, which can happen, it's more clear to the user that there are that many changes.

@danbovey
Copy link
Contributor Author

There's another instance where 99+ is used (task.contribution.ts#L221) and it actually differs from the SCM badge in it's current state by localizing when there are many markers (defaulting to 99+), so this change would differ from that even more, so someone who knows about context of markers and this needs to decide a consistent way to display larger numbers.

if (badge.number > 9999) {
number = '10k+';
} else if (badge.number > 999) {
number = (badge.number / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this just seems like too complex of a logic.
Can we use something like

badge.number.toString()[0] + 'k'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! Because we know the number is < 10,000, we can do that 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to use .charAt(0) as it's more readable.

@bpasero
Copy link
Member

bpasero commented Nov 17, 2017

@danbovey I think the strings need to be localized (nls.localize)

@isidorn
Copy link
Contributor

isidorn commented Nov 17, 2017

@joaomoreno initiated this also assigning to him. Just thumbs up if you approve of merging this in and I will reivew

@isidorn isidorn added this to the November 2017 milestone Nov 17, 2017
@bpasero
Copy link
Member

bpasero commented Nov 17, 2017

Yeah I like that we change it 👍

@joaomoreno joaomoreno self-requested a review November 17, 2017 15:38
@joaomoreno joaomoreno removed their assignment Nov 17, 2017
Copy link
Member

@joaomoreno joaomoreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The strings need localization, like @bpasero pointed out. Else, good!

@danbovey
Copy link
Contributor Author

OK could you share a similar, merged PR as an example of moving strings to language files?

Or anybody is welcome to do the work on the forked branch.

@isidorn
Copy link
Contributor

isidorn commented Nov 17, 2017

@danbovey just add nls.localize call around your string, no further action than that is needed

@danbovey
Copy link
Contributor Author

Added nls.localize('largeNumberBadge', '10k+')

@isidorn
Copy link
Contributor

isidorn commented Nov 17, 2017

Looks good, thanks for your PR
🍻

@isidorn isidorn merged commit 5d34ae0 into microsoft:master Nov 17, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the pending changes badge amount
5 participants