From feed9ea3c94c29ffc298597ee50528bdcdbc1a0e Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 23 Oct 2025 09:44:11 +0200 Subject: [PATCH] chore: show avatars in cross-project change requests table. (#10838) Updates the CR table cell to show the avatar (again). This applies both to the project-based table and the global table. Also adds a truncator to the created by cell, to avoid weird name stacking. Because the truncator already has a popup functionality on truncation, we disable it for the avatars. To make it compile, I've manually updated the types based on the schemas. I'll regenerate them at a later date. The fields that were marked as nullable are typically not nullable (although often they may not be required) in our schemas, so I'll take it out for now. If we find that we *are* returning null there, it still shouldn't cause any problems for the UI, so it's a low risk fix that can be done later if necessary. Before: image image After: image image --- .../ChangeRequestsTabs/AvatarCell.tsx | 20 ++++++++++++++----- ...geRequestSearchItemSchemaOneOfCreatedBy.ts | 6 ++---- ...questSearchItemSchemaOneOfFourCreatedBy.ts | 6 ++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/frontend/src/component/changeRequest/ProjectChangeRequests/ChangeRequestsTabs/AvatarCell.tsx b/frontend/src/component/changeRequest/ProjectChangeRequests/ChangeRequestsTabs/AvatarCell.tsx index 10ae362ab5..3808ef2dd3 100644 --- a/frontend/src/component/changeRequest/ProjectChangeRequests/ChangeRequestsTabs/AvatarCell.tsx +++ b/frontend/src/component/changeRequest/ProjectChangeRequests/ChangeRequestsTabs/AvatarCell.tsx @@ -2,24 +2,34 @@ import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; import { styled, Typography } from '@mui/material'; import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; import { Highlighter } from 'component/common/Highlighter/Highlighter'; +import { UserAvatar } from 'component/common/UserAvatar/UserAvatar'; +import { Truncator } from 'component/common/Truncator/Truncator'; +import type { ComponentProps } from 'react'; const StyledContainer = styled('div')(({ theme }) => ({ display: 'flex', flexDirection: 'row', alignItems: 'center', margin: 0, + columnGap: theme.spacing(0.5), })); -export const AvatarCell = ({ value }: any) => { +type AvatarCellProps = { + value: ComponentProps['user']; +}; + +export const AvatarCell = ({ value }: AvatarCellProps) => { const { searchQuery } = useSearchHighlightContext(); return ( + - {' '} - - {value?.username} - + + + {value?.username} + + diff --git a/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfCreatedBy.ts b/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfCreatedBy.ts index d9d08f03f2..437127ee35 100644 --- a/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfCreatedBy.ts +++ b/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfCreatedBy.ts @@ -12,12 +12,10 @@ export type ChangeRequestSearchItemSchemaOneOfCreatedBy = { id: number; /** * Avatar image URL for the user. - * @nullable */ - imageUrl?: string | null; + imageUrl?: string; /** * Username of the user. - * @nullable */ - username?: string | null; + username?: string; }; diff --git a/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfFourCreatedBy.ts b/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfFourCreatedBy.ts index 5d264a0b4c..2e61ec1f1b 100644 --- a/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfFourCreatedBy.ts +++ b/frontend/src/openapi/models/changeRequestSearchItemSchemaOneOfFourCreatedBy.ts @@ -12,12 +12,10 @@ export type ChangeRequestSearchItemSchemaOneOfFourCreatedBy = { id: number; /** * Avatar image URL for the user. - * @nullable */ - imageUrl?: string | null; + imageUrl?: string; /** * Username of the user. - * @nullable */ - username?: string | null; + username?: string; };