Show extension download counts with thousands separators (#12857)

This PR adjusts the extension download counts to be displayed using
thousands separators.

Release Notes:

- Adjusted extension download counts to display with thousands
separators (e.g., `1,000,000`).
This commit is contained in:
Marshall Bowers 2024-06-10 14:19:17 -04:00 committed by GitHub
parent 0d5485bd6c
commit 57c40299a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

11
Cargo.lock generated
View File

@ -3833,6 +3833,7 @@ dependencies = [
"fuzzy", "fuzzy",
"gpui", "gpui",
"language", "language",
"num-format",
"picker", "picker",
"project", "project",
"release_channel", "release_channel",
@ -6735,6 +6736,16 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "num-format"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3"
dependencies = [
"arrayvec",
"itoa",
]
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.45" version = "0.1.45"

View File

@ -307,6 +307,7 @@ log = { version = "0.4.16", features = ["kv_unstable_serde"] }
markup5ever_rcdom = "0.3.0" markup5ever_rcdom = "0.3.0"
nanoid = "0.4" nanoid = "0.4"
nix = "0.28" nix = "0.28"
num-format = "0.4.4"
once_cell = "1.19.0" once_cell = "1.19.0"
ordered-float = "2.1.1" ordered-float = "2.1.1"
palette = { version = "0.7.5", default-features = false, features = ["std"] } palette = { version = "0.7.5", default-features = false, features = ["std"] }

View File

@ -24,6 +24,7 @@ fs.workspace = true
fuzzy.workspace = true fuzzy.workspace = true
gpui.workspace = true gpui.workspace = true
language.workspace = true language.workspace = true
num-format.workspace = true
picker.workspace = true picker.workspace = true
project.workspace = true project.workspace = true
release_channel.workspace = true release_channel.workspace = true

View File

@ -16,6 +16,7 @@ use gpui::{
InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle, InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle,
UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext, UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
}; };
use num_format::{Locale, ToFormattedString};
use release_channel::ReleaseChannel; use release_channel::ReleaseChannel;
use settings::Settings; use settings::Settings;
use std::ops::DerefMut; use std::ops::DerefMut;
@ -487,7 +488,10 @@ impl ExtensionsPage {
.size(LabelSize::Small), .size(LabelSize::Small),
) )
.child( .child(
Label::new(format!("Downloads: {}", extension.download_count)) Label::new(format!(
"Downloads: {}",
extension.download_count.to_formatted_string(&Locale::en)
))
.size(LabelSize::Small), .size(LabelSize::Small),
), ),
) )