1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: Update avatar usage in change requests (#7818)

This commit is contained in:
Thomas Heartman 2024-08-09 09:54:16 +02:00 committed by GitHub
parent 2f92dac14e
commit 258909db39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 17 deletions

View File

@ -1,6 +1,6 @@
import type React from 'react'; import type React from 'react';
import type { FC } from 'react'; import type { FC } from 'react';
import { Box, styled, TextField, Tooltip } from '@mui/material'; import { Box, styled, TextField } from '@mui/material';
import { StyledAvatar } from './StyledAvatar'; import { StyledAvatar } from './StyledAvatar';
import type { IUser } from 'interfaces/user'; import type { IUser } from 'interfaces/user';
@ -18,9 +18,7 @@ export const AddCommentField: FC<{
}> = ({ user, commentText, onTypeComment, children }) => ( }> = ({ user, commentText, onTypeComment, children }) => (
<> <>
<AddCommentWrapper> <AddCommentWrapper>
<Tooltip title={user?.name || user?.username}> <StyledAvatar user={user} />
<StyledAvatar src={user?.imageUrl || ''} />
</Tooltip>
<TextField <TextField
variant='outlined' variant='outlined'
placeholder='Add your comment here' placeholder='Add your comment here'

View File

@ -1,7 +1,7 @@
import type { FC } from 'react'; import type { FC } from 'react';
import { Markdown } from 'component/common/Markdown/Markdown'; import { Markdown } from 'component/common/Markdown/Markdown';
import Paper from '@mui/material/Paper'; import Paper from '@mui/material/Paper';
import { Box, styled, Typography, Tooltip } from '@mui/material'; import { Box, styled, Typography } from '@mui/material';
import TimeAgo from 'react-timeago'; import TimeAgo from 'react-timeago';
import { StyledAvatar } from './StyledAvatar'; import { StyledAvatar } from './StyledAvatar';
import type { IChangeRequestComment } from '../../changeRequest.types'; import type { IChangeRequestComment } from '../../changeRequest.types';
@ -29,9 +29,7 @@ export const ChangeRequestComment: FC<{ comment: IChangeRequestComment }> = ({
comment, comment,
}) => ( }) => (
<ChangeRequestCommentWrapper> <ChangeRequestCommentWrapper>
<Tooltip title={comment.createdBy.username}> <StyledAvatar user={comment.createdBy} />
<StyledAvatar src={comment.createdBy.imageUrl} />
</Tooltip>
<CommentPaper variant='outlined'> <CommentPaper variant='outlined'>
<CommentHeader> <CommentHeader>
<Box> <Box>

View File

@ -1,6 +1,7 @@
import { Avatar, styled } from '@mui/material'; import { styled } from '@mui/material';
import { UserAvatar } from 'component/common/UserAvatar/UserAvatar';
export const StyledAvatar = styled(Avatar)(({ theme }) => ({ export const StyledAvatar = styled(UserAvatar)(({ theme }) => ({
height: '32px', height: '32px',
width: '32px', width: '32px',
marginTop: theme.spacing(1), marginTop: theme.spacing(1),

View File

@ -1,5 +1,6 @@
import { styled } from '@mui/material'; import { styled } from '@mui/material';
import { Avatar, Box, Card, Paper, Typography } from '@mui/material'; import { Box, Card, Paper, Typography } from '@mui/material';
import { UserAvatar } from 'component/common/UserAvatar/UserAvatar';
export const StyledPaper = styled(Paper)(({ theme }) => ({ export const StyledPaper = styled(Paper)(({ theme }) => ({
padding: theme.spacing(3, 4), padding: theme.spacing(3, 4),
@ -29,7 +30,8 @@ export const StyledCard = styled(Card)(({ theme }) => ({
backgroundColor: theme.palette.background.elevation2, backgroundColor: theme.palette.background.elevation2,
})); }));
export const StyledAvatar = styled(Avatar)(({ theme }) => ({ export const StyledAvatar = styled(UserAvatar)(({ theme }) => ({
height: '24px', height: '24px',
width: '24px', width: '24px',
marginInline: 0,
})); }));

View File

@ -51,9 +51,7 @@ export const ChangeRequestHeader: FC<{ changeRequest: ChangeRequestType }> = ({
})} })}
> >
<Tooltip title={changeRequest?.createdBy?.username}> <Tooltip title={changeRequest?.createdBy?.username}>
<StyledAvatar <StyledAvatar user={changeRequest?.createdBy} />
src={changeRequest?.createdBy?.imageUrl}
/>
</Tooltip> </Tooltip>
</Box> </Box>
<Typography <Typography

View File

@ -40,7 +40,7 @@ export const ChangeRequestApprover: FC<IChangeRequestReviewerProps> = ({
}) => { }) => {
return ( return (
<StyledBox> <StyledBox>
<StyledAvatar src={imageUrl} /> <StyledAvatar user={{ name, imageUrl }} />
<ReviewerName variant='body1'>{name}</ReviewerName> <ReviewerName variant='body1'>{name}</ReviewerName>
<StyledSuccessIcon /> <StyledSuccessIcon />
</StyledBox> </StyledBox>
@ -53,7 +53,7 @@ export const ChangeRequestRejector: FC<IChangeRequestReviewerProps> = ({
}) => { }) => {
return ( return (
<StyledBox> <StyledBox>
<StyledAvatar src={imageUrl} /> <StyledAvatar user={{ name, imageUrl }} />
<ReviewerName variant='body1'>{name}</ReviewerName> <ReviewerName variant='body1'>{name}</ReviewerName>
<StyledErrorIcon /> <StyledErrorIcon />
</StyledBox> </StyledBox>