Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/frontend/src/components/fap/Members/FapMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { UserContext } from 'context/UserContextProvider';
import { BasicUserDetails, UserRole, Fap } from 'generated/sdk';
import { useCheckAccess } from 'hooks/common/useCheckAccess';
import { useRenewToken } from 'hooks/common/useRenewToken';
import { useFapReviewersData } from 'hooks/fap/useFapReviewersData';
import { FapMember, useFapReviewersData } from 'hooks/fap/useFapReviewersData';
import { tableIcons } from 'utils/materialIcons';
import useDataApiWithFeedback from 'utils/useDataApiWithFeedback';
import { getFullUserName } from 'utils/user';
Expand All @@ -43,7 +43,13 @@ type FapMembersProps = {
};

const columns = [
{ title: 'Name', field: 'user.firstname' },
{
title: 'Name',
render: (rowData: FapMember) =>
rowData.user.preferredname
? rowData.user.preferredname
: rowData.user.firstname,
},
{
title: 'Surname',
field: 'user.lastname',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ type AssignFapMemberToProposalModalProps = {
const memberRole = (member: FapAssignedMember) => `${member.role?.title}`;

const columns = [
{ title: 'Name', field: 'firstname' },
{
title: 'Name',
render: (rowData: FapAssignedMember) =>
rowData.preferredname ? rowData.preferredname : rowData.firstname,
},
{ title: 'Surname', field: 'lastname' },
{ title: 'Proposal Count', field: 'proposalsCountByCall' },
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ const FapAssignedReviewersTable = ({
const assignmentColumns = [
{
title: 'First name',
field: 'user.firstname',
render: (rowData: FapProposalAssignmentType) =>
rowData.user
? rowData.user.preferredname
? rowData.user.preferredname
: rowData.user.firstname
: '-',
},
{
title: 'Last name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const MultiRankAssignmentDialog = ({
}}
>
<TableCell component="th" scope="row">
{row.firstname}
{row.preferredname ? row.preferredname : row.firstname}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we should always set the preferredname, so we do not need to do these checks everywhere. If a user has a preferredname we set it otherwise we set preferredame using name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've open a issue to do a larger code wide change: UserOfficeProject/issue-tracker#1499

</TableCell>
<TableCell align="left">{row.lastname}</TableCell>
<TableCell align="right">
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/components/user/PeopleTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ const PeopleTable = ({
...(selectedItems.map((selectedItem) => ({
id: selectedItem.id,
firstname: selectedItem.firstname,
preferredname: selectedItem.preferredname,
lastname: selectedItem.lastname,
institution: selectedItem.institution,
institutionId: selectedItem.institutionId,
Expand All @@ -346,6 +347,7 @@ const PeopleTable = ({
{
id: selectedItem.id,
firstname: selectedItem.firstname,
preferredname: selectedItem.preferredname,
lastname: selectedItem.lastname,
institution: selectedItem.institution,
institutionId: selectedItem.institutionId,
Expand Down
Loading