File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
static/app/components/avatar Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ActorFixture } from 'sentry-fixture/actor' ;
12import { OrganizationFixture } from 'sentry-fixture/organization' ;
23import { ProjectFixture } from 'sentry-fixture/project' ;
34import { SentryAppFixture } from 'sentry-fixture/sentryApp' ;
@@ -174,6 +175,15 @@ describe('Avatar', function () {
174175 ) ;
175176 } ) ;
176177
178+ it ( 'can display a actor Avatar' , function ( ) {
179+ const actor = ActorFixture ( ) ;
180+
181+ render ( < AvatarComponent actor = { actor } /> ) ;
182+
183+ expect ( screen . getByTestId ( `letter_avatar-avatar` ) ) . toBeInTheDocument ( ) ;
184+ expect ( screen . getByText ( 'FB' ) ) . toBeInTheDocument ( ) ;
185+ } ) ;
186+
177187 it ( 'displays platform list icons for project Avatar' , function ( ) {
178188 const project = ProjectFixture ( {
179189 platform : 'java' ,
Original file line number Diff line number Diff line change @@ -7,14 +7,18 @@ import SentryAppAvatar from 'sentry/components/avatar/sentryAppAvatar';
77import TeamAvatar from 'sentry/components/avatar/teamAvatar' ;
88import UserAvatar from 'sentry/components/avatar/userAvatar' ;
99import type {
10+ Actor ,
1011 AvatarProject ,
1112 AvatarSentryApp ,
1213 DocIntegration ,
1314 OrganizationSummary ,
1415 Team ,
1516} from 'sentry/types' ;
1617
18+ import ActorAvatar from './actorAvatar' ;
19+
1720type Props = {
21+ actor ?: Actor ;
1822 docIntegration ?: DocIntegration ;
1923 /**
2024 * True if the Avatar is full color, rather than B&W (Used for SentryAppAvatar)
@@ -33,6 +37,7 @@ type Props = {
3337const Avatar = forwardRef ( function Avatar (
3438 {
3539 hasTooltip = false ,
40+ actor,
3641 user,
3742 team,
3843 project,
@@ -47,6 +52,10 @@ const Avatar = forwardRef(function Avatar(
4752) {
4853 const commonProps = { hasTooltip, forwardedRef : ref , ...props } ;
4954
55+ if ( actor ) {
56+ return < ActorAvatar actor = { actor } { ...commonProps } /> ;
57+ }
58+
5059 if ( user ) {
5160 return < UserAvatar user = { user } { ...commonProps } /> ;
5261 }
You can’t perform that action at this time.
0 commit comments