diff options
author | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2023-09-06 01:46:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 19:46:33 +0200 |
commit | aecd9d8fda932cc2229a84a45937877b20625758 (patch) | |
tree | bc5697103fd91d168dc91101b72db3dd6219420d /src/plugins/memberCount.tsx | |
parent | faeb4fb5856a03c75329162ff3384645075a0c07 (diff) | |
download | Vencord-aecd9d8fda932cc2229a84a45937877b20625758.tar.gz Vencord-aecd9d8fda932cc2229a84a45937877b20625758.tar.bz2 Vencord-aecd9d8fda932cc2229a84a45937877b20625758.zip |
feat(memberCount): format count according to user locale (#1679)
Diffstat (limited to 'src/plugins/memberCount.tsx')
-rw-r--r-- | src/plugins/memberCount.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/memberCount.tsx b/src/plugins/memberCount.tsx index 7f8b868..ecdb8af 100644 --- a/src/plugins/memberCount.tsx +++ b/src/plugins/memberCount.tsx @@ -30,6 +30,9 @@ const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & { getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; }; }; +const sharedIntlNumberFormat = new Intl.NumberFormat(); +const numberFormat = (value: number) => sharedIntlNumberFormat.format(value); + function MemberCount() { const { id: channelId, guild_id: guildId } = useStateFromStores([SelectedChannelStore], () => getCurrentChannel()); const { groups } = useStateFromStores( @@ -57,7 +60,7 @@ function MemberCount() { alignContent: "center", gap: 0 }}> - <Tooltip text={`${online} Online in this Channel`} position="bottom"> + <Tooltip text={`${numberFormat(online)} online in this channel`} position="bottom"> {props => ( <div {...props}> <span @@ -70,11 +73,11 @@ function MemberCount() { marginRight: "0.5em" }} /> - <span style={{ color: "var(--green-360)" }}>{online}</span> + <span style={{ color: "var(--green-360)" }}>{numberFormat(online)}</span> </div> )} </Tooltip> - <Tooltip text={`${total} Total Server Members`} position="bottom"> + <Tooltip text={`${numberFormat(total)} total server members`} position="bottom"> {props => ( <div {...props}> <span @@ -88,7 +91,7 @@ function MemberCount() { marginLeft: "1em" }} /> - <span style={{ color: "var(--primary-400)" }}>{total}</span> + <span style={{ color: "var(--primary-400)" }}>{numberFormat(total)}</span> </div> )} </Tooltip> |