Skip to content

Commit

Permalink
Format number of entities with locale
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Dec 11, 2024
1 parent b594c29 commit dafd84f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Entities.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Entities = ({
return (
<section className="entities-search">
{(!hideTitle) &&
<h2>{title || `${I18n.t(`${modelName}.title`)} (${totalElements || entities.length})`}</h2>}
<h2>{title || `${I18n.t(`${modelName}.title`)} (${(totalElements || entities.length).toLocaleString()})`}</h2>}
{(loading || hideTitle) && <Loader/>}
{!isEmpty(filters) && <div className={`${filterClassName} search-filter`}>{filters}</div>}
<div className={`search ${showNew ? "" : "standalone"}`}>
Expand Down
10 changes: 0 additions & 10 deletions client/src/tabs/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,12 @@ export const Users = () => {
: <Chip type={ChipType.Main_400} label={I18n.t("forms.you")}/>
})
}
const hasEntities = totalElements > 0;
let title = "";

if (hasEntities) {
title = I18n.t(`users.found`, {
count: totalElements.toLocaleString(),
plural: I18n.t(`users.${totalElements === 1 ? "singleUser" : "multipleUsers"}`)
})
}
return (
<div className="mod-users">
<Entities entities={users}
modelName="users"
defaultSort="name"
columns={columns}
title={title}
newLabel={currentUser.superUser ? I18n.t("invitations.newInvite") : null}
showNew={isUserAllowed(AUTHORITIES.SUPER_USER, currentUser)}
newEntityFunc={() => navigate(`/invitation/new?maintainer=true`)}
Expand Down

0 comments on commit dafd84f

Please sign in to comment.