Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
laholstege committed Sep 22, 2023
1 parent 18725e1 commit 7bd4432
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Keas.Mvc/ClientApp/src/components/People/PersonDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ const PersonDetails = (props: IProps) => {

const canEdit = PermissionsUtil.canEditPeople(context.permissions);

// this is the only place we render pronouns. if we use them elsewhere, we should move this to a util
const formatPronouns = (pronouns: string) => {
pronouns = pronouns.trim();
if (pronouns.startsWith('(') && pronouns.endsWith(')')) {
return pronouns; // if user has, say "(they/them" then that's their problem and i don't care
} else {
return `(${pronouns})`;
}
};

return (
<div>
<div>
Expand All @@ -57,7 +67,9 @@ const PersonDetails = (props: IProps) => {
{props.selectedPersonInfo.person.name}{' '}
<div className='discreet'>
{!!props.selectedPersonInfo.person.user?.pronouns &&
props.selectedPersonInfo.person.user.pronouns}
formatPronouns(
props.selectedPersonInfo.person.user.pronouns
)}
</div>
</h2>
</div>
Expand Down

0 comments on commit 7bd4432

Please sign in to comment.