diff --git a/src/pages/TeamDetail/TeamDetail.tsx b/src/pages/TeamDetail/TeamDetail.tsx index bf49e5b6..66b6a15f 100644 --- a/src/pages/TeamDetail/TeamDetail.tsx +++ b/src/pages/TeamDetail/TeamDetail.tsx @@ -23,14 +23,21 @@ export default function TeamDetail() { const { teamId } = useParams<{ teamId: string }>() const prepTeamData = useCallback((response: TeamDetailData): TableData['data'] => { - return response['teamUsers'].teamUsers.map((user) => ({ - id: user?.principal_name, - user: user.display_name, - seksjon: user.section_name, - navn: renderUsernameColumn(user), - gruppe: user.groups?.map((group) => getGroupType(group.uniform_name)).join(', '), - epost: user?.principal_name, - })) + return response['teamUsers'].teamUsers.map((user) => { + // Makes data in username column searchable and sortable in table by including these fields + const usernameColumn = { + user: user.display_name, + seksjon: user.section_name, + } + + return { + id: user?.principal_name, + ...usernameColumn, + navn: renderUsernameColumn(user), + gruppe: user.groups?.map((group) => getGroupType(group.uniform_name)).join(', '), + epost: user?.principal_name, + } + }) }, []) useEffect(() => { diff --git a/src/pages/TeamOverview/TeamOverview.tsx b/src/pages/TeamOverview/TeamOverview.tsx index b83460a3..d35ace6e 100644 --- a/src/pages/TeamOverview/TeamOverview.tsx +++ b/src/pages/TeamOverview/TeamOverview.tsx @@ -31,7 +31,7 @@ export default function TeamOverview() { return response[team].teams.map((team) => ({ id: team.uniform_name, - seksjon: team.section_name, + seksjon: team.section_name, // Makes section name searchable and sortable in table by including the field navn: renderTeamNameColumn(team), teammedlemmer: team.team_user_count, ansvarlig: formatDisplayName(team.manager.display_name), diff --git a/src/pages/UserProfile/UserProfile.tsx b/src/pages/UserProfile/UserProfile.tsx index c0a16100..347dc7df 100644 --- a/src/pages/UserProfile/UserProfile.tsx +++ b/src/pages/UserProfile/UserProfile.tsx @@ -31,7 +31,7 @@ export default function UserProfile() { (response: UserProfileTeamResult): TableData['data'] => { return response.teams.map((team) => ({ id: team.uniform_name, - seksjon: team.section_name, + seksjon: team.section_name, // Makes section name searchable and sortable in table by including the field navn: renderTeamNameColumn(team), gruppe: team.groups?.map((group) => getGroupType(group)).join(', '), epost: userProfileData?.principal_name,