Skip to content

Commit

Permalink
✨ Unformat name
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlaa committed Feb 10, 2025
1 parent 3ba241c commit 7b9d7b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import OrganisationFetchError from '@/components/organisations/OrganisationFetch
import Trans from '@/components/translation/Trans'
import { organisationsDashboardClickParameters } from '@/constants/tracking/pages/organisationsDashboard'
import ButtonLink from '@/design-system/inputs/ButtonLink'
import { unformatAdministratorName } from '@/helpers/organisations/unformatAdministratorName'
import { useFetchPolls } from '@/hooks/organisations/polls/useFetchPolls'
import useFetchOrganisation from '@/hooks/organisations/useFetchOrganisation'
import { capitalizeString } from '@/utils/capitalizeString'
Expand Down Expand Up @@ -44,7 +45,11 @@ export default function OrganisationPage() {
<span>
<Trans>Bienvenue</Trans>{' '}
<span className="text-primary-700">
{capitalizeString(organisation.administrators[0].name || '')}
{capitalizeString(
unformatAdministratorName(
organisation.administrators[0].name || ''
)
)}
</span>
,
</span>
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/organisations/unformatAdministratorName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ADMINISTRATOR_SEPARATOR } from '@/constants/organisations/administrator'

// Removes the separator between the first and last name of an administrator
export function unformatAdministratorName(name: string) {
return name.replace(ADMINISTRATOR_SEPARATOR, ' ')
}

0 comments on commit 7b9d7b5

Please sign in to comment.