Skip to content

Commit

Permalink
Add documentation for first column data prep for Table
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnadeluy committed Feb 27, 2024
1 parent afd3a3b commit fc7810b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions src/pages/TeamDetail/TeamDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TeamOverview/TeamOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/UserProfile/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fc7810b

Please sign in to comment.